query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
GET /current_sessions/1 GET /current_sessions/1.json
def show @current_session = CurrentSession.find(params[:id]) render json: @current_session end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_sessions\n render json: Session.where(\"active = ?\", true)\n end", "def get_session\n session = Session.create!(key: Random.rand(0xFFFFFFFF).to_s)\n render json: { id: session.id, key: session.key }\n end", "def session_get\n nessus_rest_get(\"session\")\n end", "def show\n @session = Sso::Session.find(sso_session_id)\n render json: @session, serializer: Sso::SessionSerializer\n end", "def index\n @sessions = Session.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end", "def index\n sessions = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/sessions\"\n ).body\n end\n styled_header(\"OAuth Sessions\")\n styled_array(sessions.map { |session|\n [session[\"description\"], session[\"id\"]]\n })\n end", "def index\n @sessions = current_user.fitness_sessions\n end", "def sessions\n @sessions\n end", "def index\n @session_resources = SessionResource.all\n\n render json: @session_resources\n end", "def index\n @workout_sessions = WorkoutSession.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workout_sessions }\n end\n end", "def index\n @sessions = @event.sessions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end", "def index\n active_sessions = []\n my_sessions = []\n history_sessions = []\n join_sessions = current_user.join_sessions\n Session.all.each { |session|\n if session.user_id == current_user.id\n my_sessions.push session_srz(session)\n elsif join_sessions.any? {|js| js.session_id == session.id} and session.close\n history_sessions.push session_srz(session)\n else\n active_sessions.push session_srz(session)\n end\n }\n\n\n json_object = {\n data: {\n active_sessions: active_sessions,\n my_sessions: my_sessions,\n history_sessions: history_sessions\n #history_sessions: current_user.join_sessions\n }\n }\n\n render json: json_object,\n status: :ok,\n include: %w(session.lock)#nil\n\n #ok_request render_json#, %w(user)\n end", "def show\n render json: @session_resource\n end", "def show\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end", "def index\n @sessions = Session.all\n end", "def index\n @sessions = Session.all\n end", "def index\n @sessions = Session.all\n end", "def index\n @sessions = Session.all\n end", "def current_session(env=Thread.current[:env])\n return nil unless env\n setup_env(env)\n key = session['user_credentials']\n if @sessions[key]\n @refresh_sessions[key] = true\n else\n @session_mutex.synchronize do\n unless @previous_sessions[key]\n oldkey = key\n s = find_session\n key = session['user_credentials']\n @previous_sessions[oldkey] = key\n @sessions[key] = s\n @refresh_sessions[key] = true\n Thread.new do\n sleep Config::PreviousSessionTimeout\n @previous_sessions.delete(oldkey)\n end\n Thread.new do\n while @refresh_sessions[key] do\n @refresh_sessions.delete(key)\n sleep Config::SessionTimeout\n end\n @sessions.delete(key)\n end\n params['_need_cookie_update'] = true if full_path == '/ajax/poll'\n else\n key = @previous_sessions[key]\n end\n end\n end\n @sessions[key]\n end", "def get_today_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_today_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/today\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20045')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_today_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_sessions(user_id:)\n path = '/users/{userId}/sessions'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::SessionList\n )\n end", "def get_session(options = {})\n resp = @connection.post do |req|\n req.headers = { :Accept => 'application/json'}\n req.url 'v1/sessions'\n req.body = options.to_json\n end\n check_response_for_errors resp.body\n end", "def show\n @session = Session.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end", "def show\n @session = Session.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end", "def session\n @current_user = User.find_by_access_token(params[:access_token])\n \n # Fetch content for current user\n # find_friends_for_facebook_id(@current_user.facebook_id, since = nil)\n \n # return new friends\n # We want to send the entire friendslist hash of id, name to the client\n # friend_array = Friendship.find(:all, :select=>\"friend_id, friend_name\", :conditions=>\"user_id = #{@current_user.id}\").map {|f| {:friend_id=>f.friend_id.to_i, :friend_name=>f.friend_name}}\n # friend_id_array = friend_array.map do |f| f[:friend_id] end\n # \n # # The response should include the current user ID and name for the client to cache\n # session_response_hash = {\n # :access_token => @current_user.access_token,\n # :facebook_id => @current_user.facebook_id,\n # :name => @current_user.name,\n # :friends => friend_array\n # }\n \n session_response_hash = {\n :access_token => @current_user.access_token\n }\n\n respond_to do |format|\n format.xml { render :xml => session_response_hash.to_xml }\n format.json { render :json => session_response_hash.to_json }\n end\n end", "def show\n #logger.debug( cookies.inspect )\n logger.debug( \"Authorization header: #{request.headers['Authorization']}\" )\n @session = Session.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml\n format.json do\n render :json => {\n :session => {\n :token => @session.token,\n :link => {\n :rel => 'session',\n :uri => session_path(@session)\n }\n }\n }\n end\n end\n end", "def current\n session[:user_id] = params[:user_id]\n response_data = {\n status: 'success',\n currentUser: current_user,\n }\n render json: response_data, status: :ok\n end", "def retrieve_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end", "def list_my_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FrontendApi.list_my_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling FrontendApi.list_my_sessions, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling FrontendApi.list_my_sessions, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling FrontendApi.list_my_sessions, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/sessions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-Session-Token'] = opts[:'x_session_token'] if !opts[:'x_session_token'].nil?\n header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil?\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] || 'Array<Session>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FrontendApi.list_my_sessions\",\n :header_params => 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: FrontendApi#list_my_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def start_session(nick)\n usr = User.first(:nickname=>params[:nickname])\n p User.all\n if usr != nil\n sid = gen_sessionid\n\n #associate nick with sid & IP & communication password\n $sessions[nick] = {:ip=>@env['REMOTE_ADDR'], :sid=> sid, :lastrequest=> Time.now.to_i}\n\n #return JSON with sessionid\n return {:sid => sid}\n end\n return 'error'\nend", "def index\n @user_sessions = UserSession.all\n end", "def userIndex\n @user_sessions = current_user.sessions\n end", "def show\n @ykt_session = YktSession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ykt_session }\n end\n end", "def show\n begin\n if m = params[:id].match(/([^\\.]+)/)\n uid = m.captures.first\n else\n uid = params[:id]\n end\n sso_session = params[:session]\n\n # Check if session is valid\n @valid_session = (!uid.blank? && !sso_session.blank? && User.where(uid:uid,sso_session:sso_session).count > 0)\n\n # Build response\n response_hash = {\n valid: @valid_session,\n recheck: 3.minutes.from_now.utc\n }\n\n logger.info(\"INSPECT: session_hash => #{response_hash}\")\n\n render json: response_hash\n rescue Exception => e\n logger.error(e)\n raise e\n end\n end", "def get_cur_user\n @user = nil\n if is_logged_in session\n @user = User.find_by_sunet(session[:user_hash][\"username\"])\n end\n render json: @user\n end", "def get_cur_user\n @user = nil\n if is_logged_in session\n @user = User.find_by_sunet(session[:user_hash][\"username\"])\n end\n render json: @user\n end", "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def sess\n self.http_get(self.session_uri)#.tap{|t| STDERR.puts \"Trace: #{caller[1]}: returning #{t}\"}\n end", "def session_get(id)\n sessions.select {|s| s.SessionId().to_s == id.to_s}\n end", "def sessions\n Thread.current[:sessions] ||= {}\n end", "def sessionList\n if (\n params.has_key?(:experiment_id) == false || params[:experiment_id].empty? ||\n (@experiment = UteExperiment.where(:experiment_code => params[:experiment_id], :is_active => true).first) == nil\n ) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n @sessionlist = @experiment.ute_ex_sessions.where(:is_active => true).pluck(:session_code)\n #[ \n # UteExSession.where(:'ute_experiment.experiment_code' => params[:experiment_code], :is_active => true).pluck(:session_code)\n #].collect { |aoc| aoc.to_a}.flatten\n\n respond_to do |format|\n format.html { render text: 'Session list: <br/>' + { 'sessions' => @sessionlist }.to_json }\n format.json { \n render json: { 'sessions' => @sessionlist }.to_json \n }\n end\n end", "def current\n current_user.update!(last_login: Time.now)\n render json: current_user\n end", "def current\n current_user.update!(last_login: Time.now)\n render json: current_user\n end", "def sessions\n Thread.current[:sessions] ||= {}\n end", "def get\n params.required(:id)\n\n # Grab the device that is trying to authenticate\n unathenticated_error unless @api_consumer.is_a? Service\n service = @api_consumer\n\n @session = service.sessions.find(params[:id])\n end", "def current_user_session\n @current_user_session ||= UserSession.find\n end", "def current_user_session\n @current_user_session ||= UserSession.find\n end", "def index\n @user_session = UserSession.find\n if @user_session.nil?\n render :json => nil\n else\n @user = current_user\n @groups = @user.groups.order('groups.name')\n render 'user_sessions/index.json.rabl'\n end\n end", "def sessions=(value)\n @sessions = value\n end", "def current_user_session\n return @curent_user_session if defined?(@curent_user_session)\n @current_user_session = UserSession.find\n end", "def session(token)\n get(:signed, {:method => \"auth.getSession\", :token => token})\n end", "def get_info\n @info ||= @instance.client.getSessionInfo(sessionID: @id)\n end", "def sessions\n @sessions.each_key.to_a\n end", "def get_session\n begin\n if session[:user_id].present? && session[:user_name].present? && current_user.present?\n unless session[:comp_id].present?\n @result = {flag:true , session_id: session[:user_id] , :user_name=> session[:user_name]} \n else\n @result = {flag:true , session_id: session[:user_id] , :user_name=> session[:user_name] , :comp_id=> session[:comp_id]}\n end \n render :json=>@result\n else \n reset_session \n @result = {flag:false}\n render :json=>@result\n end \n rescue Exception=> e\n reset_session \n @result = {flag:false}\n render :json=>@result\n end\n \n end", "def create\n @current_session = CurrentSession.new(params[:current_session])\n\n if @current_session.save\n render json: @current_session, status: :created, location: @current_session\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end", "def fetch_active_session\n Rails.logger.debug \"SessionService::fetch_active_session::BEGIN\" \n current_time = Time.now\n active_session = @company.active_sessions.where(:company_id => @company.id).where(\" ? > start_time and ? < end_time\", current_time, current_time).first\n end", "def sessions\n return @sessions\n end", "def current\n current_user.update!(last_login: Time.now)\n render json: current_user, status: :ok\n end", "def index\n @sevone_sessions = SevoneSession.all\n end", "def sessions\n\n key = \"000000:#{TransamController::ACTIVE_SESSION_LIST_CACHE_VAR}\"\n @sessions = Rails.cache.fetch(key)\n @sessions.delete_if { |key, value| value[:expire_time] < Time.now }\n @sessions ||= {}\n\n end", "def get_all_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_all_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/all\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Session>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_all_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def sessionGet(options={})\n assert_valid_keys(options, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end", "def sessionGet(options={})\n assert_valid_keys(options, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end", "def get_session( params )\n LastFM.get( \"auth.getSession\", params, :secure )\n end", "def session; @session; end", "def session; @session; end", "def session; @session; end", "def logged_in\n \n tokens = Token.where(user_id: User.current.id, action: 'session', value: params[:redmine_session]).select{|c| !c.expired? }\n is_logged_in = tokens.count > 0\n render json: is_logged_in\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end", "def session\n @req.session\n end", "def login\n user = User.last\n login!(user)\n ses = session[:session_token]\n render json: {\"ses\": ses}\n end", "def list_my_sessions(opts = {})\n data, _status_code, _headers = list_my_sessions_with_http_info(opts)\n data\n end", "def get_with_session_login(path, session)\n get path, nil, {\"rack.session\" => {\"uid\" => session['uid']}}\n end", "def current\n if current_user\n current_user.update!(last_login: Time.zone.now)\n render json: current_user\n else\n not_auth\n end\n end", "def get_session_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_session ...\"\n end\n # resource path\n local_var_path = \"/session\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20043')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def current_user_session\n @current_user_session ||= UserSession.find\n end", "def connected\n Rails.logger.debug \"Status#status session[:client] #{session[:client].inspect}\"\n render :json => (session[:client] != nil)\n end", "def cached_session_data\n Authentication::RedisStore.instance.json_get(auth_token)\n end", "def web_session()\n get(:signed, {:method => \"auth.getWebSession\"})\n end", "def current\n document = @db.max(\"session_cookies\", \"obtained_at\")\n SessionCookie.new(document) unless document.nil?\n end", "def sessions\n @@session_set ||= ActiveRecord::SessionStore::Session.all.select{|s| s.data.has_key?(\"user_credentials_id\")}\n @@session_set.select{|s| s.data[\"user_credentials_id\"] == self.id}\n end", "def current_client_id\n @session[@session_key]\n end", "def index\n @lift_sessions = LiftSession.all\n end", "def get_session(env, sid)\n raise '#get_session not implemented.'\n end", "def any_session!\n unless @session_token.present?\n _active_session = active_sessions(restricted: false, order: :updated_at.desc).first\n self.session_token = _active_session.session_token if _active_session.present?\n end\n @session_token\n end", "def current_user_session\n @current_user_session ||= UserSession.new(current_user_id)\n end", "def api_v11_users_sessions_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_users_sessions_get ...\"\n end\n \n # resource path\n path = \"/api/v11/users/sessions\".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 = []\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 = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_users_sessions_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def current_user_session\n return @current_user_session if defined?(@current_user_session)\n @current_user_session = UserSession.find\n end", "def current_user_session\n return @current_user_session if defined?(@current_user_session)\n @current_user_session = UserSession.find\n end", "def current_user_session\n return @current_user_session if defined?(@current_user_session)\n @current_user_session = UserSession.find\n end", "def show\n @intergroup_session = IntergroupSession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @intergroup_session }\n end\n end", "def session_last_open_tab\n res = session[:last_open_tab]\n respond_to do |format|\n format.html { render json: res }\n end\n end", "def session_last_open_tab\n res = session[:last_open_tab]\n respond_to do |format|\n format.html { render json: res }\n end\n end", "def current_id\n session[:user_id]\n end", "def show\n @session = Session.find(params[:id])\n redirect_to \"user/show\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end", "def index\n @sessions = Session.where(finalized: true).page(params[:page_id]).per(100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end", "def index\n @tutoring_sessions = TutoringSession.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutoring_sessions }\n end\n end", "def sessions\n PokerSession.find(:all)\n end" ]
[ "0.71596986", "0.7003878", "0.6940284", "0.67701787", "0.66829914", "0.66670275", "0.66628975", "0.66339076", "0.6611235", "0.6605251", "0.65850353", "0.65761393", "0.65448236", "0.65324587", "0.65189487", "0.65189487", "0.65189487", "0.65189487", "0.64848053", "0.64633274", "0.6462461", "0.6452233", "0.64504546", "0.64504546", "0.643392", "0.643103", "0.6365383", "0.6361347", "0.63486356", "0.6341399", "0.63382405", "0.63209444", "0.6309287", "0.6291028", "0.62541056", "0.62541056", "0.62447613", "0.62447613", "0.62247217", "0.62104636", "0.62029624", "0.6198663", "0.61647964", "0.61647964", "0.616262", "0.6151117", "0.61478615", "0.61478615", "0.612798", "0.61277336", "0.6126268", "0.61261135", "0.6125162", "0.6120032", "0.61188537", "0.6109363", "0.610596", "0.6098735", "0.60982835", "0.6086544", "0.60817623", "0.6081111", "0.60783714", "0.60783714", "0.60748637", "0.6072266", "0.606776", "0.606776", "0.606776", "0.60641885", "0.60627836", "0.6060032", "0.6049671", "0.60491663", "0.60273296", "0.60263616", "0.60227776", "0.6012249", "0.6001546", "0.60009336", "0.5988598", "0.5985075", "0.5979105", "0.59710044", "0.5969177", "0.5968279", "0.59617376", "0.5955798", "0.59549963", "0.59537715", "0.59537715", "0.59537715", "0.5952339", "0.59520304", "0.59520304", "0.595091", "0.59467363", "0.59391254", "0.59370154", "0.59342635" ]
0.75761646
0
POST /current_sessions POST /current_sessions.json
def create @current_session = CurrentSession.new(params[:current_session]) if @current_session.save render json: @current_session, status: :created, location: @current_session else render json: @current_session.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @session = SessionService.new(current_user).create_from_web! session_params\n\n respond_to do |format|\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render json: @session, status: :created }\n end\n end", "def start_session(nick)\n usr = User.first(:nickname=>params[:nickname])\n p User.all\n if usr != nil\n sid = gen_sessionid\n\n #associate nick with sid & IP & communication password\n $sessions[nick] = {:ip=>@env['REMOTE_ADDR'], :sid=> sid, :lastrequest=> Time.now.to_i}\n\n #return JSON with sessionid\n return {:sid => sid}\n end\n return 'error'\nend", "def create\n @session_resource = SessionResource.new(session_resource_params)\n\n if @session_resource.save\n render json: @session_resource, status: :created, location: @session_resource\n else\n render json: @session_resource.errors, status: :unprocessable_entity\n end\n end", "def post_params(path, params, session)\n post path, params, {\"rack.session\" => {\"uid\" => session['uid']}}\n end", "def active_sessions\n render json: Session.where(\"active = ?\", true)\n end", "def index\n active_sessions = []\n my_sessions = []\n history_sessions = []\n join_sessions = current_user.join_sessions\n Session.all.each { |session|\n if session.user_id == current_user.id\n my_sessions.push session_srz(session)\n elsif join_sessions.any? {|js| js.session_id == session.id} and session.close\n history_sessions.push session_srz(session)\n else\n active_sessions.push session_srz(session)\n end\n }\n\n\n json_object = {\n data: {\n active_sessions: active_sessions,\n my_sessions: my_sessions,\n history_sessions: history_sessions\n #history_sessions: current_user.join_sessions\n }\n }\n\n render json: json_object,\n status: :ok,\n include: %w(session.lock)#nil\n\n #ok_request render_json#, %w(user)\n end", "def generateSession\n sessionId = SecureRandom.base58(24)\n @test.update(session_id: sessionId)\n\n # set expiry date to 15 minutes from now\n @test.update(session_expired_at: Time.now + 15*60)\n\n render json: sessionId\n end", "def create_smite_api_session\n session_timestamp = Time.now.getutc.strftime(\"%Y%m%d%H%M%S\")\n session_string = \"#{ENV['SMITE_API_DEV_ID']}\" + 'createsession' + \"#{ENV['SMITE_API_AUTHKEY']}\" + session_timestamp\n session_signature = Digest::MD5.hexdigest(session_string)\n\n smite_session = RestClient.get(\"#{SMITE_PC_URL}/createsessionJson/#{ENV['SMITE_API_DEV_ID']}/#{session_signature}/#{session_timestamp}\")\n JSON.parse(smite_session)['session_id']\nend", "def create\n @session = Session.new(session_params)\n @session.created_by = current_user.id\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to game_session_path(@session), notice: 'Session was successfully created.' }\n format.json { render action: 'show', status: :created, location: @session }\n else\n format.html { render action: 'new' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def sessions=(value)\n @sessions = value\n end", "def create\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n reset_session\n session[:user_id] = @session.user.id\n format.html { redirect_to root_path, notice: 'Login success!' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_session\n session = Session.create!(key: Random.rand(0xFFFFFFFF).to_s)\n render json: { id: session.id, key: session.key }\n end", "def start_session\n generate_token(:token)\n setup_session\n update_last_session\n end", "def session\n @current_user = User.find_by_access_token(params[:access_token])\n \n # Fetch content for current user\n # find_friends_for_facebook_id(@current_user.facebook_id, since = nil)\n \n # return new friends\n # We want to send the entire friendslist hash of id, name to the client\n # friend_array = Friendship.find(:all, :select=>\"friend_id, friend_name\", :conditions=>\"user_id = #{@current_user.id}\").map {|f| {:friend_id=>f.friend_id.to_i, :friend_name=>f.friend_name}}\n # friend_id_array = friend_array.map do |f| f[:friend_id] end\n # \n # # The response should include the current user ID and name for the client to cache\n # session_response_hash = {\n # :access_token => @current_user.access_token,\n # :facebook_id => @current_user.facebook_id,\n # :name => @current_user.name,\n # :friends => friend_array\n # }\n \n session_response_hash = {\n :access_token => @current_user.access_token\n }\n\n respond_to do |format|\n format.xml { render :xml => session_response_hash.to_xml }\n format.json { render :json => session_response_hash.to_json }\n end\n end", "def create\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to @session }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_session\n session['token'] = @result['data']['token']\n current_user\n end", "def create\n @session = @event.sessions.new(params[:session])\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to [@event, @session], notice: 'Session was successfully created.' }\n format.json { render json: [@event, @session], status: :created, location: [@event, @session] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @current_session = CurrentSession.find(params[:id])\n\n if @current_session.update(params[:current_session])\n head :no_content\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end", "def sessions\n Thread.current[:sessions] ||= {}\n end", "def create\n if Rails.env == 'development'\n Rails.logger.debug \"Cookies:\\n\" + cookies.to_yaml\n Rails.logger.debug \"Session:\\n\" + session.to_yaml\n end\n \n @user_session = UserSession.new(params[:user_session])\n\n respond_to do |format|\n if @user_session.save\n @user_session.user.reset_appearance!\n \n # Make sure any stale forum logins are cleared\n cookies[\"Vanilla\"] = {:value => \"\", :domain => \".worlize.com\"}\n cookies[\"Vanilla-Volatile\"] = {:value => \"\", :domain => \".worlize.com\"}\n\n # default_url = enter_room_url(@user_session.user.worlds.first.rooms.first.guid)\n default_url = enter_room_url(Room.gate_room_guid)\n\n format.html { redirect_back_or_default(default_url) }\n format.json do\n render :json => {\n :success => true,\n :redirect_to => get_redirect_back_or_default_url(default_url)\n }\n end\n else\n format.html { render :action => \"new\" }\n format.json do\n render :json => {\n :success => false\n }\n end\n end\n end\n end", "def index\n @sessions = current_user.fitness_sessions\n end", "def session_api_key\n api_keys.active.session.create\n end", "def sessions\n Thread.current[:sessions] ||= {}\n end", "def session() request.session end", "def establish_session(request)\n #puts \"Request for: #{request.url} - running before...\"\n if ((session[:ip_address] != request.ip) or\n (session[:created_at] < (Time.now() - 60 * 20))) # Session older than 20 minutes?\n #puts \"This looks like a new user!\"\n session[:ip_address] = request.ip\n session[:created_at] = Time.now()\n user_id = DB[:users].insert(:ip_address => request.ip,\n :referrer => request.referrer,\n :created_at => session[:created_at])\n session[:user_id] = user_id\n redirect \"/survey/step/1\", 302\n end\nend", "def show\n @current_session = CurrentSession.find(params[:id])\n\n render json: @current_session\n end", "def session\n end", "def create\n # respond_to do |format|\n # if @user_session.save\n # format.html { redirect_to @user_session, notice: 'User session was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @user_session }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @user_session.errors, status: :unprocessable_entity }\n # end\n # end\n\n #binding.pry\n user = User.get_user(user_session_params[:username], user_session_params[:password])\n if user != nil\n session = UserSession.login(user)\n response = {\n html: '',\n json: { username: user.username, token: session.key, status: 200 }\n }\n end\n respond_to do |format|\n if user != nil\n cookies[:auth] = {\n value: response[:json],\n expires: 1.year.from_now\n }\n format.html { render text: response[:html] }\n format.json { render json: response[:json] }\n else\n format.html { render text: '', status: :unauthorized }\n format.json { render text: '', status: :unauthorized }\n end\n end\n\n\n end", "def create\n @ykt_session = YktSession.new(params[:ykt_session])\n\n respond_to do |format|\n if @ykt_session.save\n format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully created.' }\n format.json { render json: @ykt_session, status: :created, location: @ykt_session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ykt_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n session = Session.new\n session.name = params[:name]\n session.description = params[:description]\n session.start_time = params[:date]\n # TODO: need date\n # TODO: need topic\n session.active = true;\n # add ot_session.id\n ot_session = @@opentok.create_session({media_mode: :routed})\n session.session_id = ot_session.session_id\n # try and save the session\n saved = session.save\n # add moderators\n params[:moderators].each do |moderator|\n SessionUser.create(session_id: session.id, user_id: moderator[:id], role: 'moderator', center_stage: true)\n end\n # add subscribers\n params[:subscribers].each do |subscriber|\n puts subscriber\n SessionUser.create(session_id: session.id, user_id: subscriber[:id], role: 'publisher', center_stage: false)\n end\n if saved\n render json: {message: \"Event: #{session.name} successfully added\"}, status: 200\n else\n render json: {errors: session.errors.to_json}, status: 500\n end\n end", "def store_session(res)\n res.set_cookie('_req_room_session', path: '/', value: data.to_json)\n end", "def create value=nil\n # TODO: only certain keys are recognised in a session create request,\n # should raise an error on others.\n raw = @conn.put do |req|\n req.url \"/v1/session/create\"\n req.body = (if value.kind_of?(String) then value else JSON.generate(value) end) unless value.nil?\n end\n body = JSON.parse(raw.body)\n return body[\"ID\"]\n end", "def log_session\n return render_error(404, \"must include a user id\") unless params[:id]\n sessions_platform = params[:platform] || \"web\"\n if User.find(params[:id]) == current_user\n\n # Go get any new videos from facebook explicity\n facebook_auth = current_user.authentications.select { |a| a.provider == 'facebook' }.first\n GT::PredatorManager.update_video_processing(current_user, facebook_auth) if facebook_auth\n\n case sessions_platform\n when \"ios\"\n current_user.increment(:ios_session_count => 1)\n when \"web\"\n current_user.increment(:session_count => 1)\n ShelbyGT_EM.next_tick {\n StatsManager::GoogleAnalytics.track_nth_session(current_user, 1)\n StatsManager::GoogleAnalytics.track_nth_session(current_user, 3)\n StatsManager::GoogleAnalytics.track_nth_session(current_user, 6)\n StatsManager::GoogleAnalytics.track_nth_session(current_user, 10)\n }\n else\n return render_error(404, \"invalid platform. only ios and web supported.\")\n end\n @status = 200\n else\n render_error(404, \"could not update the current users session\")\n end\n end", "def create\n @client = current_client\n @session = @client.session\n debug { \"SessionsController#create - #{@session.inspect}\"}\n raise \"ResourceOwner from token != session.owner\" if doorkeeper_token.resource_owner_id != @session.owner.id\n\n @client.update_attributes!(client_params)\n render json: @client, status: :created, serializer: Sso::ClientSerializer\n end", "def current_session(env=Thread.current[:env])\n return nil unless env\n setup_env(env)\n key = session['user_credentials']\n if @sessions[key]\n @refresh_sessions[key] = true\n else\n @session_mutex.synchronize do\n unless @previous_sessions[key]\n oldkey = key\n s = find_session\n key = session['user_credentials']\n @previous_sessions[oldkey] = key\n @sessions[key] = s\n @refresh_sessions[key] = true\n Thread.new do\n sleep Config::PreviousSessionTimeout\n @previous_sessions.delete(oldkey)\n end\n Thread.new do\n while @refresh_sessions[key] do\n @refresh_sessions.delete(key)\n sleep Config::SessionTimeout\n end\n @sessions.delete(key)\n end\n params['_need_cookie_update'] = true if full_path == '/ajax/poll'\n else\n key = @previous_sessions[key]\n end\n end\n end\n @sessions[key]\n end", "def session_enduser\n session[:enduser] = params[:enduser]\n\n respond_to do |format|\n format.json { head :ok }\n end\n end", "def create\n @session = ::Session.authenticate(session_params)\n\n if @session.save\n render :show, status: :created, location: @session\n else\n render json: @session.errors, status: :unprocessable_entity\n end\n end", "def new\n @tutoring_session = TutoringSession.new\n #@tutoring_session = TutoringSession.new\n @tutoring_session.user_id = current_user.id if !current_user.nil?\n @tutoring_session.start_time = Time.now\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutoring_session }\n end\n end", "def session\n @req.session\n end", "def session ; request.session ; end", "def create\n return if Settings.readonly \n\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to sessions_url, notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @session = Session.new(params[:session])\n @session.start=Time.now\n @session.cabin.vacant=false\n @session.cabin.save\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render json: @session, status: :created, location: @session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_session = UserSession.new(params[:user_session])\n\n respond_to do |format|\n if @user_session.save\n format.html { redirect_to(:home, :notice => 'Login successful.') }\n format.json { render :json => @user_session, :status => :created, :location => @user_session }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user_session.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @session = Session.new(params[:session].merge(conference: active_conference))\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render json: @session, status: :created, location: @session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def current\n current_user.update!(last_login: Time.now)\n render json: current_user\n end", "def current\n current_user.update!(last_login: Time.now)\n render json: current_user\n end", "def create\n \n # remove any existing session of this user\n # TODO: update custom validations in model to work with this\n @session = Session.where(\"sender_id = #{session_params[:sender_id]} OR recipient_id = #{session_params[:sender_id]}\").first\n @session.destroy if @session\n \n @session = Session.new(session_params)\n \n if @session.valid?\n @session.session_id = Session.createSession(request.remote_addr).to_s\n @session.sender_token = Session.generateToken(@session.session_id, @session.sender.id.to_s)\n @session.recipient_token = Session.generateToken(@session.session_id, @session.recipient.id.to_s)\n end\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render action: 'show', status: :created, location: @session }\n else\n format.html { render action: 'new' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def start_session\n render json: @student, serializer: StudentSerializerSession\n end", "def new\n @session = Session.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session }\n end\n end", "def set_auth_sessions(data)\n session[:authentication_token] = data[\"data\"][\"token\"][\"access_token\"]\n session[:refresh_token] = data[\"data\"][\"token\"][\"refresh_token\"]\n session[:expires_at] = DateTime.now + data[\"data\"][\"token\"][\"expires_in\"].to_i.seconds\n end", "def new_session(options={})\n if supports_sessions?\n api.rest_method('ADD_AUTHORIZATION', {\n :scope => 'session',\n :note => \"RHC/#{RHC::VERSION::STRING} (from #{Socket.gethostname rescue 'unknown'} on #{RUBY_PLATFORM})\",\n :reuse => true\n }, options)\n end\n end", "def login\n old_controller = @controller\n @controller = SessionsController.new\n    post :create, session: {email: '[email protected]', password: 'qwerty'}\n @controller = old_controller\n\n return session[:session_token]\n end", "def create_session_with_http_info(start, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.create_session ...\"\n end\n # verify the required parameter 'start' is set\n fail ArgumentError, \"Missing the required parameter 'start' when calling SessionApi.create_session\" if start.nil?\n # resource path\n local_var_path = \"/session/add\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'start'] = start\n query_params[:'boat_id'] = opts[:'boat_id'] if !opts[:'boat_id'].nil?\n query_params[:'trip_id'] = opts[:'trip_id'] if !opts[:'trip_id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20043')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#create_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def store_session(res)\n end", "def total_sessions(options = {})\n request_model = @request_model_factory.total_sessions_request_model(options)\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body)['sessions']\n end", "def create\n @session_login = current_user.session_logins.build(session_login_params)\n respond_to do |format|\n if @session_login.save\n format.html { redirect_to @session_login, notice: \"Session login was successfully created.\" }\n format.json { render :show, status: :created, location: @session_login }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @session_login.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @session_resources = SessionResource.all\n\n render json: @session_resources\n end", "def save_session(session)\n \n end", "def create\n reset_session\n params[:user] ||= {}\n username = params[:user][:username].to_s\n password = params[:user][:password].to_s\n user = User.where('username = ? and crypted_password = ?', username, User.encrypt(password)).first\n\n params[:client_uid] = 'Web Platform' if request.format.html?\n \n if user && params[:client_uid]\n session_obj = Session.create(user_id:user.id, client_uid:params[:client_uid])\n session[:app_session_id] = session_obj.id\n session[:user_id] = user.id\n\n if request.format.html?\n redirect_to controller: 'main'\n elsif request.format.json?\n render json: {success: true, session: session_obj.to_json}\n end\n else\n if request.format.html?\n flash[:alert] = \"Cannot login, please try again\"\n render action: 'new'\n elsif request.format.json?\n render json: {success: false, message: 'Cannot login, please try again'}\n end\n end\n end", "def to_session_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.to_session ...'\n end\n # resource path\n local_var_path = '/api/kratos/public/sessions/whoami'\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 header_params[:'X-Session-Token'] = opts[:'x_session_token'] if !opts[:'x_session_token'].nil?\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] || 'Session'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['sessionCookie']\n\n new_options = opts.merge(\n :operation => :\"DefaultApi.to_session\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#to_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def current\n session[:user_id] = params[:user_id]\n response_data = {\n status: 'success',\n currentUser: current_user,\n }\n render json: response_data, status: :ok\n end", "def get_today_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_today_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/today\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20045')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_today_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @workout_sessions = WorkoutSession.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workout_sessions }\n end\n end", "def save_session\n\t\tsession[:todos] = @todos.all_todos.to_json\n\tend", "def sessions\n @sessions\n end", "def session_get\n nessus_rest_get(\"session\")\n end", "def create\n @session = FitnessSession.create(session_params)\n if @session.type_session_id == 1\n CyclingSession.create(:fitness_session_id =>@session.id)\n elsif @session.type_session_id == 2\n WeightLiftingSession.create(:fitness_session_id =>@session.id)\n else\n JoggingSession.create(:fitness_session_id =>@session.id)\n end\n\n #respond_to do |format|\n if @session.save\n redirect_to '/fitness_sessions/',notice: \"\"\n #format.html { redirect_to @session, notice: 'Session was successfully created.' }\n #format.json { render :show, status: :created, location: @session }\n else\n #format.html { render :new }\n redirect_to '/fitness_sessions/',notice: \"\"\n #format.json { render json: @session.errors, status: :unprocessable_entity }\n #end\n end\n end", "def create\n @session = Session.new(session_params)\n authorize @session\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def login\n user = User.last\n login!(user)\n ses = session[:session_token]\n render json: {\"ses\": ses}\n end", "def index\n @sessions = @event.sessions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end", "def logged_in\n \n tokens = Token.where(user_id: User.current.id, action: 'session', value: params[:redmine_session]).select{|c| !c.expired? }\n is_logged_in = tokens.count > 0\n render json: is_logged_in\n end", "def new\r\n @session = Session.new\r\n @session.state = 'waiting'\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @session }\r\n format.json { render :json => @session }\r\n end\r\n end", "def create\n @trainings_session = TrainingsSession.new(params[:trainings_session])\n\t\t@trainings_session.owner = current_user if current_user\n\t\t@my_exercises = Exercise.liked_by(current_user.id).published\n\t\t\t.concat(Exercise.owned_by(current_user.id).published)\n\t\t\t.concat(Exercise.owned_by(current_user.id).unpublished)\n\n respond_to do |format|\n if @trainings_session.save\n format.html { redirect_to my_sessions_path, notice: 'Trainings session was successfully created.' }\n format.json { render json: @trainings_session, status: :created, location: @trainings_session }\n\t\t\t\tformat.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @trainings_session.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js { render action: \"new\"}\n end\n end\n end", "def create\n @user_session = UserSession.new(params[:user_session])\n\n if @user_session.save\n respond_to do |format|\n format.html { redirect_back_or }\n format.json { render json: @user_session, status: :created, location: @user_session }\n end \n else\n render :layout => false\n end\n \n end", "def index\n @sessions = Session.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end", "def create\n @session_info = SessionInfo.new(params[:session_info])\n\n respond_to do |format|\n if @session_info.save\n format.html { redirect_to session_information_path, notice: 'Session Info was successfully set up!' }\n format.json { render json: @session_info, status: :created, location: @session_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @session_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n me=User.find(user.id)\n me.loggedin=true\n me.tutoring=false\n me.request=Request.new(class_name:\"3365f80a5cccb3e76443df3b736b26e8\")\n me.save\n render erb: :'sessions#create'\nend", "def on_new_session(session)\n self.session_count += 1\n self.successful = true\n end", "def list_my_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FrontendApi.list_my_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling FrontendApi.list_my_sessions, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling FrontendApi.list_my_sessions, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling FrontendApi.list_my_sessions, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/sessions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-Session-Token'] = opts[:'x_session_token'] if !opts[:'x_session_token'].nil?\n header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil?\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] || 'Array<Session>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FrontendApi.list_my_sessions\",\n :header_params => 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: FrontendApi#list_my_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def session; end", "def session; end", "def session; end", "def session; end", "def store_session(res)\n res.set_cookie(@cookie.to_json)\n debugger\n end", "def refresh\n @session = ::Session.new(user: current_user)\n\n if @session.save\n current_session.destroy\n render :show, status: :created, location: @session\n else\n render json: @session.errors, status: :unprocessable_entity\n end\n end", "def check_session\n data = { :account => Encryptor.encrypt({:id => id, :phone => phone, :password => password}.to_json, :key => $secret_key) }\n\n response = RestClient.post \"#{$service_url}/api/account/check_session\", data, { :content_type => :json, :accept => :json }\n\n JSON.parse(response)\n rescue => error\n { :session => false }\n end", "def new\n @session = Session.new\n\n respond_to do |format|\n format.json { render json: @session }\n format.html # new.html.erb\n end\n end", "def create\n @user_session = UserSession.new(params[:user_session])\n\n respond_to do |format|\n if @user_session.save\n format.html { redirect_to :back, :notice => \"You have successfully logged in\" }\n format.json { render json: @user_session, status: :created, location: @user_session }\n else\n format.html { redirect_to :back, :error => \"Your email or password is incorrect\" }\n format.json { render json: @user_session.errors, status: :unauthorized }\n end\n end\n end", "def write_session(env, sid, session, options); end", "def create_session(token, params={})\n params.merge!('token' => token)\n params.merge!(params) { |k,v| v.to_s } # custom parameters must be strings\n response = post(PLURAL_PATH, params)\n response.id = response.id.strip if response.id\n response\n end", "def create\n @session = Session.new(session_params)\n\n newYear = session_params[\"sessionDate(1i)\"]; # year\n newMonth = session_params[\"sessionDate(2i)\"]; # month\n newDay = session_params[\"sessionDate(3i)\"]; # day\n newHour = session_params[\"sessionDate(4i)\"]; # hour\n newMin = session_params[\"sessionDate(5i)\"]; # minute\n sessionLen = session_params[\"sessionLength\"]; # session length\n sessionLen = (sessionLen.to_i + 15)/60; # 15 minute break between sessions\n \n newDate = Time.new(newYear, newMonth, newDay, newHour, newMin);\n \n #temporarily hardcoding open/close times. \n openHour = Time.new(newYear, newMonth, newDay, 9, 0);\n closeHour = Time.new(newYear, newMonth, newDay, 21, 0);\n \n #temporarily hardcoding lunch hours\n lunchHour = Time.new(newYear, newMonth, newDay, 12, 0);\n \n validSessionTime = isValidSessionTime(newDate, openHour, closeHour, lunchHour, sessionLen)\n \n respond_to do |format|\n if validSessionTime\n format.html { render :new }\n flash[:alert] = \"Session unavailable at that time.\"\n else\n if @session.save\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def test_checking_complete_session_data\n\n post '/save-values', :value1 => '1', :value2 => '2', :value3 => '3'\n token_json = JSON.parse(last_response.body)\n prev_id = token_json['id']\n\n get '/complete-session-data'\n token_json2 = JSON.parse(last_response.body)\n next_id = JSON.parse(token_json2[0])['_id']\n\n assert_equal prev_id, next_id\n end", "def create_session(channel_id, options={})\n match = post_json(\"sessions\", options.merge(\n :channel_id => channel_id.to_s\n ))[:body].match(%r{/sessions/([^/]+)})\n match[1] if match\n end", "def session\n last_request.env[\"rack.session\"]\n end", "def get_session(options = {})\n resp = @connection.post do |req|\n req.headers = { :Accept => 'application/json'}\n req.url 'v1/sessions'\n req.body = options.to_json\n end\n check_response_for_errors resp.body\n end", "def start_session\n self.update_attributes(session_expires_in: 30.days.from_now)\n end", "def set_current_choices\n TransientSessionInfo[session.id] = JSON.parse(params['current_choices']) if params['current_choices']\n TransientSessionInfo[session.id] = JSON.parse(flash['current_choices']) if flash['current_choices'] && params['current_choices'].nil?\n end", "def show\r\n @session = Session.find(params[:id])\r\n\r\n if((@session.state == \"won\") && (@session.updated_at.to_i + 3 < Time.now.to_i))\r\n @session.state = \"nextQuestion\"\r\n @session.save\r\n end\r\n\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @session }\r\n #format.json { render :json => @session }\r\n format.json { render_for_api :in_progress_session, :json => @session, :root => :session }\r\n\t\t\r\n end\r\n end", "def update_session\n auth = Knock::AuthToken.new(payload: to_token_payload)\n auth.token\n end", "def submitSessionInfos\n # check if data submission is offline\n is_offline_sensor_data_collection = false\n\n # not having valid device id or device type. \n if params.has_key?(:uid) == true && !params[:uid].empty?\n @deviceType = nil\n if (\n params.has_key?(:did) == false || params[:did].empty? || \n params.has_key?(:dtype) == false || params[:dtype].empty? ||\n (@deviceType = DeviceType.where(name: params[:dtype]).first) == nil || \n params.has_key?(:experiment_id) == false || params[:experiment_id].empty? ||\n (@experiment = UteExperiment.where(:experiment_code => params[:experiment_id], :is_active => true).first) == nil\n ) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n if (\n params.has_key?(:sensor_infos) == false || params[:sensor_infos].empty? || \n params[:sensor_infos].kind_of?(Array) == false || params[:sensor_infos].count == 0\n )\n render json: { 'status' => 'OK' }.to_json\n end\n\n # check device pairing. \n @deviceId = params[:did]\n if isPairedDeviceValid(@deviceId, params[:uid]) == false\n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n needToCreateSession = false\n if params.has_key?(:is_initiator) && params[:is_initiator] == true\n needToCreateSession = true\n else\n # check if devicepairconnotp is not expired yet\n @devicepairconnections = @devicepairs.ute_device_pair_connections.where(\n :expire_by.gte => Time.now.getutc.to_f, \n :is_active => true\n )\n firststartdate = params[:sensor_infos][0][:t]\n @devicepairconnections.each do |devicepairconnection|\n si = devicepairconnection.ute_ex_session\n unless si.nil?\n if firststartdate > si.range_start_at && firststartdate < si.range_end_at \n #found the paired connection\n @devicepairconnection = devicepairconnection\n @session = @devicepairconnection.ute_ex_session\n break\n end\n end\n end\n\n if @devicepairconnection == nil && @session == nil \n #session to pair is not found\n render json: { 'status' => 'FAILED', 'code' => 404 }.to_json\n return\n end\n end\n\n if needToCreateSession \n # create new session\n @sessionId = generateNewSessionId\n\n while isSessionIdAlreadyExist(@experiment.experiment_code, @sessionId) do\n @sessionId = generateNewSessionId\n end\n\n @session = @experiment.ute_ex_sessions.create!(\n session_code: @sessionId,\n is_active: true,\n initiated_by_device_id: @deviceId,\n is_created_offline: true\n )\n end\n\n if @session\n @sessionConnection = @session.ute_ex_session_connections.create!(device_id: @deviceId, device_model: params[\"model\"], device_type: @deviceType.id, is_active: true, connected_at: params[:sensor_infos][0][:t])\n \n @devicepairconnotp = generateNewDevicePairConnOtp\n\n while isActiveDevicePairConnOtpAlreadyExist(@devicepairs, @devicepairconnotp) do\n @devicepairconnotp = generateNewDevicePairConnOtp\n end\n\n dpc = @devicepairs.ute_device_pair_connections.new(\n is_active: true,\n otp: @devicepairconnotp,\n expire_by: Time.now.getutc.to_f + OTP_DEVICE_PAIR_CONN_LIFETIME, \n ute_ex_session: @session\n )\n dpc.save! \n\n @session.ute_device_pair_connection = dpc\n @session.save!\n\n is_offline_sensor_data_collection = true\n end\n end \n\n if isDataSubmissionInvalidForExpAndSession(request, params) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n begin\n if params.has_key?(:sensor_infos) && params[:sensor_infos].empty? == false\n UteDataSubmissionService.delay.handlesensorinfos(@session, @sessionConnection, params)\n end\n rescue => e\n puts(e.message)\n raise 'an error has occured'\n #puts(e.backtrace.join(\"\\n\"))\n end\n\n #begin\n # if params.has_key?(:sensor_infos) && params[:sensor_infos].empty? == false\n # puts('receiving first item: ' + params[:sensor_infos][0][:t].to_s)\n # end\n #rescue => e\n # puts('TRY TO RESCUE')\n #\n # puts(e.message)\n # raise 'an error has occured'\n # #puts(e.backtrace.join(\"\\n\"))\n #end\n\n if @devicepairconnection != nil && is_offline_sensor_data_collection \n #otp needs to be renewed\n @devicepairconnection.update_attributes(\n expire_by: Time.now.getutc.to_f + OTP_DEVICE_PAIR_CONN_LIFETIME\n )\n end \n \n if is_offline_sensor_data_collection\n render json: { 'status' => 'OK', 'otp' => @devicepairconnotp, 'session_id' => @session.session_code }.to_json\n else\n render json: { 'status' => 'OK' }.to_json\n end\n end" ]
[ "0.62603176", "0.6230183", "0.6180256", "0.6149209", "0.61460674", "0.61383927", "0.6127799", "0.6124924", "0.6105057", "0.60965884", "0.5979226", "0.5959011", "0.5946521", "0.5939322", "0.5934287", "0.5908267", "0.5896295", "0.5876511", "0.5853818", "0.5848023", "0.5841254", "0.5839899", "0.5836133", "0.58250904", "0.58187467", "0.58110744", "0.5798599", "0.57932526", "0.57879126", "0.5779111", "0.57723767", "0.57640696", "0.5759418", "0.57527894", "0.57414496", "0.5723143", "0.57114017", "0.57107574", "0.5708172", "0.5708022", "0.5702076", "0.5688095", "0.56700295", "0.5668375", "0.565812", "0.565812", "0.56576306", "0.5646064", "0.5644249", "0.5643257", "0.56404364", "0.56388646", "0.56381077", "0.56342363", "0.56339276", "0.563161", "0.562999", "0.5625978", "0.56134105", "0.5612973", "0.5612577", "0.561182", "0.5609412", "0.5607043", "0.5603574", "0.5600699", "0.55905855", "0.5589921", "0.55861306", "0.55844665", "0.55740523", "0.55690986", "0.5564118", "0.5561921", "0.5552148", "0.55510414", "0.5549225", "0.55463356", "0.55445904", "0.55438095", "0.55438095", "0.55438095", "0.55438095", "0.5540884", "0.5540244", "0.5539591", "0.5520973", "0.5520052", "0.55133986", "0.55088097", "0.55045724", "0.5493872", "0.5488986", "0.548776", "0.54858714", "0.54737633", "0.5463364", "0.54573476", "0.5455219", "0.5452048" ]
0.748424
0
PATCH/PUT /current_sessions/1 PATCH/PUT /current_sessions/1.json
def update @current_session = CurrentSession.find(params[:id]) if @current_session.update(params[:current_session]) head :no_content else render json: @current_session.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update\n @session_resource = SessionResource.find(params[:id])\n\n if @session_resource.update(session_resource_params)\n head :no_content\n else\n render json: @session_resource.errors, status: :unprocessable_entity\n end\n end", "def update\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @session = Session.find(params[:id])\r\n\r\n\r\n json = ActiveSupport::JSON.decode(request.raw_post)\r\n logger.debug json\r\n\r\n #@session.pla\r\n\r\n #json = ActiveSupport::JSON.decode(request.raw_post)\r\n #@session.state = json['state']\r\n\r\n respond_to do |format|\r\n if @session.save\r\n format.html { redirect_to(@session, :notice => 'Session was successfully updated.') }\r\n format.xml { head :ok }\r\n format.json { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\r\n format.json { render :json => @session.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @session = Session.find_by_id(params[:id])\n\n if @session.nil?\n render json: {message: \"404 Not Found\"}, status: :not_found\n else\n @session.update(session_params)\n end\n end", "def update\n authorize @session\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ykt_session = YktSession.find(params[:id])\n\n respond_to do |format|\n if @ykt_session.update_attributes(params[:ykt_session])\n format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ykt_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session_info = SessionInfo.first\n\n respond_to do |format|\n if @session_info.update_attributes(params[:session_info])\n format.html { redirect_to session_information_path, notice: 'Session Info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to game_session_path(@session), notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @session_operation.update(session_operation_params)\n format.html { redirect_to @session_operation, notice: 'Session operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session_operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @yoga_session = YogaSession.find(params[:id])\n\n respond_to do |format|\n if @yoga_session.update_attributes(params[:yoga_session])\n format.html { redirect_to @yoga_session, notice: 'Yoga session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @yoga_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_session.update(user_session_params)\n format.html { redirect_to @user_session, notice: 'User session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sevone_session.update(sevone_session_params)\n format.html { redirect_to @sevone_session, notice: 'Sevone session was successfully updated.' }\n format.json { render :show, status: :ok, location: @sevone_session }\n else\n format.html { render :edit }\n format.json { render json: @sevone_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @otg_sess.update(otg_sess_params)\n format.html { redirect_to @otg_sess, notice: 'Otg sess was successfully updated.' }\n format.json { render :show, status: :ok, location: @otg_sess }\n else\n format.html { render :edit }\n format.json { render json: @otg_sess.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session = Session.find(params[:id])\n authorize @session\n @session.update(session_params)\n redirect_to trainings_path\n end", "def update\n @polling_session = PollingSession.find(params[:id])\n\n respond_to do |format|\n if @polling_session.update_attributes(params[:polling_session])\n format.html { redirect_to @polling_session, notice: 'Polling session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @polling_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lift_session.update(lift_session_params)\n format.html { redirect_to @lift_session, notice: 'Lift session was successfully updated.' }\n format.json { render :show, status: :ok, location: @lift_session }\n else\n format.html { render :edit }\n format.json { render json: @lift_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n return if Settings.readonly \n\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to sessions_url, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @exercise_session.update(exercise_session_params)\n format.html { redirect_to @exercise_session, notice: 'Exercise session was successfully updated.' }\n format.json { render :show, status: :ok, location: @exercise_session }\n else\n format.html { render :edit }\n format.json { render json: @exercise_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ergo_session.update(ergo_session_params)\n format.html { redirect_to @ergo_session, notice: 'Ergo session was successfully updated.' }\n format.json { render :show, status: :ok, location: @ergo_session }\n else\n format.html { render :edit }\n format.json { render json: @ergo_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_session.update(session_params)\n format.html { redirect_to @admin_session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_session }\n else\n format.html { render :edit }\n format.json { render json: @admin_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n flash[:notice] = 'Session was successfully updated.'\n format.html { \n if @session.course\n redirect_to(admin_course_session_path(@session.course, @session))\n else\n redirect_to(admin_session_path(@session))\n end\n }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @sessions = SessionEvent.find(params[:id])\n if @sessions.update_attributes(session_event_params)\n flash[:success] = \"Your session has been updated\"\n redirect_to @sessions\n end\n respond_to do |format|\n if @session_event.update(session_event_params)\n format.html { redirect_to @session_event, notice: 'Session event was successfully updated.' }\n format.json { render :show, status: :ok, location: @session_event }\n else\n format.html { render :edit }\n format.json { render json: @session_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @session_time.update(session_time_params)\n format.html { redirect_to @session_time, notice: 'Session time was successfully updated.' }\n format.json { render :show, status: :ok, location: @session_time }\n else\n format.html { render :edit }\n format.json { render json: @session_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @session_login.update(session_login_params)\n format.html { redirect_to @session_login, notice: \"Session login was successfully updated.\" }\n format.json { render :show, status: :ok, location: @session_login }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @session_login.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n @current_user.update(user_params)\n render json: @current_user\n end", "def update\n java_session = @java_request.getSession(true)\n hash = @session_data.dup\n hash.delete_if do |k,v|\n if String === k\n case v\n when String, Numeric, true, false, nil\n java_session.setAttribute k, v\n true\n else\n if v.respond_to?(:java_object)\n java_session.setAttribute k, v\n true\n else\n false\n end\n end\n end\n end\n unless hash.empty?\n marshalled_string = Marshal.dump(hash)\n marshalled_bytes = marshalled_string.to_java_bytes\n java_session.setAttribute(RAILS_SESSION_KEY, marshalled_bytes)\n end\n end", "def update\n if @session\n @session.update_session(marshalize(@data))\n end\n end", "def update\n params[:trainingsession][:existing_interval_attributes] ||= {}\n @trainingsession = Trainingsession.find(params[:id])\n\n respond_to do |format|\n if @trainingsession.update_attributes(params[:trainingsession])\n flash[:notice] = 'Trainingsession was successfully updated.'\n format.html { redirect_to(@trainingsession) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trainingsession.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @session_info = args[:session_info] if args.key?(:session_info)\n end", "def update\n respond_to do |format|\n if @session_note.update(session_note_params)\n format.html { redirect_to @session_note, notice: 'Session note was successfully updated.' }\n format.json { render :show, status: :ok, location: @session_note }\n else\n format.html { render :edit }\n format.json { render json: @session_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @training_session = TrainingSession.find(params[:id])\n\n respond_to do |format|\n if @training_session.update_attributes(params[:training_session])\n format.html { redirect_to @training_session, notice: 'Training session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @training_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_single_poll_session(poll_id,id,poll_sessions__course_id__,poll_sessions__course_section_id__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"id is required\" if id.nil?\n raise \"poll_sessions__course_id__ is required\" if poll_sessions__course_id__.nil?\n raise \"poll_sessions__course_section_id__ is required\" if poll_sessions__course_section_id__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :id => id,\n :poll_sessions__course_id__ => poll_sessions__course_id__,\n :poll_sessions__course_section_id__ => poll_sessions__course_section_id__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions/{id}\",\n :poll_id => poll_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end", "def update\n return unless restrict_to_hosts\n\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: [@event, @session] }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_session = UserSession.find(params[:id])\n\n respond_to do |format|\n if @user_session.update_attributes(params[:user_session])\n format.html { redirect_to(:controller=>'users', :action=>'edit') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_session.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tsession.update(tsession_params)\n format.html { redirect_to @tsession, notice: 'Tsession was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tsession.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interview_session = InterviewSession.find(params[:id])\n\n respond_to do |format|\n if @interview_session.update_attributes(params[:interview_session])\n format.html { redirect_to(@interview_session, :notice => 'Interview session was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interview_session.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @sessions = args[:sessions] if args.key?(:sessions)\n end", "def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\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 @tutoring_session = TutoringSession.find(params[:id])\n\n respond_to do |format|\n if @tutoring_session.update_attributes(params[:tutoring_session])\n format.html { redirect_to @tutoring_session, notice: 'Tutoring session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutoring_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_session_with_http_info(id, start, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.edit_session ...\"\n end\n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling SessionApi.edit_session\" if id.nil?\n # verify the required parameter 'start' is set\n fail ArgumentError, \"Missing the required parameter 'start' when calling SessionApi.edit_session\" if start.nil?\n # resource path\n local_var_path = \"/session/edit\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\n query_params[:'start'] = start\n query_params[:'boat_id'] = opts[:'boat_id'] if !opts[:'boat_id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20044')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#edit_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @worksession.update(worksession_params)\n format.html { redirect_to worksessions_path(current_user.id), notice: 'Worksession was successfully updated.' }\n format.json { render :show, status: :ok, location: @worksession }\n else\n format.html { render :edit }\n format.json { render json: @worksession.errors, status: :unprocessable_entity }\n end\n end\n end", "def _session_update sid = \"\", uid = 0\n\t\tds = DB[:_sess].filter(:sid => sid, :uid => uid.to_i)\n\t\tds.update(:changed => Time.now) if ds.count > 0\n\tend", "def update\n respond_to do |format|\n if @sessao.update(sessao_params)\n format.html { redirect_to @sessao, notice: \"Sessao was successfully updated.\" }\n format.json { render :show, status: :ok, location: @sessao }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @sessao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sessao.update(sessao_params)\n format.html { redirect_to @sessao, notice: 'Sessao was successfully updated.' }\n format.json { render :show, status: :ok, location: @sessao }\n else\n format.html { render :edit }\n format.json { render json: @sessao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @training_session.update(training_session_params)\n format.html { redirect_to @training_session, notice: 'Training session was successfully updated.' }\n format.json { render :show, status: :ok, location: @training_session }\n else\n format.html { render :edit }\n format.json { render json: @training_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @session_type = SessionType.find(params[:id])\n\n respond_to do |format|\n if @session_type.update_attributes(params[:session_type])\n format.html { redirect_to @session_type, notice: 'Session type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n raw_attributes = JSON.parse(params[:cash]).with_indifferent_access\n attributes = { cash_id: raw_attributes[:cashRegisterId] }\n attributes[:started_at] = Time.zone.at(raw_attributes[:openDate])\n attributes[:stopped_at] = Time.zone.at(raw_attributes[:closeDate])\n attributes[:noticed_start_amount] = raw_attributes[:openCash]\n attributes[:noticed_stop_amount] = raw_attributes[:stopCash]\n attributes[:expected_stop_amount] = raw_attributes[:expectedCash]\n if raw_attributes[:id] && @record = CashSession.find_by(id: raw_attributes[:id])\n @record.update_attributes!(attributes)\n elsif cash = Cash.find_by(id: attributes[:cash_id])\n @record = cash.sessions.create!(attributes)\n else\n render json: { status: :rej, content: 'Cannot update cash' }\n return\n end\n render locals: { resource: @record }\n end", "def reset_session_clock\n render json: { status: 'ok' }\n end", "def update\n respond_to do |format|\n if @csession.update(csession_params)\n format.html { redirect_to @csession, notice: 'Csession was successfully updated.' }\n format.json { render :show, status: :ok, location: @csession }\n else\n format.html { render :edit }\n format.json { render json: @csession.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bohconf_session = BohconfSession.find(params[:id])\n params[:bohconf_session][:starts_at] = params[:bohconf_session][:starts_at].to_time\n params[:bohconf_session][:ends_at] = params[:bohconf_session][:ends_at].to_time\n if @bohconf_session.update_attributes(session_params)\n redirect_to bohconf_path, notice: 'Session was successfully updated.'\n end\n end", "def update\n respond_to do |format|\n if @game_session.update(game_session_params)\n format.html { redirect_to @game_session, notice: 'Game session was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_session }\n else\n format.html { render :edit }\n format.json { render json: @game_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @study_session = StudySession.find(params[:study_session])\n\n respond_to do |format|\n if @study_session.update_attributes(params[:study_session])\n format.html { redirect_to [@study_session.course, @study_session], notice: 'Study session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @study_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customersession.update(customersession_params)\n format.html { redirect_to @customersession, notice: 'Customersession was successfully updated.' }\n format.json { render :show, status: :ok, location: @customersession }\n else\n format.html { render :edit }\n format.json { render json: @customersession.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user_token\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).update(last_used_at: Time.zone.now)\n end\n end", "def current\n current_user.update!(last_login: Time.now)\n render json: current_user\n end", "def current\n current_user.update!(last_login: Time.now)\n render json: current_user\n end", "def update\n respond_to do |format|\n if @session_replica.update(session_replica_params)\n format.html { redirect_to @session_replica}\n format.json { render :show, status: :ok, location: @session_replica }\n else\n format.html { render :edit }\n format.json { render json: @session_replica.errors, status: :unprocessable_entity }\n end\n end\n end", "def sessions=(value)\n @sessions = value\n end", "def update_session(data)\n update_attribute('data', data) \n end", "def update_session(data)\n connection = self.class.session_connection\n if @id\n # if @id is not nil, this is a session already stored in the database\n # update the relevant field using @id as key\n if SmartSession::SqlSession.locking_enabled?\n self.class.query(\"UPDATE #{SmartSession::SqlSession.table_name} SET `updated_at`=NOW(), `data`=#{self.class.quote(data)}, lock_version=lock_version+1 WHERE id=#{@id}\")\n @lock_version += 1 #if we are here then we hold a lock on the table - we know our version is up to date\n else\n self.class.query(\"UPDATE #{SmartSession::SqlSession.table_name} SET `updated_at`=NOW(), `data`=#{self.class.quote(data)} WHERE id=#{@id}\")\n end\n else\n # if @id is nil, we need to create a new session in the database\n # and set @id to the primary key of the inserted record\n self.class.query(\"INSERT INTO #{SmartSession::SqlSession.table_name} (`created_at`, `updated_at`, `session_id`, `data`) VALUES (NOW(), NOW(), '#{@session_id}', #{self.class.quote(data)})\")\n @id = connection.last_id\n @lock_version = 0\n end\n end", "def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end", "def update_session_key\n @parameters['sessionKey'] = get_session_key\n end", "def update\n respond_to do |format|\n if @help_session_request.update(help_session_request_params)\n format.html { redirect_to @help_session_request, notice: 'Help session request was successfully updated.' }\n format.json { render :show, status: :ok, location: @help_session_request }\n else\n format.html { render :edit }\n format.json { render json: @help_session_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @contextual_session_id = args[:contextual_session_id] if args.key?(:contextual_session_id)\n end", "def put(path, params={}) # :nodoc:\n handle_response(@session.put(path, MultiJson.dump(params)))\n end", "def update\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n if @resource.update(resource_params)\n render json: @resource, status: :ok\n else\n render json: @resource.errors, status: :unprocessable_entity\n end\n end", "def refresh\n @session = ::Session.new(user: current_user)\n\n if @session.save\n current_session.destroy\n render :show, status: :created, location: @session\n else\n render json: @session.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @analysis_session.update(analysis_session_params)\n format.html { redirect_to @qa_session, notice: 'Analysis session was successfully updated.' }\n format.json { render :show, status: :ok, location: @analysis_session }\n else\n format.html { render :edit }\n format.json { render json: @analysis_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update #:nodoc:#\n Cachetastic::Caches::RailsSessionCache.set(@session_key, @session_data)\n end", "def update_current_logged_in_users_password(args = {}) \n id = args['id']\n temp_path = \"/users.json/current/password\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\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 head :unauthorized\n end", "def update\n return unless @session\n @session.data = @data\n @session.save\n end", "def update\r\n @ss_class_session_note = SsClassSessionNote.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @ss_class_session_note.update_attributes(params[:ss_class_session_note])\r\n format.html { redirect_to @ss_class_session_note, notice: 'Ss class session note 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: @ss_class_session_note.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n puts \"current user\"\n puts @user.id\n puts current_user.id\n if current_user.admin || @user.id == current_user.id\n if user_params['is_disabled']\n @user.tokens = nil\n end\n if @user.update(user_params)\n render json: @user\n else\n puts @user.errors.full_messages\n render json: @user.errors, status: :unprocessable_entity\n end\n else\n render json: @user.errors, status: :bad_request\n end\n end", "def update\n @trainings_session = TrainingsSession.find(params[:id])\n\t\t@my_exercises = Exercise.liked_by(current_user.id).published\n\t\t\t.concat(Exercise.owned_by(current_user.id).published)\n\t\t\t.concat(Exercise.owned_by(current_user.id).unpublished)\n\n respond_to do |format|\n if @trainings_session.update_attributes(params[:trainings_session])\n format.html { redirect_to @trainings_session, notice: 'Trainings session was successfully updated.' }\n format.json { head :no_content }\n\t\t\t\tformat.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trainings_session.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js { render action: \"edit\"}\n end\n end\n end", "def set_session\n @session = current_user.sessions.find(params[:id])\n end", "def update_session\n auth = Knock::AuthToken.new(payload: to_token_payload)\n auth.token\n end", "def create\n @current_session = CurrentSession.new(params[:current_session])\n\n if @current_session.save\n render json: @current_session, status: :created, location: @current_session\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @class_session.update(class_session_params)\n format.html { redirect_to @class_session, notice: 'Class session was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_session }\n else\n format.html { render :edit }\n format.json { render json: @class_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @class_session.update(class_session_params)\n format.html { redirect_to @class_session, notice: 'Class session was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_session }\n else\n format.html { render :edit }\n format.json { render json: @class_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @discovery_session = DiscoverySession.find(params[:id])\n\n respond_to do |format|\n if @discovery_session.update_attributes(params[:discovery_session])\n format.html { redirect_to @discovery_session, notice: 'Discovery session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discovery_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @subject_session.update(subject_session_params)\n format.html { redirect_to @subject_session, notice: 'Subject session was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject_session }\n else\n format.html { render :edit }\n format.json { render json: @subject_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @qa_session_file.update(qa_session_file_params)\n format.html { redirect_to @qa_session_file, notice: 'qa_session file was successfully updated.' }\n format.json { render :show, status: :ok, location: @qa_session_file }\n else\n format.html { render :edit }\n format.json { render json: @qa_session_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @session_plan_category.session_plans.find(params[:id]).update(session_plan_params)\n redirect_to session_plan_category_session_plans_path(@session_plan_category), notice: \"Session Plan updated successfully.\"\n else\n render 'edit'\n end\n end", "def update!(**args)\n @zwieback_session_id = args[:zwieback_session_id] if args.key?(:zwieback_session_id)\n end", "def update!(**args)\n @zwieback_session_id = args[:zwieback_session_id] if args.key?(:zwieback_session_id)\n end", "def update\n\n if(params[:token].nil?)\n response.status = 400\n render json: {msg: \"Token is not defined\"}\n return\n end\n\n session = validate_session(params[:token])\n\n if session.nil?\n response.status = 401\n render json: {}\n return\n end\n\n if params[:payload].nil?\n response.status = 400\n render json: {msg: \"Payload is not defined in request\"}\n return\n end\n\n begin\n obj = User.find(params[:id])\n\n unless session.user.id == obj.id\n response.status = 403\n render json: {}\n return\n end\n\n unless(params[:payload][:full_name].nil?)\n obj.full_name = params[:payload][:full_name]\n end\n\n unless(params[:payload][:email].nil?)\n obj.email = params[:payload][:email]\n end\n\n # Sending plain password\n # TODO: encrypt on client side\n unless(params[:payload][:password].nil?)\n obj.password = Digest::SHA256.hexdigest(params[:payload][:password])\n end\n\n if(obj.invalid?)\n response.status = 400\n r = {}\n obj.errors.map {|k, v| r[k] = v}\n render json: r\n return\n end\n\n obj.save\n\n response.status = 204\n render json: obj\n rescue ActiveRecord::RecordNotFound => e\n response.status = 404\n render json: {}\n rescue Exception => e\n response.status = 500\n render json: {msg: e}\n end\n\n end" ]
[ "0.6773565", "0.66347265", "0.6614955", "0.6555495", "0.6543775", "0.6543775", "0.6542582", "0.6464822", "0.6443306", "0.63708633", "0.6321665", "0.63013595", "0.629584", "0.628795", "0.6265235", "0.62536585", "0.62536585", "0.62536585", "0.62536585", "0.62098366", "0.62024206", "0.6198697", "0.61970395", "0.6152084", "0.6118435", "0.60880065", "0.6085427", "0.60518897", "0.6051252", "0.6050096", "0.60386235", "0.6010655", "0.59676033", "0.595691", "0.5948463", "0.59305245", "0.59241337", "0.5916816", "0.58924174", "0.5883062", "0.5865874", "0.58621925", "0.58612126", "0.5853112", "0.5840902", "0.58362937", "0.5829701", "0.58175004", "0.58052504", "0.57940775", "0.5793458", "0.57903093", "0.5777975", "0.57765114", "0.5772418", "0.5753611", "0.57529765", "0.57443845", "0.57382643", "0.5726085", "0.57248485", "0.5721643", "0.5719773", "0.5714578", "0.56888556", "0.56886107", "0.56861955", "0.568376", "0.568376", "0.56714743", "0.56597173", "0.56582814", "0.5652135", "0.5650064", "0.56357384", "0.56278056", "0.5609196", "0.5608293", "0.56038517", "0.56002486", "0.56000835", "0.5598917", "0.55773324", "0.55711293", "0.55689895", "0.5565446", "0.5564883", "0.5562667", "0.5557634", "0.55526274", "0.55399436", "0.55369544", "0.55369544", "0.55345666", "0.5533815", "0.55323154", "0.55310833", "0.5526051", "0.5526051", "0.5525728" ]
0.7385423
0
DELETE /current_sessions/1 DELETE /current_sessions/1.json
def destroy @current_session = CurrentSession.find(params[:id]) @current_session.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end", "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end", "def destroy\n Session.delete(params[:id])\n reset_session\n\n if request.format.html?\n redirect_to \"/sessions/new\"\n elsif requeset.format.json?\n render json: {success: true}\n end\n end", "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end", "def delete_session(env, sid, options); end", "def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ykt_session = YktSession.find(params[:id])\n @ykt_session.destroy\n\n respond_to do |format|\n format.html { redirect_to ykt_sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n if(params[:token].nil?)\n response.status = 400\n render json: {msg: \"Token is not defined\"}\n return\n end\n\n session = validate_session(params[:token])\n\n if session.nil?\n response.status = 401\n render json: {}\n return\n end\n\n begin\n obj = User.find(params[:id])\n\n unless session.user.id == obj.id\n response.status = 403\n render json: {}\n return\n end\n\n # This is what slows down the response.\n # Big DB transactions that delete by foreign key.\n obj.time_sessions.destroy_all\n obj.login_sessions.destroy_all\n\n obj.destroy\n response.status = 20\n render json: {msg: obj.time_sessions.methods}\n rescue ActiveRecord::RecordNotFound => e\n response.status = 404\n render json: {}\n rescue Exception => e\n response.status = 500\n render json: {msg: e}\n end\n\n end", "def destroy\n @session_info = SessionInfo.first\n @session_info.destroy\n\n respond_to do |format|\n format.html { redirect_to session_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @yoga_session = YogaSession.find(params[:id])\n @yoga_session.destroy\n\n respond_to do |format|\n format.html { redirect_to yoga_sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user=User.where(:authentication_token=>params[:api_key]).first\n @user.reset_authentication_token!\n render :json => { :message => [\"Session deleted.\"] }, :success => true, :status => :ok\n end", "def destroy\n @otg_sess.destroy\n respond_to do |format|\n format.html { redirect_to otg_sesses_url, notice: 'Otg sess was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @session.created_by == current_user.id\n @session.destroy\n else\n flash[:notice] = \"Cannot delete session as you did not create it.\"\n end\n respond_to do |format|\n format.html { redirect_to game_sessions_url }\n format.json { head :no_content }\n end\n end", "def logout\n # delete the session\n session.delete :user_id\n render json: { message: \"Logged Out\" }\n end", "def destroy\r\n @session = Session.find(params[:id])\r\n @session.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(sessions_url) }\r\n format.xml { head :ok }\r\n format.json { head :ok }\r\n\r\n end\r\n end", "def destroy \n session.delete :user_id \n head :no_content \n end", "def destroy\n @tsession.destroy\n respond_to do |format|\n format.html { redirect_to tsessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return if Settings.readonly \n\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def delete_session\n session[:userid] = nil\n session[:attributes] = nil\n end", "def destroy\n session_user.destroy\n render json: session_user\n end", "def destroy\n session.delete(:user)\n end", "def destroy\n id = shift_argument ||\n raise(Heroku::Command::CommandFailed, \"Usage: sessions:destroy [ID]\")\n session = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :delete,\n :path => \"/oauth/sessions/#{CGI.escape(id)}\"\n ).body\n end\n puts %{Destroyed \"#{session[\"description\"]}\".}\n end", "def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @session_replica.destroy\n respond_to do |format|\n format.html { redirect_to session_replicas_url }\n format.json { head :no_content }\n end\n end", "def delete_sessions(user_id:)\n path = '/users/{userId}/sessions'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'DELETE',\n path: path,\n headers: headers,\n params: params,\n )\n end", "def delete(url)\n setup_or_refresh_rest_session\n @session.delete(url: url)\n end", "def destroy\n @session_operation.destroy\n respond_to do |format|\n format.html { redirect_to session_operations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n set_session\n\n if @session.destroy\n respond_to do |format|\n format.html { redirect_back allow_other_host: false, fallback_location: batch_connect_sessions_url, notice: t(\"dashboard.batch_connect_sessions_status_blurb_delete_success\") }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_back allow_other_host: false, fallback_location: batch_connect_sessions_url, alert: t(\"dashboard.batch_connect_sessions_status_blurb_delete_failure\") }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete\n java_session = @java_request.getSession(false)\n java_session.invalidate if java_session\n end", "def destroy\n @study_session = StudySession.find(params[:id])\n @study_session.destroy\n\n respond_to do |format|\n format.html { redirect_to study_sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @session_resource.destroy\n\n head :no_content\n end", "def delete_sessions(node)\n @sessions.delete_all(node)\n end", "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to(sessions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n logout\n render json: {:ok => true}\n end", "def destroy\n session.delete :user_id\n redirect_to root_path\n end", "def destroy\n @user_session.destroy\n respond_to do |format|\n format.html { redirect_to user_sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trial = Trial.find(params[:id])\n @trial.users.delete(User.find session[:userID])\n logger.info(@trial.users)\n session[:current_trial] = nil\n respond_to do |format|\n format.html { redirect_to :controller => 'home', :action => 'index' }\n format.json { head :no_content }\n end\n end", "def delete_session(session_id)\n delete(\"session:#{session_id}\")\n end", "def destroy\n @user_session = UserSession.find(params[:id])\n if @user_session then @user_session.destroy end\n\n respond_to do |format|\n format.html { redirect_to :back, :notice => \"You have successfully logged out\" }\n format.json { head :ok }\n end\n end", "def destroy_session2_id\n url = \"https://208.65.111.144/rest/Session/logout/{'session_id':'#{get_session2}'}\"\n begin\n apiRequest(url)\n rescue Restclient::InternalServerError => e\n error_message = e.response[e.response.index('faultstring')+14..-3]\n if error_message != \"Session id is expired or doesn't exist\"\n puts \"Something went wrong trying to logout\"\n end\n end\n @@session_id = nil\n end", "def destroy\n session[:user_id] = nil\n head(:ok, status: :no_content) \n end", "def delete(path, params={}) # :nodoc:\n handle_response(@session.delete(path, MultiJson.dump(params)))\n end", "def destroy\n self.class.delete_all(\"session_id='#{session_id}'\")\n end", "def destroy\n # Delete the user access tokens on logout\n User.find(session[:user_id]).delete\n # Delete the session as well\n session = {}\n \n redirect_to root_path\n end", "def deleteSession(sessionID)\n call :deleteSession, :sessionID => sessionID\n end", "def logout\n session.delete(:user_id)\n end", "def destroy\n session[:developer_id] = nil\n redirect_to sessions_new_path\n end", "def destroy\n @sevone_session.destroy\n respond_to do |format|\n format.html { redirect_to sevone_sessions_url, notice: 'Sevone session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n session.delete :name\n end", "def destroy\n @discovery_session = DiscoverySession.find(params[:id])\n @discovery_session.destroy\n\n respond_to do |format|\n format.html { redirect_to discovery_sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @session_login.destroy\n respond_to do |format|\n format.html { redirect_to session_logins_url, notice: \"Session login was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutoring_session = TutoringSession.find(params[:id])\n @tutoring_session.destroy\n\n respond_to do |format|\n format.html { redirect_to tutoring_sessions_url }\n format.json { head :no_content }\n end\n end", "def logout\n response = @session.delete\n @auth_token = nil\n @rest.default_headers = { 'Content-Type' => 'application/json' }\n response\n end", "def delete\n if @session\n @session.destroy\n @session = nil\n end\n end", "def destroy\n @session.clear\n end", "def destroy\n @session_time.destroy\n respond_to do |format|\n format.html { redirect_to session_times_url, notice: 'Session time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_session = UserSession.find(params[:id])\n @user_session.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/signin\", notice: 'Goodbye!' }\n format.json { head :no_content }\n end\n end", "def log_out\n get '/sessions/destroy'\nend", "def log_out\n get '/sessions/destroy'\nend", "def destroy\n # Remove the user id from the session\n session.clear\n redirect_to root_url\n end", "def destroy_session\n response_handler(rest_delete('/rest/login-sessions'))\n self\n end", "def destroy\n session[:user_id] = nil\n response.status=(200)\n render json: {status: \"Success\", message: [\"Successfully Logged Out\"]}\n end", "def destroy\n\n @session = @event.sessions.find(params[:id])\n\n #when destroying the last session, also destroy the related event\n #i know i can refactor this\n # event = Event.find(@session.event_id)\n # if event.sessions.count == 1\n # event.destroy\n # end\n \n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to event_sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @session.destroy\n redirect_to '/fitness_sessions/',notice: \"\"\n #respond_to do |format|\n #format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n #format.json { head :no_content }\n #end\n end", "def delete_session(user_id:, session_id:)\n path = '/users/{userId}/sessions/{sessionId}'\n .gsub('{userId}', user_id)\n .gsub('{sessionId}', session_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if session_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"sessionId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'DELETE',\n path: path,\n headers: headers,\n params: params,\n )\n end", "def log_out \n get '/sessions/destroy'\nend", "def log_out \n get '/sessions/destroy'\nend", "def log_out \n get '/sessions/destroy'\nend", "def log_out \n get '/sessions/destroy'\nend", "def log_out \n get '/sessions/destroy'\nend", "def destroy\n @exercise_session.destroy\n respond_to do |format|\n format.html { redirect_to exercise_sessions_url, notice: 'Exercise session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n session.delete(:user_id) if session[:user_id]\n redirect_to new_session_path\n end", "def destroy\n @polling_session = PollingSession.find(params[:id])\n @polling_session.destroy\n\n respond_to do |format|\n format.html { redirect_to polling_sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sessao.destroy\n respond_to do |format|\n format.html { redirect_to sessaos_url, notice: 'Sessao was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ergo_session.destroy\n respond_to do |format|\n format.html { redirect_to ergo_sessions_url, notice: 'Ergo session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n session.delete :user_id\n redirect_to '/'\n end", "def destroy\n @sessao.destroy\n respond_to do |format|\n format.html { redirect_to sessaos_url, notice: \"Sessao was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @guest_session_association.destroy\n respond_to do |format|\n format.html { redirect_to jam_sessions_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_session = UserSession.find\n @user_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(:users, :notice => 'Goodbye!') }\n format.json { head :no_content }\n end\n end", "def logout\n session.delete :user_id\n end", "def destroy\n current_session.destroy if current_session\n\n cookies.delete(:remember_token)\n @current_user = nil\n\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_session = UserSession.find\n @user_session.destroy if @user_session\n\n respond_to do |format|\n format.html do\n gflash success: {value: 'Successfully logged out.', time: 5000}\n redirect_to root_path\n end\n format.json { head :no_content }\n end\n end", "def destroy\n session[:user_id] = nil\n redirect_to sessions_path\n end", "def destroy\n session.clear\n redirect_to root_path\n end", "def destroy\n session.clear\n redirect_to root_path\n end", "def destroy\n session.clear\n redirect_to root_path\n end", "def destroy\n session.clear\n redirect_to root_path\n end", "def logout\n reset_session\n render json: nil\n end", "def destroy\n\n session.delete(:user_id)\n redirect_to root_path, notice: \"logged out successfully \"\n\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n # expire auth token \n\t @user=User.where(:authentication_token=>params[:api_key]).first\n\t if @user.present?\n\t #@user.reset_authentication_token!\n token = Devise.friendly_token[0,20]\n unless @user.authentication_token == token\n @user.update_attributes(:authentication_token => token)\n end\n\t render :json => { :message => [\"Session deleted.\"], :success => true, :status => :ok}\n\t else\n\t\t respond_to do |format|\n format.json{ render :json => { :error => \"Api key is invalid.\" }}\n end\n\t end\n end", "def destroy\n # def self.destroy\n session.clear\n redirect_to login_path\n # reset_session\n # redirect :root_path\n # session[:user_id] = []\n end", "def destroy\n # super\n # raise Visit.where(user_id: current_user.id status: 'waiting').inspect\n @visit = Visit.where(\"user_id = ? AND status = ?\", current_user.id, 0)\n @visit[0].update(status: 2) if @visit[0]\n \n reset_session\n cookies[:user_id] = nil\n cookies[:user_name] = nil\n redirect_to \"/login/#{params[:id]}\"\n end", "def logout\n session.delete(:user_id) if current_user\n end", "def destroy\n @csession.destroy\n respond_to do |format|\n format.html { redirect_to csessions_url, notice: 'Csession was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @qa_session = @qa_session_file.qa_session\n @qa_session_file.destroy\n respond_to do |format|\n format.html { redirect_to qa_session_url(@qa_session), notice: 'qa_session file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7546458", "0.7240697", "0.722711", "0.720965", "0.7125998", "0.70720625", "0.7063802", "0.70515925", "0.7045978", "0.7045341", "0.70375925", "0.6954826", "0.69311565", "0.69306254", "0.6923306", "0.6908489", "0.68709755", "0.68671006", "0.68425214", "0.6836479", "0.68099755", "0.68086904", "0.6805188", "0.67992324", "0.67992324", "0.67992324", "0.67992324", "0.6794183", "0.6791586", "0.6786144", "0.67855585", "0.67811936", "0.6779019", "0.6758765", "0.6757597", "0.6753257", "0.67281675", "0.6726297", "0.6717985", "0.6704311", "0.66999775", "0.6699531", "0.66984284", "0.66676575", "0.6666557", "0.66657084", "0.6661311", "0.66596717", "0.664828", "0.664415", "0.6642171", "0.6627051", "0.66212565", "0.66204065", "0.6614042", "0.6609441", "0.6608089", "0.66065866", "0.66027904", "0.65947837", "0.6587863", "0.6577785", "0.6577785", "0.6576801", "0.6567322", "0.6565798", "0.65521085", "0.65437573", "0.6531368", "0.6523428", "0.6523428", "0.6523428", "0.6523428", "0.6523428", "0.651656", "0.6512587", "0.6504867", "0.65026045", "0.65004754", "0.6497313", "0.6495181", "0.6491697", "0.6483434", "0.6476089", "0.6467696", "0.6465436", "0.6457983", "0.64548224", "0.64548224", "0.64548224", "0.64548224", "0.6450964", "0.6449379", "0.644868", "0.6435905", "0.6435274", "0.64278483", "0.6427018", "0.6423237", "0.6421409" ]
0.72297907
2
returns ARRAY of direction_deltas based on whether the piece is a king or soldier.
def set_direction_deltas_based_on_king_status_and_color if kinged direction_deltas = KING_DIRECTION_DELTAS else direction_deltas = SOLDIER_DIRECTION_DELTAS end # flip the deltas depeneding on which where the pieces are facing. self.color == :black ? facing_multiplier = 1 : facing_multiplier = -1 direction_deltas.each do |delta| delta.map! do |index| index * facing_multiplier end end direction_deltas end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directions\n return UP_DIRS + DOWN_DIRS if king\n color == :white ? UP_DIRS : DOWN_DIRS\n end", "def possibleMovements\n deltas = []\n DIRECTIONS.each do |delta|\n deltas.push(delta) if canMoveBy? delta\n end\n deltas\n end", "def directions\n DIRECTIONS\n end", "def enemy_direction()\r\n for i in 0..3\r\n if @warrior.feel(DIRECTIONS[i]).enemy?\r\n return DIRECTIONS[i]\r\n end\r\n end\r\n end", "def choose_attack_direction\n @enemies_direction = Array.new\n Directions.each do |dir|\n if warrior.feel(dir).enemy? != nil\n @enemies_direction.push dir\n end\n end\n return false \n end", "def direction_origins\n directions = DIRECTIONS[move.piece.downcase]\n possibilities = []\n\n directions.each do |dir|\n piece, square = first_piece(destination_coords, dir)\n possibilities << square if piece == move.piece\n end\n\n possibilities\n end", "def directions\n [\"Northbound\", \"Southbound\", \"Eastbound\", \"Westbound\"]\n end", "def moves\n # create array to collect moves\n final_array = []\n\n\n\n pos = self.move_dirs\n\n pos.each do |optional_pos|\n\n end\n\n # Note do these logics for all the optional positions \n spec_dx = pos[0]\n spec_dy = pos[1]\n\n possible_movements = grow_unblocked_moves_in_dir(spec_dx, spec_dy)\n possible_movements\n # ending\n\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end", "def moves\n # create array to collect moves\n possible_moves = []\n move_dirs.each do |dir|\n possible_moves += grow_unblocked_moves_in_dir(dir[0],dir[1])\n end\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n possible_moves\n end", "def moves\n res = []\n move_dirs.each do |pos| # [0, 1]\n dx, dy = pos # 0, 1\n temp = grow_unblocked_moves_in_dir(dx, dy) # 0, 1 => [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6]]\n res += temp \n end\n res \n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end", "def directions\n vectors.map {|v| v.direction }\n end", "def king_positions\n king_locations = []\n @@piece_locations.each do |piece, details|\n if details[\"type\"] == \"king\"\n king_locations << piece\n end\n end\n return king_locations\n end", "def directions\n STRAIGHT + DIAGONAL\n end", "def moves\r\n # pos = [0,0]\r\n # row, col = pos\r\n all_h = []\r\n all_d = []\r\n HORIZONTAL_DIRS.each do |h_pos|\r\n h_row, h_col = h_pos\r\n all_h += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in h_pos\r\n end\r\n DIAGONAL_DIRS.each do |d_pos|\r\n h_row, h_col = d_pos\r\n all_d += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in d_pos\r\n end\r\n if self.class == Queen\r\n return all_h + all_d\r\n elsif self.class == Bishop\r\n return all_d\r\n elsif self.class == Rook\r\n return all_h\r\n end\r\n end", "def move_diffs\n\t\tcase type\n\t\twhen :man\n\t\t\t[[forward, 1], [forward, -1]]\n\t\twhen :king\n\t\t\t[-1, 1].product([-1, 1])\n\t\tend\n\tend", "def moves\n poss_moves = []\n determine_moves.each do |diff| #array of directions\n poss_moves += grow_unblocked_moves_in_dir(diff[0],diff[1])\n end\n poss_moves\n end", "def get_bomb_direction\n warrior.listen.each do |unit|\n if Captives.include? unit.to_s.to_sym and unit.ticking?\n return warrior.direction_of(unit)\n end \n end\n return false\n end", "def directions\n { 'N' => %w[W E],\n 'E' => %w[N S],\n 'S' => %w[E W],\n 'W' => %w[S N] }\n end", "def moves\n all_moves = []\n self.move_dirs.each do |move| \n if ((0..7).include?(self.pos[0] + move[0]) && (0..7).include?(self.pos[1] + move[1])) && !(@board[(self.pos[0] + move[0]), (self.pos[1] + move[1])].is_a?(Piece)) #|| self.color == \n all_moves << [(self.pos[0] + move[0]), (self.pos[1] + move[1])]\n end \n end\n all_moves\n end", "def moves\n moves_arr = []\n move_dirs.each do |dir|\n dx, dy = dir\n moves_arr += grow_unblocked_moves_in_dir(dx, dy)\n end\n moves_arr\n end", "def get_surrounding_cardinals\n Direction.all_cardinals.map do |direction|\n directional_offset(direction)\n end\n end", "def possible_directions\n case get_current_direction\n when 'N'\n %w[N E W]\n when 'E'\n %w[E N S]\n when 'S'\n %w[S W E]\n when 'W'\n %w[W N S]\n end\n end", "def get_moves\n [\n { row: @row + 1, col: @col + 2 },\n { row: @row + 1, col: @col - 2 },\n { row: @row + 2, col: @col + 1 },\n { row: @row + 2, col: @col - 1 },\n { row: @row - 1, col: @col + 2 },\n { row: @row - 1, col: @col - 2 },\n { row: @row - 2, col: @col + 1 },\n { row: @row - 2, col: @col - 1 }\n ].select do |move|\n [:blank_space, :enemy_piece].include? describe_location(move[:row], move[:col])\n end\n end", "def regular_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n \n # looks at the two forward diagonal positions and adds them to moves array if there are no pieces there\n pos1 = [@x_pos + 1, @y_pos + dir]\n moves << pos1 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 1, @y_pos + dir]\n moves << pos2 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves \n end", "def side_moving\n return @piece_moving.side if @piece_moving\n end", "def dir_sym\n if grid.include?(self.direction_vector.direction.leap)\n self.direction_vector.direction.leap\n elsif grid.include?(self.direction_vector.direction.normal)\n self.direction_vector.direction.normal\n else\n nil\n end\n end", "def possible_moves\n possibles = []\n @state.each_with_index do |column, i|\n possibles << i if column[5] == :e\n end\n possibles\n end", "def valid_moves_array(game_id, id)\n piece = Game.find(game_id).pieces.find_by(id: id)\n valid_moves_array = []\n if piece.present? && piece.color == Game.find(game_id).turn\n valid_moves_array = [[piece.x_coordinate, piece.y_coordinate]]\n (0..7).each do |y_target|\n (0..7).each do |x_target|\n valid_moves_array << [x_target, y_target] if piece.valid_move?(x_target, y_target)\n end\n end\n valid_moves_array\n end\n end", "def moves\n directions = MOVE_DIRECTIONS[self.piece_type]\n directions.map do |(dx, dy)|\n x, y = self.position\n [x + dx, y + dy]\n end.select { |coord| on_board?(coord) && not_blocked?(coord) }\n\n # cond = board[[coord]].nil? || board[[coord]].color != self.color\n # opp_cond = !(board[coord].color == self.color)\n # coord = [2,4]\n # [[2,3], nil, [3,4]]\n #(self.board[coord].color != self.color)\n end", "def path_directions(path)\n directions = []\n return directions if path.size < 2\n (0...path.size-1).each do |i|\n diff = path[i].to_i - path[i+1].to_i\n if diff.abs >= w\n if diff > 0\n directions << 'up'\n else\n directions << 'down'\n end\n else\n if diff < 0\n directions << 'right'\n else\n directions << 'left'\n end\n end\n end\n directions\n end", "def options\n pieces = @board.pieces(@current_player)\n moves = []\n pieces.each do |location|\n piece = @board[location]\n piece.moves.each do |direction|\n neighbor1 = @board.neighbors(location)[direction] if @board.neighbors(location)\n neighbor2 = @board.neighbors(neighbor1)[direction] if @board.neighbors(neighbor1)\n moves << move_factory(location, neighbor1, neighbor2)\n end\n end\n moves.delete_if(&:nil?)\n\n if moves.map(&:class).include?(Checkers::Jump)\n moves.delete_if { |move| move.class == Checkers::Move }\n unless @moves.empty? || @current_player != @moves.last.owner\n # There are still jumps leftover\n moves.keep_if { |jump| jump.src == @moves.last.dest }\n end\n end\n \n moves\n end", "def get_moves(pieces)\n\t\tarrPos = [] \n\t\tif team == 1\n\t\t\tarrPos << [@xCord, @yCord + 1] if square_is_open?(pieces, [@xCord, @yCord + 1])\n\t\t\tarrPos << [@xCord, @yCord + 2] if @yCord == 1 && square_is_open?(pieces, [@xCord, @yCord + 2])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord, @yCord - 1] if square_is_open?(pieces, [@xCord, @yCord - 1])\n\t\t\tarrPos << [@xCord, @yCord - 2] if @yCord == 6 && square_is_open?(pieces, [@xCord, @yCord - 2])\n\t\tend\n\t\tarrPos\n\tend", "def get_direction_to_avoiding_enemies\n Directions.each do |dir|\n if !warrior.feel(dir).wall? and\n warrior.feel(dir).empty? and\n !is_oposite_direction(dir, get_bomb_direction)\n return dir\n end\n end\n return false\n end", "def moves\n [player_one_move, player_two_move].compact\n end", "def get_direction start_pos, end_pos\n difference = [end_pos[0] - start_pos[0], end_pos[1] - start_pos[1]]\n difference.map { |value| value <=> 0 }\n end", "def right_directions\n {\n ToyEnums::NORTH => ToyEnums::EAST,\n ToyEnums::EAST => ToyEnums::SOUTH,\n ToyEnums::SOUTH => ToyEnums::WEST,\n ToyEnums::WEST => ToyEnums::NORTH\n }\n end", "def moves\n possible_moves = []\n dir do |dir|\n possible_moves += MyDirections(pos, dir)\n end\n possible_moves\n end", "def moves(direction = :all)\n case direction\n when :all\n ([left] + [top_left] + [top] + [top_right] +\n [right] + [bottom_right] + [bottom] + [bottom_left]).delete_if(&:empty?)\n when :left then [left]\n when :top_left then [top_left]\n when :top then [top]\n when :top_right then [top_right]\n when :right then [right]\n when :bottom_right then [bottom_right]\n when :bottom then [bottom]\n when :bottom_left then [bottom_left]\n end\n end", "def moves\n\n HORIZONTAL_DIRS.each do |direction|\n x,y = direction\n grow_unblocked_moves_in_dir(x,y)\n end\n\n #call grow_unblocked_ele \n# RIGHT HERE!!!\n \n #1 call move_dirs -< put this in each class\n #will return array of all possible moves from unblocked into moves array\n\n\n #2 Then #moves is used collects the all possible moves\n\n\n # create array to collect moves\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end", "def move\r\n case direction\r\n when DIRECTIONS[:north]\r\n self.longitude += 1\r\n when DIRECTIONS[:south]\r\n self.longitude -= 1\r\n when DIRECTIONS[:east]\r\n self.latitude += 1\r\n when DIRECTIONS[:west]\r\n self.latitude -= 1\r\n end\r\n\r\n return [latitude, longitude]\r\n end", "def moves\n return [] if @position.empty?\n possible_moves = []\n move_dirs.each do |dir| #[-1,-1]\n test_pos = @position #[1,3] - current position\n valid = true\n while valid\n x = dir.first + test_pos.first\n y = dir.last + test_pos.last\n test_pos = [x,y]\n valid = valid_move?([x,y])\n possible_moves << [x,y] if valid\n valid = false if valid == :attack\n end\n end\n possible_moves\n end", "def get_moves(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?.\n if board[[3, valid_col]] == ?.\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[3, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n end\n end\n end\n # If not in its column (can never stand in hallway anf column at same time)\n elsif (piece.col == valid_col && piece.row == 2 && board[[piece.row + 1, piece.col]] != piece.name) || (piece.col != valid_col && piece.row == 2)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n elsif piece.row == 3 && piece.col != valid_col && board[[2, piece.col]] == ?.\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 2\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n moves\nend", "def exits\n ways_out = []\n ways_out << :north if simperson.simplace.to_simnorth\n ways_out << :south if simperson.simplace.to_simsouth\n ways_out << :east if simperson.simplace.to_simeast\n ways_out << :west if simperson.simplace.to_simwest\n ways_out << :up if simperson.simplace.to_simup\n ways_out << :down if simperson.simplace.to_simdown\n ways_out\n end", "def possible_moves\n return []\n end", "def get_direction(data)\n # default direction\n dir = 0\n # handle special directions\n case data\n when DIR90Right\n # go back two indices in circle\n dir = Cache::LoopDir8[(Cache::LoopDir8.index(@ch.direction) + 6) % 8]\n # when 90 degrees left\n when DIR90Left\n # go forward two indices in circle\n dir = Cache::LoopDir8[(Cache::LoopDir8.index(@ch.direction) + 2) % 8]\n # when forward\n when DIRForward\n # character's direction\n dir = @ch.direction\n # when backward\n when DIRBackward\n # character's direction\n dir = 10 - @ch.direction\n # when toward player\n when DIRTowardPlayer\n # get distance to player\n dx = $game_player.x - @ch.x\n dy = $game_player.y - @ch.y\n # direction toward player\n dir = vector_to_direction(dx, dy)\n # when away from player\n when DIRAwayPlayer\n # get from to player\n dx = @ch.x - $game_player.x\n dy = @ch.y - $game_player.y\n # direction away from player\n dir = vector_to_direction(dx, dy)\n # Random 4 way direction\n when DIRRandom4\n # Random 4 way direction\n dir = Cache::Dir4[rand(4)]\n # Random 8 way direction\n when DIRRandom8\n # Random 8 way direction\n dir = Cache::Dir8[rand(8)]\n # when 45 degrees right\n when DIR45Right\n # go to previous index in circle\n dir = Cache::LoopDir8[(Cache::LoopDir8.index(@ch.direction) + 7) % 8]\n # when 45degrees left\n when DIR45Left\n # go to next index in circle\n dir = Cache::LoopDir8[(Cache::LoopDir8.index(@ch.direction) + 1) % 8]\n # no special direction\n else\n # set to 0-10 direction\n dir = data\n end\n return dir\n end", "def moves\n valid_moves = []\n move_dirs.each do |dx,dy| \n valid_moves += grow_unblocked_moves_in_dir(dx,dy)\n end\n valid_moves\n end", "def jump_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n\n # looks at the two forward far diagonal positions and adds them to moves array if there are no pieces there and an opponent piece in between\n pos1 = [@x_pos + 2, @y_pos + 2*dir]\n moves << pos1 if Piece.all.find{|p| p.x_pos == @x_pos + 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 2, @y_pos + 2*dir]\n moves << pos2 if Piece.all.find{|p| p.x_pos == @x_pos - 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n\n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves\n end", "def moved?(castling_pieces)\n castling_pieces.each do |piece|\n move_count = player_pieces[piece]['moves']\n\n return true if !move_count.zero?\n end\n\n false\n end", "def move_cost_chart(move_type)\n return case move_type # Normal Snow Rain\n when MOVE_FOOT then return [ 1]\n when MOVE_MECH then return [ 1]\n when MOVE_TIRE then return [ 1]\n when MOVE_TREAD then return [ 1]\n when MOVE_AIR then return [ 1, 2]\n when MOVE_TRANS then return [ 0]\n when MOVE_SEA then return [ 0]\n when MOVE_TIRE_B then return [ 1]\n end\n end", "def any_converted_pieces?(move)\n\t\t right\t\t=\t[\"right\", check_right(move)]\n\t\t left\t\t=\t[\"left\", check_left(move)]\n\t\t up\t\t\t=\t[\"up\", check_up(move)]\n\t\t down\t\t=\t[\"down\", check_down(move)]\n\t\t rud\t\t=\t[\"RUD\", check_RUpDiag(move)]\n\t\t rdd\t\t=\t[\"RDD\", check_RDownDiag(move)]\n\t\t lud\t\t=\t[\"LUD\", check_LUpDiag(move)]\n\t\t ldd\t\t=\t[\"LDD\", check_LDownDiag(move)]\n\t\t directions\t= \t[right, left, up, down, rud, rdd, lud, ldd]\n\t\t valid_move\t= \tfalse\n\t\t directions.each do |dir, arr|\n\t\t\tif conversion?(dir, arr)\n\t\t\t\tconvert_pieces(arr)\n\t\t\t\tvalid_move= true\n\t\t\tend \n\t\t end\n\t\treturn valid_move\n\tend", "def get_direction()\n\n floor_difference = @elevator.current_floor - @floor\n if floor_difference > 0\n @direction = \"down\"\n else\n @direction = \"up\"\n end\n end", "def get_days\n\t\tbool_array = []\n\n\t\tbool_array << self[:monday]\n\t\tbool_array << self[:tuesday]\n\t\tbool_array << self[:wednesday]\n\t\tbool_array << self[:thursday]\n\t\tbool_array << self[:friday]\n\t\tbool_array << self[:saturday]\n\t\tbool_array << self[:sunday]\n\n\t\treturn bool_array\n\tend", "def conversion?(dir, array)\n\t\tright_edges=@board_arr.select{|x| passed_left_edge?(x)}\n\t\tleft_edges=@board_arr.select{|x| passed_right_edge?(x)}\n\t\ttop_edges= Array(0..@board_width-1)\n\t\tbottom_edges= Array(@board.length-@[email protected])\n\t\t\n\t\tif array.empty?\n\t\t\treturn false\n\t\telse \n\t\t\tcase dir\n\t\t\t\n\t\t\t# If the opposite player's piece is at the top edge of the board, pieces are unable to be converted\n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"up\"\n\t\t\t\tif top_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last-@board_height)\n\t\t\t\t\treturn false \n\t\t\t\telse\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\t\n\t\t\t# If the opposite player's piece is at the bottom edge of the board, pieces are unable to be converted\n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"down\"\n\t\t\t\tif bottom_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last+@board_height)\n\t\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\t\n\t\t\t# If the opposite player's piece is at the right edge of the board, pieces are unable to be converted\n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"right\"\n\t\t\t\tif right_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last+1)\n\t\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\treturn true\n\t\t\t\tend \n\t\t\t\t\n\t\t\t# If the opposite player's piece is at the left edge of the board, pieces are unable to be converted\n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"left\"\n\t\t\t\tif left_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last-1)\n\t\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\treturn true \n\t\t\t\tend \n\t\t\t\n\t\t\t# Right Upward Diagonal\n\t\t\t# If the opposite player's piece is at the right edge or top edge of the board, pieces are unable to be converted\n\t\t\t# Because we are checking RIGHT UPWARD diagonally, we either reach the right edge or the top edge of the board. Rarely both. \n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"RUD\"\n\t\t\t\tif top_edges.include?(array.last)|| right_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last+1-@board_height)\n\t\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t \n\t\t\t# Right Downward Diagonal \n\t\t\t# If the opposite player's piece is at the right edge or bottom edge of the board, pieces are unable to be converted\n\t\t\t# Because we are checking RIGHT DOWNWARD diagonally, we either reach the right edge or the bottom edge of the board. Rarely both. \n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"RDD\"\n\t\t\t\tif bottom_edges.include?(array.last) || right_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last+1+@board_height)\n\t\t\t\t\treturn false\n\t\t\t\telse \n\t\t\t\t\treturn true\n\t\t\t\tend \n\t\t\t \n\t\t\t# Left Downward Diagonal\n\t\t\t# If the opposite player's piece is at the left edge or bottom edge of the board, pieces are unable to be converted\n\t\t\t# Because we are checking LEFT DOWNWARD diagonally, we either reach the right edge or the bottom edge of the board. Rarely both. \n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"LDD\"\n\t\t\t\tif bottom_edges.include?(array.last)|| left_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last-1+@board_height)\n\t\t\t\t\treturn false\n\t\t\t\telse \n\t\t\t\t\treturn true \n\t\t\t\tend \n\t\t\t\n\t\t\t# Left Upward Diagonal\n\t\t\t# If the opposite player's piece is at the left edge or bottom edge of the board, pieces are unable to be converted\n\t\t\t# Because we are checking LEFT UPWARD diagonally, we either reach the left edge or the top edge of the board. Rarely both. \n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"LUD\"\n\t\t\t\tif top_edges.include?(array.last) || left_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last-1-@board_height)\n\t\t\t\t\treturn false\n\t\t\t\telse \n\t\t\t\t\treturn true\n\t\t\t\tend \n\t\t\tend \n\t\tend \n\tend", "def areatrapezoide\n\t\tdt = 5\n\t\tsi = []\n\t\tgi.each do |i|\n\t\t\ts = (((gi[i]-gi[0]) + ((gi[i - 1]) - gi[0])) /2 ) * dt\n\t\t\tsi.push(s)\n\t\tend \n\t\treturn si\n\tend", "def proper_direction(direction)\n proper_direction_elevators = self.elevators.reject{|e| e.direction != direction }\n end", "def walking_toward?\n return Direction::Down if (@current_tile_indx >= 0 and @current_tile_indx <= 2)\n return Direction::Up if (@current_tile_indx >= 9 and @current_tile_indx <= 11)\n return Direction::Left if (@current_tile_indx >= 3 and @current_tile_indx <= 5)\n return Direction::Right if (@current_tile_indx >= 6 and @current_tile_indx <= 8)\n end", "def moves\n result = []\n\n color_setter = (color == :black ? 0 : 1)\n\n ## handles single moves\n d_pos = DELTA[color_setter]\n new_move = calc_new_move(d_pos)\n result << new_move if in_bounds?(new_move) && !occupied?(new_move)\n\n ## handles double move\n d_pos = DOUBLE_MOVE[color_setter]\n new_move = calc_new_move(d_pos)\n result << new_move if in_bounds?(new_move) && !moved? && !result.empty? && !occupied?(new_move)\n\n ## handles capture moves\n CAPTURE_MOVES[color_setter].each do |c_pos|\n new_move = calc_new_move(c_pos)\n result << new_move if in_bounds?(new_move) && capturable?(new_move)\n end\n\n result\n end", "def direction\n\t\tpoint_x = end_junction.position.x - start_junction.position.x\n\t\tpoint_y = end_junction.position.y - start_junction.position.y\n\t\t[point_x / @length, point_y / @length]\n\tend", "def move_diffs\n\t\tif is_king?\n\t\t\tVECTORS\n\t\telsif color == :black\n\t\t\tVECTORS[0..1]\n\t\telse\n\t\t\tVECTORS[2..3]\n\t\tend\n\tend", "def moves\n output = []\n move_one = false\n @directions = @directions.take(3) if position != @initial_position\n directions.each_index do |index|\n possible_position = [position[0] + directions[index][0],position[1] + directions[index][1]]\n if index.even?\n if board.in_bounds?(possible_position) && occupied?(possible_position)\n output << possible_position unless board[possible_position].color == board[position].color\n end\n elsif index == 1\n if board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position\n move_one = true\n end\n elsif board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position if move_one\n end\n end\n output\n end", "def get_moves_2(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?. && board[[3, valid_col]] == piece.name && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == piece.name\n moves << [[4, valid_col], (cols.count + 3) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == ?.\n moves << [[5, valid_col], (cols.count + 4) * piece.cost]\n end\n end\n # If right column and something is underneath and nothing above\n # If in wrong column completely and nothing above\n elsif piece.row >= 2\n below = (piece.row+1..5).to_a\n above = (2..piece.row-1).to_a\n if ((piece.col == valid_col && below.count{|c| board[[c, piece.col]] != piece.name} != 0 && below.length != 0) || (piece.col != valid_col)) && (above.count{|c| board[[c, piece.col]] == ?.} == above.length)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1 + above.length\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n end\n moves\nend", "def get_possible_moves\n moves = \n\t @@offsets.collect do |move| \n\t row = @position[:row] + move[0]\n\t col = @position[:col] + move[1]\n\t\t[row, col] if row.between?(0, 7) && col.between?(0, 7)\n\t end\n\tmoves.compact\n end", "def possible_moves\n\t\[email protected]_index { |piece, idx| piece == \"-\" ? idx : nil }.compact\n\tend", "def check?(king_pos, player)\n danger_zone = []\n\n player.pieces.each do |piece|\n if path = piece.valid_dest?(king_pos, @board)\n danger_zone << path\n end\n end\n\n danger_zone.empty? ? false : danger_zone\n end", "def moves\n diagonal_dirs\n end", "def check_direction(origin_arr,destination_arr)\n\t\t horizontal_direction(origin_arr,destination_arr)\n\tend", "def decide_direction()\n floors = @building.floors\n requests_below = 0\n #see how many people below, wanting to go up or down\n (1..@current_floor).each do |floor_num|\n f = floors[floor_num]\n if f.button_pairs[\"elevator#{@number}\"][\"up\"] == true || f.button_pairs[\"elevator#{@number}\"][\"down\"] == true\n requests_below += f.up_person_queue.size() + f.down_person_queue.size()\n end\n end\n requests_above = 0\n #see how many above wanting to go down or up\n (@[email protected]_of_floors).each do |floor_num|\n f = floors[floor_num]\n if f.button_pairs[\"elevator#{@number}\"][\"down\"] == true || f.button_pairs[\"elevator#{@number}\"][\"up\"] == true\n requests_above += f.up_person_queue.size() + f.down_person_queue.size()\n end\n end\n if requests_above == 0 && requests_below == 0\n @direction = \"stationary\"\n elsif requests_above > requests_below\n @direction = \"up\"\n move_up()\n else #requests_above <= requests_below\n @direction = \"down\"\n move_down()\n end \n end", "def aggressive_moves(this, that)\n directions = []\n directions << :north if (this.y > that.y) && ((this.y - that.y) < 10)\n directions << :south if (that.y > this.y) && ((that.y - this.y) < 10)\n directions << :west if (this.x > that.x) && ((this.x - that.x) < 10)\n directions << :east if (that.x > this.x) && ((that.x - this.x) < 10)\n directions\n end", "def moves; [] end", "def moves\n pos = self.current_position\n moves = []\n move_dirs.each do |arr|\n @current_position = pos\n loop do\n @current_position = [@current_position[0] + arr[0], @current_position[1] + arr[1]]\n break if [@current_position[0], @current_position[1]].any? { |val| val < 0 || val > 7 }\n if board.pos_occupied?(@current_position)\n if @board[@current_position].color == self.color\n break\n else\n moves << @current_position\n break\n end\n moves << @current_position\n end\n moves << @current_position\n end\n end\n moves\n end", "def check_down(move)\n\t\tnxt_spc=(move+@board_height)\n\t\tarray = []\n\t\tuntil (not in_bounds?(nxt_spc))|| empty_space?(nxt_spc)|| cp_piece?(nxt_spc) do \n\t\t\tarray.push(nxt_spc)\n\t\t\tnxt_spc+=@board_height\n\t\tend\n\t\treturn array\n\tend", "def protecting_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend", "def moves\n moves = []\n\n move_dirs.each do |dir| #[1,1]\n dx, dy = dir #1 0\n new_pos = grow_unblocked_moves_in_dir(dx, dy) #[1,0][2,0][3,0][4,0],[5,0][6,0][7,0]\n moves += new_pos\n end\n\n moves\n end", "def member_orders\n return [] unless may_have_direction? && @viewing_direction.present?\n\n [{viewingDirection: @viewing_direction}]\n end", "def direction_of(search_for) # 'search_for' should be a symbol of a 'space' method (empty? enemy? captive? etc.)\n DIRECTIONS.each do |direction|\n return direction if object_in_direction?(direction, search_for)\n end\n end", "def compute_direction(this_exit, other_exit, curvilinear_type)\n if curvilinear_type == STRAIGHT\n # no curve but we still need a direction, and we need to ensure both\n # \"half paths\" have different directions\n return this_exit < other_exit ? :left : :right\n end\n\n return :none if !other_exit || !this_exit\n\n if (this_exit + curvilinear_type) % 6 == other_exit\n :left\n elsif (other_exit + curvilinear_type) % 6 == this_exit\n :right\n end\n end", "def to_ary\n @directions\n end", "def diagonal_dirs\n move_set = []\n move_set += grow_unblocked_moves_in_dir(1, -1)\n move_set += grow_unblocked_moves_in_dir(1, 1)\n move_set += grow_unblocked_moves_in_dir(-1, -1)\n move_set += grow_unblocked_moves_in_dir(-1, 1)\n end", "def get_direction\n return (@dir || @character.direction)\n end", "def get_direction(direction)\n direction_hash[direction]\n end", "def pawn_direction? piece, square\n if piece.color == 0\n if square.coordinate[0] > piece.square.coordinate[0]\n true\n else\n false\n end\n elsif piece.color == 1\n if square.coordinate[0] < piece.square.coordinate[0]\n true\n else\n false\n end\n end\n \n end", "def possible_moves(x, y, dx, dy)\n return [[x - 1, y], [x, y + 1], [x, y - 1]] if dx > 0\n return [[x + 1, y], [x, y + 1], [x, y - 1]] if dx < 0\n return [[x + 1, y], [x, y + 1], [x - 1, y]] if dy > 0\n [[x + 1, y], [x, y - 1], [x - 1, y]]\n end", "def opposite(direction)\n op = {\"south\" => \"north\", \"north\" => \"south\", \"east\" => \"west\", \"west\" => \"east\", \"down\" => \"up\", \"up\" => \"down\"}\n return op[direction]\n end", "def check_LDownDiag(move)\n\t\t\tnxt_spc=((move+@board_height)-1)\n\t\t\tarray = []\n\t\t\tuntil passed_left_edge?(nxt_spc) || empty_space?(nxt_spc)|| cp_piece?(nxt_spc)|| (not in_bounds?(nxt_spc)) do\n\t\t\t\tarray.push(nxt_spc)\n\t\t\t\tnxt_spc+=(@board_height-1)\n\t\t\tend\n\t\t\treturn array\n\t\tend", "def moves\n moves = []\n\n x, y = self.position\n sign = self.color == :white ? 1 : -1\n init_row = self.color == :white ? 1 : 6\n\n one_up = [x + (1 * sign), y]\n two_up = [x + (2 * sign), y]\n\n moves << one_up if self.board[one_up].nil?\n\n if (self.board[one_up].nil? && self.board[two_up].nil? && self.position.first == init_row)\n moves << two_up\n end\n\n diag_left = [x + (1 * sign), y + 1]\n diag_right = [x + (1 * sign), y - 1]\n\n if self.board[diag_left] && self.board[diag_left].color != self.color\n moves << diag_left\n end\n\n if self.board[diag_right] && self.board[diag_right].color != self.color\n moves << diag_right\n end\n\n moves.select { |move| on_board?(move) }\n end", "def object_direction(object)\r\n for i in 0..3\r\n if @warrior.feel(DIRECTIONS[i]).send(object)\r\n return DIRECTIONS[i]\r\n end\r\n end\r\n end", "def determind_sight_angles(angle)\n case direction\n when 2; value = [270 + angle, 270 - angle]\n when 4; value = [180 + angle, 180 - angle]\n when 6; value = [ 0 + angle, 0 - angle]\n when 8; value = [ 90 + angle, 90 - angle]\n end\n value[0] = (value[0] + 360) % 360\n value[1] = (value[1] + 360) % 360\n return value\n end", "def get_valid_moves\n # delta = color == :white ? 1 : -1\n pos = [position[0] + direction, position[1]]\n validated_moves = capture_spaces\n validated_moves << pos if valid_move?(pos)\n unless @moved || !validated_moves.include?(pos)\n\n pos = [position[0] + (2*direction), position[1]]\n validated_moves += valid_move?(pos) ? [pos] : []\n end\n\n validated_moves\n end", "def get_direction_constant\n # Use const_get to get the classes direction constants based on the direction string (NORTH, EAST, SOUTH and WEST)\n return DIRECTION_INFORMATION[@current_position[:direction].upcase.to_sym]\n end", "def find_possible_moves diffs\n [].tap do |possible_moves|\n diffs.each do |row|\n possible_moves << [self.pos[0] + row[1], self.pos[1] + row[0]]\n end\n end \n end", "def check_LUpDiag(move)\n\t\t\tnxt_spc= ((move-@board_height)-1)\n\t\t\tarray=[]\n\t\t\tuntil passed_left_edge?(nxt_spc)|| empty_space?(nxt_spc)|| cp_piece?(nxt_spc) || (not in_bounds?(nxt_spc)) do\n\t\t\t\tarray.push(nxt_spc)\n\t\t\t\tnxt_spc-=(@board_height+1)\n\t\t\tend\n\t\t\treturn array\n\t\tend", "def moves_available\n # return what moves are available to this piec\n end", "def direction?(new_direction)\n case @direction\n when direction = 'up' then new_direction != 'down'\n when direction = 'down' then new_direction != 'up'\n when direction = 'left' then new_direction != 'right'\n when direction = 'right' then new_direction != 'left'\n end\n end", "def diagonal_dirs\n moves = []\n # Add moves toward the top left...\n moves += grow_unblocked_moves_in_dir(-1, -1)\n # ...the bottom left...\n moves += grow_unblocked_moves_in_dir(-1, 1)\n # ...the top right...\n moves += grow_unblocked_moves_in_dir( 1, -1)\n # ...and the bottom right.\n moves += grow_unblocked_moves_in_dir( 1, 1) \n moves\n end", "def moves\n moves = []\n\n # call move_dirs and generate moves\n move_dirs.each do |x,y|\n moves += valid_positions(x,y)\n end\n moves\n end", "def days\n return self.day_shifts.keys\n end", "def breed_move\n return data.breed_moves\n end", "def distance(array)\n orientation = 'N'\n position = [0, 0]\n\n array.each do |e|\n turn = e[0]\n distance = calc_distance(e)\n orientation = new_dir(orientation, turn)\n position = jump_to_new_position(orientation, position, distance)\n end\n\n print 'Distance to last position: '\n p dis_comb(position)\nend", "def cardinal_paths(direction)\n off_gen = CardinalOffsetGenerator.new(coordinates, direction)\n off_gen.moves\n end", "def moves \r\n move = []\r\n move_directions do |dir|\r\n move += grow_unblocked_moves_in_dir(*dir)\r\n end\r\n move\r\n end" ]
[ "0.62428254", "0.6149118", "0.59590465", "0.5847815", "0.5843281", "0.5813812", "0.57934564", "0.5773558", "0.5732841", "0.57278794", "0.57106537", "0.5710548", "0.5645648", "0.5553922", "0.55151993", "0.54956174", "0.5441648", "0.5393219", "0.5391681", "0.53884345", "0.5387039", "0.5330697", "0.53074694", "0.5297382", "0.51805705", "0.51797694", "0.5151847", "0.5148088", "0.5143588", "0.5135872", "0.5129504", "0.5095124", "0.50832", "0.5073639", "0.50707906", "0.50610113", "0.5059032", "0.5056407", "0.50482625", "0.503564", "0.5030387", "0.50276077", "0.5027073", "0.50215936", "0.5010835", "0.49952355", "0.49910378", "0.4973865", "0.49688303", "0.49626148", "0.49625328", "0.4949834", "0.49372873", "0.49334094", "0.49292836", "0.4928944", "0.49258932", "0.49256274", "0.49175566", "0.4911039", "0.49095646", "0.49067068", "0.4905622", "0.49037412", "0.48957548", "0.48956358", "0.48915815", "0.48858112", "0.4869282", "0.486654", "0.48637104", "0.484836", "0.48474243", "0.4844505", "0.48330766", "0.48316604", "0.48286074", "0.4825809", "0.48220158", "0.48192808", "0.48132485", "0.4807439", "0.4806574", "0.47866026", "0.47842687", "0.4776208", "0.47753635", "0.4774997", "0.47746223", "0.4768498", "0.47643572", "0.47623032", "0.47596037", "0.47592714", "0.47592685", "0.47590947", "0.47490627", "0.47489762", "0.47482204", "0.4747192" ]
0.6097453
2
Returns definition string for this class's constructor
def get_definition(cls, bld, fun) bld.add("/// <summary>") bld.add("/// Reads one result using the specified filter parameters") bld.add("/// </summary>") bld.startFunction("public " + get_function_signature(cls, bld, fun)) get_body(cls, bld, fun) bld.endFunction end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_definition(codeClass, cfg)\n conDef = String.new\n indent = \" \"\n\n conDef << indent << \"# Constructor\\n\"\n\n conDef << indent << \"def initialize()\\n\"\n\n varArray = Array.new\n codeClass.getAllVarsFor(varArray);\n\n for var in varArray\n if var.elementId == CodeElem::ELEM_VARIABLE\n if var.defaultValue != nil\n conDef << indent << \" @\" << var.name << \" = \"\n\n if var.vtype == \"String\"\n conDef << \"\\\"\" << var.defaultValue << \"\\\"\"\n else\n conDef << var.defaultValue << \"\"\n end\n\n if var.comment != nil\n conDef << \"\\t# \" << var.comment\n end\n\n conDef << \"\\n\"\n end\n end\n end\n\n conDef << indent << \"end # initialize\\n\\n\";\n\n return(conDef);\n end", "def _initialization_definition\n arguments = @fields.map do |schema_field|\n arg = \"#{schema_field.name}:\"\n arg += _field_default(schema_field)\n arg.strip\n end\n\n result = \"def initialize(#{arguments.first}\"\n arguments[1..-1].each_with_index do |arg, _i|\n result += \",#{INITIALIZE_WHITESPACE}#{arg}\"\n end\n \"#{result})\"\n end", "def get_definition(cls, bld, fun)\n bld.add(\"///\")\n bld.add(\"/// Constructor\")\n bld.add(\"///\")\n\n standardClassName = XCTECSharp::Utils.instance.getStyledClassName(cls.getUName())\n\n bld.startClass(standardClassName + \"()\")\n\n get_body(cls, bld, fun)\n\n bld.endClass\n end", "def to_s\n \"#{DbAgile::RubyTools::unqualified_class_name(self.class)}: #{name} #{definition.inspect}\"\n end", "def to_s\n Semantic.check_class(self) do\n str = \"function #{name}(#{@parameters.join(', ')}) {\\n\"\n Indentation.indent do\n str << \"#{@attributes.map(&:to_s).join(\"\\n\")}\\n\" unless\n @attributes.empty?\n str << \"#{Indentation.get}var self = this;\\n\\n\"\n str << \"#{function2method(@constructor)}\"\n unless @private_methods.empty?\n str << \"\\n#{@private_methods.map(&:to_s).join(\"\\n\")}\"\n end\n unless @public_methods.empty?\n str << \"\\n\"\n str << @public_methods.map { |m| function2method(m) }.join(\"\\n\")\n end\n str << \"\\n#{Indentation.get}this.init(#{@parameters.join(', ')});\\n\"\n end\n \"#{str}#{Indentation.get}}\\n\"\n end\n end", "def definition\n \"class #{full_name}\"\n end", "def generate_constructor(arguments)\n params = arguments.map do |arg_name, required|\n if required\n arg_name\n else\n \"#{arg_name} = self.class.__constructor_default(:#{arg_name})\"\n end\n end\n\n <<-SRC\n def initialize(#{params.join(\", \")})\n super(#{arguments.keys.join(\", \")})\n freeze\n end\n SRC\n end", "def get_definition(cls, bld)\r\n bld.add(\"///\")\r\n bld.add(\"/// Constructor\")\r\n bld.add(\"///\")\r\n\r\n bld.add(\"[TestMethod]\")\r\n bld.startFunction(\"public void \" + Utils.instance.getStyledFunctionName(\"test \" + cls.getUName() + \" engine\") + \"()\")\r\n get_body(cls, bld)\r\n\r\n bld.endFunction\r\n end", "def inspect\n return \"#<#{self.class.name}: #{self.name}>\"\n end", "def generate_keyword_constructor(arguments)\n params = arguments.map do |arg_name, required|\n if required\n \"#{arg_name}:\"\n else\n \"#{arg_name}: __constructor_default(:#{arg_name})\"\n end\n end\n\n <<-SRC\n def with(#{params.join(\", \")})\n self.new(#{arguments.keys.join(\", \")})\n end\n SRC\n end", "def definition\n \"class << #{full_name}\"\n end", "def makeInitStringWithInstanceVars\n str=\"\"\n (0..self.class.paramNames.length-1).each {|i|\n if (i>0)\n str+=\"; \"\n end\n pStr = \"@\" + self.class.paramNames[i]\n valStr = @paramVals[i].to_s\n if hasUnits(i) \n valStr = UnitUtils.convertNumString(valStr)\n end\n str += pStr + \"=\" + valStr\n }\n return str\n end", "def constructor_definition\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n\n value = nil\n\n\n name = nil\n type = nil\n a = nil\n\n\n begin\n # at line 42:5: INIT ( '(' (type= variable_type name= IDENT ( ',' type= variable_type name= IDENT )* )? ')' )? ( CLOSE | NL (a= statement )* CLOSE )\n match( INIT, TOKENS_FOLLOWING_INIT_IN_constructor_definition_257 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = ConstructorDefinitionEval.new \n # <-- action\n end\n\n # at line 43:3: ( '(' (type= variable_type name= IDENT ( ',' type= variable_type name= IDENT )* )? ')' )?\n alt_12 = 2\n look_12_0 = @input.peek( 1 )\n\n if ( look_12_0 == T__34 )\n alt_12 = 1\n end\n case alt_12\n when 1\n # at line 43:5: '(' (type= variable_type name= IDENT ( ',' type= variable_type name= IDENT )* )? ')'\n match( T__34, TOKENS_FOLLOWING_T__34_IN_constructor_definition_265 )\n # at line 43:9: (type= variable_type name= IDENT ( ',' type= variable_type name= IDENT )* )?\n alt_11 = 2\n look_11_0 = @input.peek( 1 )\n\n if ( look_11_0 == IDENT || look_11_0.between?( TYPE_BOOL, TYPE_VOID ) )\n alt_11 = 1\n end\n case alt_11\n when 1\n # at line 44:5: type= variable_type name= IDENT ( ',' type= variable_type name= IDENT )*\n @state.following.push( TOKENS_FOLLOWING_variable_type_IN_constructor_definition_275 )\n type = variable_type\n @state.following.pop\n name = match( IDENT, TOKENS_FOLLOWING_IDENT_IN_constructor_definition_279 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value.add_argument(type, name.text) \n # <-- action\n end\n\n # at line 45:5: ( ',' type= variable_type name= IDENT )*\n while true # decision 10\n alt_10 = 2\n look_10_0 = @input.peek( 1 )\n\n if ( look_10_0 == T__40 )\n alt_10 = 1\n\n end\n case alt_10\n when 1\n # at line 45:6: ',' type= variable_type name= IDENT\n match( T__40, TOKENS_FOLLOWING_T__40_IN_constructor_definition_288 )\n @state.following.push( TOKENS_FOLLOWING_variable_type_IN_constructor_definition_292 )\n type = variable_type\n @state.following.pop\n name = match( IDENT, TOKENS_FOLLOWING_IDENT_IN_constructor_definition_296 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value.add_argument(type, name.text) \n # <-- action\n end\n\n\n else\n break # out of loop for decision 10\n end\n end # loop for decision 10\n\n\n end\n match( T__35, TOKENS_FOLLOWING_T__35_IN_constructor_definition_308 )\n\n end\n # at line 47:3: ( CLOSE | NL (a= statement )* CLOSE )\n alt_14 = 2\n look_14_0 = @input.peek( 1 )\n\n if ( look_14_0 == CLOSE )\n alt_14 = 1\n elsif ( look_14_0 == NL )\n alt_14 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 14, 0 )\n\n end\n case alt_14\n when 1\n # at line 47:5: CLOSE\n match( CLOSE, TOKENS_FOLLOWING_CLOSE_IN_constructor_definition_317 )\n\n when 2\n # at line 47:13: NL (a= statement )* CLOSE\n match( NL, TOKENS_FOLLOWING_NL_IN_constructor_definition_321 )\n # at line 47:16: (a= statement )*\n while true # decision 13\n alt_13 = 2\n look_13_0 = @input.peek( 1 )\n\n if ( look_13_0.between?( IDENT, IF ) || look_13_0 == RETURN || look_13_0 == WHILE )\n alt_13 = 1\n\n end\n case alt_13\n when 1\n # at line 47:17: a= statement\n @state.following.push( TOKENS_FOLLOWING_statement_IN_constructor_definition_326 )\n a = statement\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value.add_statement(a) \n # <-- action\n end\n\n\n else\n break # out of loop for decision 13\n end\n end # loop for decision 13\n\n match( CLOSE, TOKENS_FOLLOWING_CLOSE_IN_constructor_definition_332 )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 7 )\n\n\n end\n\n return value\n end", "def inspect\n \"#<#{self.class.inspect}(#{@name})>\"\n end", "def get_declaration(codeClass, cfg)\n return \"\"\n end", "def get_definition(codeClass, cfg)\n readDef = String.new\n varArray = Array.new\n codeClass.getAllVarsFor(varArray);\n\n\treadDef << \"\\n\"\n\t\n readDef << \" public function create() {\\n\";\n readDef <<\n\t\t\t\"$serializer = JMS\\Serializer\\SerializerBuilder::create()->build();\n\t\t\t\t\t\"\n\t\t\t\"$data = $serializer->deserialize(file_get_contents('php://input'), '', 'json')\n\t\t\t\n\t\t\tforeach ($data as $varName => varValue)\n\t\t\t{\n\t\t\t}\"\n \n\t\t\t\"{ return($this->\" << varSec.name << \"); };\\n\"\n \n\n for varSec in varArray\n if varSec.elementId == CodeElem::ELEM_VARIABLE && varSec.genSet == \"true\"\n if !varSec.isPointer\n if varSec.arrayElemCount == 0\n readDef << \"( $new\" << XCTEPhp::Utils::getCapitalizedFirst(varSec.name)\n readDef << \")\\t{ $this->\" << varSec.name << \" = $new\" << XCTEPhp::Utils::getCapitalizedFirst(varSec.name) << \"; };\\n\"\n end\n end\n\n elsif varSec.elementId == CodeElem::ELEM_COMMENT\n readDef << \" \" << XCTEPhp::Utils::getComment(varSec)\n elsif varSec.elementId == CodeElem::ELEM_FORMAT\n readDef << varSec.formatText\n end\n end\n\n return(readDef);\n end", "def constructor; end", "def initialize\n puts INITIALIZER_MESSAGE\n end", "def initialize(name, definition)\n @name = name\n @definition = definition\n end", "def inspect\n \"\\#<#{self.class} name=#{name.inspect}>\"\n end", "def inspect\n \"#<#{self.class.name} #{@name} file=#{@file}>\"\n end", "def inspect\n return \"#<#{self.class.name}: #{self}>\"\n end", "def std_init_name(class_name)\n \"#{class_name}__INIT\".to_sym\n end", "def to_s\n return '#<' + self.class.to_s + \":\" + self.name + '>'\n end", "def inspect\n \"#<#{self.class.inspect} @name=#{name.inspect}>\"\n end", "def definition_builder; end", "def definition_builder; end", "def get_definition\n\n end", "def inspect\n str = \"#<#{self.class} source=#{source.inspect}\"\n str << \" generated=#{generated}, original=#{original}\"\n str << \" name=#{name.inspect}\" if name\n str << \">\"\n str\n end", "def inspect\n \"#<#{self.class.name} @name=#{@name}>\"\n end", "def inspect\n \"#<#{self.class.name}: #{to_s}>\"\n end", "def inspect\n \"#<#{self.class.name}: #{to_s}>\"\n end", "def inspect\n\t\treturn \"#<%p:%0#x {%d} '%s' (%s): [%s] %s>\" % [\n\t\t\tself.class,\n\t\t\tself.object_id * 2,\n\t\t\tself.synsetid,\n\t\t\tself.words.map(&:to_s).join(', '),\n\t\t\tself.part_of_speech,\n\t\t\tself.lexical_domain,\n\t\t\tself.definition,\n\t\t]\n\tend", "def generate_definition\n # return if not @type # ToDo: remove?\n @type.to_s + ' ' + code_name + \";\\n\"\n end", "def inspect\n \"#<#{ self.class.name }>\"\n end", "def to_s\n \"From #{@description} [#{@database}]:\\n\\n\" +\n \"#{@definition.inject(''){ |s, l| s << ' ' << l }}\\n\\n\"\n end", "def initialize(definition)\n @definition = definition\n end", "def inspect\n\t\treturn %{#<%s:0x%0x %s>} % [\n\t\t\tself.class.name,\n\t\t\tself.object_id / 2,\n\t\t\tself.ivar_descriptions.join( ', ' ),\n\t\t]\n\tend", "def inspect\n \"#{self.class}(actual: #{actual.inspect}, \" \\\n \"definition: #{definition.inspect}, \" \\\n \"error: #{error.inspect}, \" \\\n \"expected: #{expected.inspect}, \" \\\n \"got: #{got.inspect}, \" \\\n \"negate: #{negate?.inspect}, \" \\\n \"level: #{level.inspect})\"\n end", "def inspect\n \"#{self.class}<#{@description.inspect}>\"\n end", "def initialize(str)\n @macro_string = Macro.is_macro?(str) ? str : \"#{MACRO_SYMBOL}#{DELIMITERS.first}#{str}#{DELIMITERS.last}\"\n end", "def inspect\n \"#<#{self.class.name.split('::').last} - #{@properties}>\"\n end", "def to_s\n \"#{self.class} #{self.name}\"\n end", "def inspect\n \"#<#{self.class.name} @name=#{name} @mapper=#{mapper}>\"\n end", "def inspect\n \"#<#{self.class.name} @clazz=#{@clazz.name}>\"\n end", "def definition_name\n return @definition_name if defined?(@definition_name)\n\n if name\n @definition_name = name.gsub(\"::\", \"__\").freeze\n else\n \"#{self.class.name}_#{object_id}\".gsub(\"::\", \"__\").freeze\n end\n end", "def inspect\n\t\treturn \"#<%s:0x%0x>\" % [ self.class, self.__id__ * 2 ]\n\tend", "def formatConstructor(theLines)\n\n\treplaceVoids(\t\ttheLines);\n\tspaceFirstComment(\ttheLines);\n\nend", "def ref\n @definition_name\n end", "def get_definition(fun, cfg)\n eDef = String.new\n\n indent = String.new(\" \")\n\n # Skeleton of comment block\n eDef << indent << \"#\\n\"\n eDef << indent << \"#\\n\"\n\n for param in fun.parameters\n eDef << indent << \"# \" << param.name << \":: \\n\"\n end\n\n if fun.returnValue.vtype != \"void\"\n eDef << indent << \"# \\n\" << indent << \"# return:: \\n\"\n end\n\n eDef << indent << \"def \"\n\n # Function body framework\n if fun.isStatic\n eDef << \"self.\"\n end\n\n eDef << fun.name << \"(\"\n\n for param in (0..(fun.parameters.size - 1))\n if param != 0\n eDef << \", \"\n end\n\n eDef << XCTERuby::Utils::getParamDec(fun.parameters[param])\n end\n\n eDef << \")\"\n\n eDef << \"\\n\"\n\n eDef << indent << \" \\n\"\n\n if fun.returnValue.vtype != \"void\"\n eDef << indent << \" return \\n\"\n end\n\n eDef << indent << \"end # \" << fun.name << \"\\n\\n\"\n\n return eDef\n end", "def get_definition(codeClass, cfg)\n eqString = String.new\n seperator = \"\"\n longArrayFound = false\n varArray = Array.new\n codeClass.getAllVarsFor(varArray)\n\n eqString << \"/**\\n* Defines the variables in an object\\n*/\\n\"\n eqString << \"void \" << codeClass.name << \" :: zero()\\n\"\n eqString << \"{\\n\"\n\n # if codeClass.hasAnArray\n # eqString << \" unsigned int i;\\n\\n\";\n # end\n\n varArray = Array.new\n codeClass.getAllVarsFor(varArray)\n\n for var in varArray\n if var.elementId == CodeElem::ELEM_VARIABLE\n if !var.isStatic # Ignore static variables\n if XCTECpp::Utils::isPrimitive(var)\n eqString << \" \" << var.name << \" = \" << XCTECpp::Utils::getZero(var) << \";\\n\"\n end\n end\n end\n end\n\n eqString << \"}\\n\\n\"\n end", "def initialize(name) end", "def to_s\n \"#{self.singleton_class} name: #{@name}, expires_in: #{@expires_in}, quality: #{@quality}\"\n end", "def initialize(title)\n @title = title\n puts self\n end", "def make_cpp name, _attr = nil\n\n\ts = \"#include \\\"#{name}.hpp\\\"\\n\\n\"\n\ts << \"// STATIC ########################################################\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// CANONICAL #####################################################\\n\\n\"\n\ts << \"#{name}::#{name} ( void )\\n\"\n\ts << \"{\\n\"\n\ts << \"\treturn ;\\n\"\n\ts << \"}\\n\\n\"\n\ts << \"#{name}::#{name} ( #{name} const & src )\\n\"\n\ts << \"{\\n\"\n\ts << \"\t*this = src;\\n\"\n\ts << \"\treturn ;\\n\"\n\ts << \"}\\n\\n\"\n\ts << \"#{name} &\t\t\t\t#{name}::operator=( #{name} const & rhs )\\n\"\n\ts << \"{\\n\"\n\ts << \"\tif (this != &rhs)\\n\"\n\ts << \"\t{\\n\"\n\tif _attr\n\t\t_attr.each do |a|\n\t\t\tv = a.split('_')\n\t\t\ts << \"\t\tthis->_#{v.last} = rhs.get#{v.last.slice(0,1).capitalize + v.last.slice(1..-1)}();\\n\"\n\t\tend\n\telse\n\t\ts << \"\t\t// make stuff\\n\"\n\tend\n\ts << \"\t}\\n\"\n\ts << \"\treturn (*this);\\n\"\n\ts << \"}\\n\\n\"\n\ts << \"#{name}::~#{name} ( void )\\n\"\n\ts << \"{\\n\"\n\ts << \"\treturn ;\\n\"\n\ts << \"}\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// CONSTRUCTOR POLYMORPHISM ######################################\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// OVERLOAD OPERATOR #############################################\\n\\n\"\n\ts << \"std::ostream &\t\t\t\toperator<<(std::ostream & o, #{name} const & i)\\n{\\n\"\n\ts << \"\\t(void)i;\\n\\treturn (o);\"\n\ts << \"\\n}\\n\\n// ###############################################################\\n\\n\"\n\ts << \"// PUBLIC METHOD #################################################\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// GETTER METHOD #################################################\\n\\n\"\n\tif _attr\n\t\t_attr.each do |a|\n\t\t\tv = a.split('_')\n\t\t\ts << \"#{v.first}\t\t\"\n\t\t\ts << \"\t\" if v.first.length < 16\n\t\t\ts << \"\t\" if v.first.length < 11\n\t\t\ts << \"\t\" if v.first.length < 6\n\t\t\ts << \"#{name}::get#{v.last.slice(0,1).capitalize + v.last.slice(1..-1)}( void ) const noexcept\\n\"\n\t\t\ts << \"{\\n\"\n\t\t\ts << \"\treturn(this->_#{v.last});\\n\"\n\t\t\ts << \"}\\n\"\n\t\tend\n\t\ts << \"\\n\"\n\tend\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// SETTER METHOD #################################################\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// PRIVATE METHOD ################################################\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// EXCEPTION METHOD ##############################################\\n\\n\"\n\ts << \"// ###############################################################\\n\\n\"\n\ts << \"// EXTERNAL ######################################################\\n\\n\"\n\ts << \"// ###############################################################\\n\"\n\tputs \"create #{name}.cpp\"\n\ts\nend", "def klass\n @properties.map { |symbol|\n symbol.to_s\n }.join(\" \") unless @properties.empty?\n end", "def inspect\n\t\treturn %{#<%s:0x%0x (%s)>} % [\n\t\t\tself.class.name,\n\t\t\tself.object_id * 2,\n\t\t\tself.component,\n\t\t]\n\tend", "def get_definition(cls, bld, funCb)\r\n bld.add(\"///\")\r\n bld.add(\"/// Create new record for this model\")\r\n bld.add(\"/// If you are not using ambient transactions, trans must be defined!\")\r\n bld.add(\"///\")\r\n\r\n bld.startFunction(\"public void Create(\" +\r\n XCTECSharp::Utils.instance.getStyledClassName(cls.getUName()) +\r\n \" o, SqlConnection conn, SqlTransaction trans = null)\")\r\n\r\n get_body(cls, bld, funCb)\r\n\r\n bld.endFunction\r\n end", "def initialize(name,description,function)\n @name = name\n @description = description\n @function = function\n end", "def name\n definition.name\n end", "def to_s\n \"#{self.singleton_class} name: #{@name}, expires_in: #{@expires_in}, quality: #{@quality}\"\n end", "def get_construction_name()\n get_keyword_value(\"CONSTRUCTION\")\n end", "def creator_class_name\n \"#{@clazz.name}Creator\"\n end", "def name\n name = @ruby_class.name.dup\n name << '<' << @args.map{|e| e.name }.join(',') << '>'\n name\n end", "def initialize text, name\n super\n\n @c_function = nil\n @dont_rename_initialize = false\n @token_stream = nil\n @calls_super = false\n @superclass_method = nil\n end", "def get_declaration(cls, bld, funItem)\n eqString = String.new\n\n bld.add(Utils.instance.getStyledClassName(cls.getUName()))\n bld.sameLine(\"(const \" + Utils.instance.getStyledClassName(cls.getUName()))\n bld.sameLine(\"& src\" + Utils.instance.getStyledClassName(cls.getUName()) + \");\")\n\n bld.add(\"const \" + Utils.instance.getStyledClassName(cls.getUName()))\n bld.sameLine(\"& operator=\" + \"(const \" + Utils.instance.getStyledClassName(cls.getUName()))\n bld.sameLine(\"& src\" + Utils.instance.getStyledClassName(cls.getUName()) + \");\\n\")\n end", "def get_definition(codeClass, outCode)\n outCode.indent\n\n outCode.add(\"/**\")\n outCode.add(\"* Creates an insert statement for this classes data\")\n outCode.add(\"*/\")\n\n outCode.add(\"public function genInsert($cellString, $curCellIndex)\")\n outCode.add(\"{\");\n \n outCode.add(\" $inserts = \")\n outCode.add('\"INSERT INTO ' << codeClass.name << 'List VALUES (\";')\n # outCode.add(\"'.\\\\n\\\";\")\n \n varNum = 0\n\n# for var in codeClass.variableSection\n# if var.elementId == CodeElem::ELEM_VARIABLE\n# \n# if XCTEPhp::Utils::isPrimitive(var)\n# conDef << \" case \" << varNum.to_s << \": $this->dataSet['\" << var.name << \"'] = \"\n# conDef << \"$cellString; break;\") \n# else\n# conDef << \" case \" << varNum.to_s << \": $this->dataSet['\" << var.name << \"'] = \"\n# conDef << \"new \" << var.vtype << \"($cellString); break;\") \n# end \n# \n# varNum = varNum + 1;\n# end\n# end\n \n \n outCode.add(\"}\");\n\n return(conDef);\n end", "def definition\n super\n end", "def definition\n super\n end", "def initialize name, s4_class, args, filename\n if name == 'func_'\n raise ArgumentError,\n \"name cannot be 'func_' (#{s4_class}, #{args}, #{filename})\"\n end\n @name, @s4_class = name.sub(/^`([^`]+)`$/, \"\\\\1\"), s4_class\n @s4_class = @s4_class.scan(/[\\w.]+/).select { |x| x != 'c' }.join(\",\")\n @args = args.sub(/\\{\\s*$/m, '').sub(/\\s*\\w+@.*/m, '')\n @filename, @rdfile = filename.to_s, nil\n end", "def get_construction_name()\n get_keyword_value(\"CONSTRUCTION\")\n end", "def initialize(name)\n self.name = name \n end", "def inspect\n \"#{self.class}(#{parameter})\"\n end", "def inspect\n attributes = [\"seqid=\\\"#{@seqid}\\\"\", \"source=\\\"#{@source}\\\"\", \"type=\\\"#{@type}\\\"\", \"strand=\\\"#{@strand}\\\"\"]\n attributes += @attributes.map { |(attribute, value)| \"#{attribute}=\\\"#{value}\\\"\" }\n \n \"#<#{self.class} #{attributes.join(', ')}>\"\n end", "def initialize\n super(TITLE, DESCRIPTION, true)\n end", "def to_s\n \"#<syntax:#{ @name }>\"\n end", "def generate_string(options = {})\n \"##{comment}\\n\"\n end", "def statement()\n\n\n\n # 12:5: class_definition\n class_definition()\n\n\n\n\n end", "def inspect()\n \"#{self.class}:#{@header}\"\n end", "def initialize\n @name = ''\n end", "def to_s\n \"#{self.class.name} #{name}\"\n end", "def inspect\n \"#<#{ self.class.name } (#{ length } x #{ document_class.name })>\"\n end", "def initialize (str=\"UNGAH\")\n\t\t@grunt = str\n\tend", "def description\n Properties[self.class] ||= {}\n return Properties[self.class][:desc] || \"\"\n end", "def inspect\n \"#<#{self.class} #{self}>\"\n end", "def to_s\n unless @to_s then\n target = @klass.kind_of?( Class ) ? \"#{@klass.name}#\" : \"#{@klass.name}.\"\n @to_s = \"#{target}#{@method} defined at #{@file}:#{@line_number}\"\n end\n return @to_s\n end", "def initialize (name)\n @name = name\nend", "def inspect\n \"#<#{self.class} #{to_s}>\"\n end", "def inspect\n \"#<#{self.class} @label=#{label} docs=#{docs}>\"\n end", "def construct\n end", "def initialize(name = '')\n self.name = name\n end", "def inspect\n # Concise to not dump too much information on the dev\n \"#<#{self.class.name}>\"\n end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def to_s\n #\"\\#<#{self.class}-#{@name} - #{@top_dir}>\"\n \"\\#<#{self.class}-#{@name}>\"\n end", "def name() end", "def inspect\n \"#<#{self}>\"\n end", "def inspect\n return \"#<#{@name}:#{@arity}>\"\n end", "def initialize(name = nil)\n \tend", "def initialize(name, prefix,suffix,definition, preferred_form, synonyms = nil)\n @name, @prefix, @suffix, @definition, @preferred_form, @synonyms = name, prefix,suffix,definition,preferred_form, synonyms\n @@all_methods ||= []\n @@all_methods.push self\n end", "def inspect\n relative = directory.relative_path_from(Atlas.data_dir)\n \"#<#{ self.class.name } (#{ @klass.name } at ./#{ relative })>\"\n end", "def to_s\n return \"#<#{self.class.name}>\"\n end" ]
[ "0.7193215", "0.7015597", "0.68123895", "0.6808615", "0.6745797", "0.6610482", "0.6578627", "0.63820237", "0.630252", "0.62772644", "0.62686354", "0.6244232", "0.6216291", "0.61941147", "0.6112199", "0.6097629", "0.6087779", "0.60620534", "0.60224324", "0.6001831", "0.5992851", "0.5987629", "0.5929464", "0.5923127", "0.58946484", "0.58874077", "0.58874077", "0.5879558", "0.5876677", "0.5872558", "0.585901", "0.5851629", "0.58444697", "0.58257776", "0.57643205", "0.5759881", "0.5754877", "0.5742135", "0.57275414", "0.5721334", "0.5709526", "0.57045543", "0.56952864", "0.56887937", "0.5687496", "0.56870794", "0.5675701", "0.5673734", "0.56663924", "0.56652004", "0.56621647", "0.56559634", "0.56446624", "0.56422526", "0.56289846", "0.5626994", "0.56205255", "0.56087935", "0.5605323", "0.5593089", "0.55923474", "0.5586966", "0.5583701", "0.55706716", "0.5569842", "0.55678254", "0.55567086", "0.55466807", "0.55466807", "0.5542514", "0.55394924", "0.5535711", "0.55272835", "0.55257875", "0.5523634", "0.5523019", "0.55219734", "0.55162656", "0.5515544", "0.55116236", "0.55110896", "0.55080706", "0.55070144", "0.55015534", "0.5501042", "0.54991573", "0.54965097", "0.549606", "0.5492178", "0.549163", "0.5491516", "0.5490578", "0.54904914", "0.54854923", "0.5482264", "0.5482218", "0.54802155", "0.5477717", "0.54729044", "0.5470755", "0.54652965" ]
0.0
-1
the mutation method _obj is parent object, which in this case is nil args are the arguments passed _ctx is the GraphQL context (which would be discussed later)
def call(_obj, args, ctx) if ctx[:current_user].blank? raise GraphQL::ExecutionError.new("Authentication required.") else user = User.find_by(id: ctx[:current_user][:id]) end if args[:name].blank? error = GraphQL::ExecutionError.new("This field is required.", options: { field: "name_field" } ) ctx.add_error(error) end if args[:email].blank? error = GraphQL::ExecutionError.new("This field is required.", options: { field: "email_field" } ) ctx.add_error(error) end if args[:message].blank? error = GraphQL::ExecutionError.new("This field is required.", options: { field: "message_field" } ) ctx.add_error(error) end if args[:category].blank? error = GraphQL::ExecutionError.new("This field is required.", options: { field: "category_field" } ) ctx.add_error(error) end accepted_categories = ['Employment Opportunities', 'General Questions', 'Suggestion', 'Something Else'] if error.present? raise GraphQL::ExecutionError.new(ctx.errors) end mail = Mail.new mail.from = Email.new(email: '[email protected]') mail.subject = 'Inquiry - James Gallagher' personalization = Personalization.new personalization.add_to(Email.new(email: args[:email])) personalization.add_substitution(Substitution.new(key: '-name-', value: args[:name])) mail.add_personalization(personalization) mail.template_id = '13b8f94f-bcae-4ec6-b752-70d6cb59f932' sg = SendGrid::API.new(api_key: "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") begin response = sg.client.mail._("send").post(request_body: mail.to_json) rescue Exception => e puts e.message end Inquiry.create!( name: args[:name], email: args[:email], message: args[:message], category: args[:category] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @mutation_context = args[:mutation_context] if args.key?(:mutation_context)\n end", "def update!(**args)\n @mutation_context = args[:mutation_context] if args.key?(:mutation_context)\n end", "def update!(**args)\n @mutation_context = args[:mutation_context] if args.key?(:mutation_context)\n end", "def call(_obj, args, ctx)\n # Check if product id is valid\n product = Product.find_by(id: args[:product_id])\n unless product\n raise GraphQL::ExecutionError.new(\"Product not found\")\n end \n\n # Check if the product quantity wanted is valid\n unless (args[:quantity] <= product[:inventory_count])\n raise GraphQL::ExecutionError.new(\n \"Given quantity exceeds avalibale quantity of #{\n product[:inventory_count]\n }\")\n end \n\n unless (args[:quantity] <= 0)\n raise GraphQL::ExecutionError.new(\"Cannot add a negative or error quantity\")\n end \n\n # Get the current User's Cart\n cart = Cart.find_by(user: ctx[:current_user])\n unless cart\n raise GraphQL::ExecutionError.new(\"User's Cart not found\")\n end\n\n # Check if Product to be added is already in User's Cart\n cartProduct = CartsProducts.find_by(cart: cart, product: product)\n\n # Calculate cost of products\n cost = args[:quantity] * product[:price]\n \n # Update current User's Cart infomation\n new_count = args[:quantity] + cart[:product_count]\n new_price = cost + cart[:total_price]\n cart.update(\n total_price: new_price,\n product_count: new_count\n )\n\n # Check if prdocut exsit in the User's Cart\n if cartProduct\n # Update new quanities of existing Product in Cart\n cartProduct.update(\n quantity: cartProduct[:quantity] + args[:quantity],\n cost: cartProduct[:cost] + cost\n )\n return cartProduct\n else\n # Add Product to Cart\n CartsProducts.create!(\n cart: cart,\n product: product,\n quantity: args[:quantity],\n cost: cost\n )\n end\n\n # Catch all validation errors\n rescue ActiveRecord::RecordInvalid => e\n GraphQL::ExecutionError.new(\"Invalid input: #{\n e.record.errors.full_messages.join(', ')\n }\")\n end", "def call(obj, args, ctx)\n\n\n post = Post.find(args[:post_id])\n\n post.votes += 1\n post.save\n\n post\n rescue ActiveRecord::RecordNotFound => e\n GraphQL::ExecutionError.new(\"No Post with ID #{args[:post_id]} found.\")\n rescue ActiveRecord::RecordInvalid => e\n GraphQL::ExecutionError.new(\"Invalid input: #{e.record.errors.full_messages.join(', ')}\")\n end", "def execute(*args)\n puts 'running mutation business logic'\n puts \"name = #{name}\"\n puts \"The Recipe is #{recipe&.name}\"\n\n # Do other logic\n\n end", "def call(_obj, args, ctx)\n if !Authentication::editor_is_valid(ctx)\n return GraphQL::ExecutionError.new(\"Invalid user token. Please log in.\")\n end\n\n if !!args[\"is_published\"] && !Authentication::admin_is_valid(ctx)\n return GraphQL::ExecutionError.new(\"Invalid user token. Please log in.\")\n end\n\n @article = Article.find(args[\"id\"])\n\n # Transaction so that we don't update a malformed article\n Article.transaction do\n @article.title = args[\"title\"] if args[\"title\"]\n @article.section_id = args[\"section_id\"] if args[\"section_id\"]\n @article.content = args[\"content\"] if args[\"content\"]\n @article.preview = args[\"summary\"] if args[\"summary\"]\n @article.created_at = args[\"created_at\"] if args[\"created_at\"]\n @article.volume = args[\"volume\"] if args[\"volume\"]\n @article.issue = args[\"issue\"] if args[\"issue\"]\n @article.is_published = args[\"is_published\"] if args[\"is_published\"]\n\n if args[\"outquotes\"]\n @article.outquotes.clear\n args[\"outquotes\"].each do |text|\n @article.outquotes.build(text: text)\n end\n end\n\n if args[\"contributors\"]\n @article.contributors.clear\n args[\"contributors\"].each do |id|\n Authorship.find_or_create_by(user_id: id, article_id: @article.id)\n\n # Adds contributor role to user if not yet present\n u = User.find_by(id: id)\n u.roles << Role.first unless u.nil? || u.roles.include?(Role.first)\n end\n end\n\n if args[\"media_ids\"] then\n args[\"media_ids\"].each do |medium|\n @medium = Medium.find_by(id: medium)\n @article.media << @medium if @medium\n end\n end\n \n Authentication::generate_new_header(ctx) if @article.save\n end\n return @article\n end", "def call(_obj, args, ctx)\n if ctx[:current_user].blank?\n raise GraphQL::ExecutionError.new(\"Authentication required.\")\n else\n user = User.find_by(id: ctx[:current_user][:id])\n end\n\n post = Post.where(slug: args[:slug]).first\n\n if user.admin != true\n raise GraphQL::ExecutionError.new(\"You do not have access to this resource.\")\n end\n\n if args[:title].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"title_field\" } )\n\t ctx.add_error(error)\n end\n if args[:slug].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"slug_field\" } )\n\t ctx.add_error(error)\n end\n if args[:status].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"status_field\" } )\n\t ctx.add_error(error)\n end\n if args[:description].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"description_field\" } )\n\t ctx.add_error(error)\n end\n if args[:body].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"body_field\" } )\n\t ctx.add_error(error)\n end\n if args[:feature_image].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"feature_image_field\" } )\n\t ctx.add_error(error)\n end\n\n accepted_status = ['Published', 'Unpublished']\n\n if accepted_status.exclude?(args[:status])\n error = GraphQL::ExecutionError.new(\"This status is invalid.\", options: { field: \"status_field\" } )\n\t ctx.add_error(error)\n end\n\n if post.present?\n error = GraphQL::ExecutionError.new(\"This slug has been used.\", options: { field: \"slug_field\" } )\n\t ctx.add_error(error)\n end\n\n if error.present?\n raise GraphQL::ExecutionError.new(ctx.errors)\n end\n\n post = Post.create!(\n title: args[:title],\n slug: args[:slug],\n status: args[:status],\n body: args[:body],\n category: args[:category],\n feature_image: args[:feature_image],\n description: args[:description],\n user: user\n )\n\n tags = args[:tags].split(',')\n\n for t in tags\n Tag.create!(\n title: t,\n project_id: post.id,\n status: \"Project\"\n )\n end\n return post\n rescue ActiveRecord::RecordInvalid => e\n GraphQL::ExecutionError.new(\"Invalid input: #{e.record.errors.full_messages.join(', ')}\")\n end", "def mutation_method(meth, *args, &block)\n copy = send(meth, *args, &block)\n @opts.merge!(copy.opts)\n self\n end", "def call(_obj, args, ctx)\n if !Authentication::editor_is_valid(ctx) or !Authentication::admin_is_valid(ctx)\n return GraphQL::ExecutionError.new(\"Invalid user token. Please log in.\")\n end\n \n @user = User.find(args[\"id\"])\n\n # Transaction so that we don't update a malformed user\n User.transaction do\n @user.first_name = args[\"first_name\"] if args[\"first_name\"]\n @user.last_name = args[\"last_name\"] if args[\"last_name\"]\n @user.email = args[\"email\"] if args[\"email\"]\n @user.description = args[\"description\"] if args[\"description\"] \n @user.profile_picture = args[\"attachment\"] if args[\"attachment\"]\n if args[\"first_name\"] or args[\"last_name\"]\n save = \"-\" + @user.slug.split(\"-\")[-1]\n save = \"\" if save =~ /\\d/ else save\n @user.slug = args[\"first_name\"].downcase + \"-\" + args[\"last_name\"].downcase + save\n end\n role = Role.find_by(title: args[\"role\"])\n if args[\"role\"] and role != nil and [email protected]?(role)\n @user.roles << role\n end\n Authentication::generate_new_header(ctx) if @user.save!\n end\n return @user\n end", "def call(obj, args, ctx)\n @inner_proc.call(obj, args, ctx) if @inner_proc && !@inner_proc.is_a?(GraphQL::Field::Resolve::BuiltInResolve)\n\n events = ctx.namespace(:subscriptions)[:events]\n\n if events\n # This is the first execution, so gather an Event\n # for the backend to register:\n events << Subscriptions::Event.new(\n name: ctx.field.name,\n arguments: args,\n context: ctx,\n )\n ctx.skip\n elsif ctx.irep_node.subscription_topic == ctx.query.subscription_topic\n # The root object is _already_ the subscription update:\n if obj.is_a?(GraphQL::Schema::Object)\n obj.object\n else\n obj\n end\n else\n # This is a subscription update, but this event wasn't triggered.\n ctx.skip\n end\n end", "def transform_Object(o, scope)\n raise IllegalRelationshipOperandError.new(o)\n end", "def call(_obj, args, ctx)\n\t\tif ctx[:current_user].blank?\n raise GraphQL::ExecutionError.new(\"Authentication required.\")\n else\n user = User.find_by(id: ctx[:current_user][:id])\n end\n\n project = Project.find_by(slug: args[:slug]).first\n\n if user.admin != true\n raise GraphQL::ExecutionError.new(\"You do not have access to this resource.\")\n end\n\n if project.blank?\n error = GraphQL::ExecutionError.new(\"This project does not exist.\", options: { field: \"notification\" } )\n\t ctx.add_error(error)\n end\n\n if args[:title].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"title_field\" } )\n\t ctx.add_error(error)\n end\n if args[:slug].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"slug_field\" } )\n\t ctx.add_error(error)\n end\n if args[:status].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"status_field\" } )\n\t ctx.add_error(error)\n end\n if args[:description].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"description_field\" } )\n\t ctx.add_error(error)\n end\n if args[:caption].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"caption_field\" } )\n\t ctx.add_error(error)\n end\n if args[:milestones].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"milestones_field\" } )\n\t ctx.add_error(error)\n end\n if args[:repo_url].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"repo_url_field\" } )\n\t ctx.add_error(error)\n end\n if args[:category].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"category_field\" } )\n\t ctx.add_error(error)\n end\n if args[:feature_image].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"feature_image_field\" } )\n\t ctx.add_error(error)\n end\n if args[:project_url].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"project_url_field\" } )\n\t ctx.add_error(error)\n end\n if args[:technical_information].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"technical_information_field\" } )\n\t ctx.add_error(error)\n end\n\n if project.blank?\n error = GraphQL::ExecutionError.new(\"This project does not exist.\", options: { field: \"slug_field\" } )\n\t ctx.add_error(error)\n end\n\n if error.present?\n raise GraphQL::ExecutionError.new(ctx.errors)\n end\n\n project.title = args[:title]\n project.slug = args[:slug]\n project.status = args[:status]\n project.description = args[:description]\n project.caption = args[:caption]\n project.milestones = args[:milestones]\n project.repo_url = args[:repo_url]\n project.category = args[:category]\n project.feature_image = args[:feature_image]\n project.project_url = args[:project_url]\n project.technical_information = args[:technical_information]\n project.save!\n current_tags = Tag.where(post_id: post.id, status: \"Blog\")\n current_tags.destroy!\n\n tags = args[:tags].split(',')\n\n for t in tags\n Tag.create!(\n title: t[:title],\n post_id: post.id\n )\n end\n\n return project\n rescue ActiveRecord::RecordInvalid => e\n GraphQL::ExecutionError.new(\"Invalid input: #{e.record.errors.full_messages.join(', ')}\")\n end", "def call(_obj, args, ctx)\n\t\tif ctx[:current_user].blank?\n raise GraphQL::ExecutionError.new(\"Authentication required.\")\n else\n user = User.find_by(id: ctx[:current_user][:id])\n end\n\n comment = Comment.find_by(id: args[:comment_id], slug: args[:slug], status: args[:status])\n\n if comment.blank?\n raise GraphQL::ExecutionError.new(\"This comment does not exist.\", options: { field: \"notification\" } )\n end\n\n if comment.user_id != user.id && user.admin == false\n raise GraphQL::ExecutionError.new(\"You do not have permission to edit this comment.\", options: { field: \"notification\" } )\n end\n\n if args[:comment_id].blank?\n error = GraphQL::ExecutionError.new(\"Please include the comment ID.\", options: { field: \"notification\" } )\n\t ctx.add_error(error)\n end\n\n if args[:project_id].blank?\n error = GraphQL::ExecutionError.new(\"Please include the project ID.\", options: { field: \"notification\" } )\n\t ctx.add_error(error)\n end\n\n if error.present?\n raise GraphQL::ExecutionError.new(ctx.errors)\n end\n\n comment.destroy!\n return comment\n rescue ActiveRecord::RecordInvalid => e\n GraphQL::ExecutionError.new(\"Invalid input: #{e.record.errors.full_messages.join(', ')}\")\n end", "def get_new_obj(obj, type='query')\n tmp_obj = self.new\n tmp_obj.send 'object'.to_sym, \"{#{obj['object'].to_s}}\"\n tmp_obj.send 'source_id'.to_sym, get_source_id\n tmp_obj.send 'update_type'.to_sym, type\n tmp_obj\n end", "def update!(**args)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @object = args[:object] if args.key?(:object)\n end", "def updateObjectTree _args\n \"updateObjectTree _args;\" \n end", "def mutation(name = nil, &block)\n Mutation.new(name, &block)\n end", "def update!(**args)\n @original_object = args[:original_object] if args.key?(:original_object)\n end", "def editObject _obj, _args\n \"_obj editObject _args;\" \n end", "def update!(**args)\n @is_negation = args[:is_negation] if args.key?(:is_negation)\n @obj = args[:obj] if args.key?(:obj)\n @pred = args[:pred] if args.key?(:pred)\n @provenance = args[:provenance] if args.key?(:provenance)\n @qualifier_sets = args[:qualifier_sets] if args.key?(:qualifier_sets)\n @sub = args[:sub] if args.key?(:sub)\n end", "def parent=(obj); end", "def reveal _obj, _args\n \"_obj reveal _args;\" \n end", "def update_from_parent(update)\n raise %{\n This method must be implemented in your data object\n class if you plan to pass updates from a\n parent object to the members of its\n collections.\n }\n end", "def apply(input_text)\n if input_text =~ /GraphQL::Relay::Mutation\\.define/\n named_proc_processor = apply_processor(input_text, ProcToClassMethodTransform::NamedProcProcessor.new(@proc_name))\n resolve_proc_processor = apply_processor(input_text, ResolveProcToMethodTransform::ResolveProcProcessor.new)\n proc_body = input_text[named_proc_processor.proc_body_start..named_proc_processor.proc_body_end]\n method_defn_indent = \" \" * named_proc_processor.proc_defn_indent\n\n obj_arg_name, args_arg_name, ctx_arg_name = resolve_proc_processor.proc_arg_names\n # This is not good, it will hit false positives\n # Should use AST to make this substitution\n if obj_arg_name != \"_\"\n proc_body.gsub!(/([^\\w:.]|^)#{obj_arg_name}([^\\w:]|$)/, '\\1object\\2')\n end\n if ctx_arg_name != \"_\"\n proc_body.gsub!(/([^\\w:.]|^)#{ctx_arg_name}([^\\w:]|$)/, '\\1context\\2')\n end\n\n method_defn = \"def #{@proc_name}(**#{args_arg_name})\\n#{method_defn_indent} #{proc_body}\\n#{method_defn_indent}end\\n\"\n method_defn = trim_lines(method_defn)\n # Update usage of args keys\n method_defn = method_defn.gsub(/#{args_arg_name}(?<method_begin>\\.key\\?\\(?|\\[)[\"':](?<arg_name>[a-zA-Z0-9_]+)[\"']?(?<method_end>\\]|\\))?/) do\n method_begin = $~[:method_begin]\n arg_name = underscorize($~[:arg_name])\n method_end = $~[:method_end]\n \"#{args_arg_name}#{method_begin}:#{arg_name}#{method_end}\"\n end\n # replace the proc with the new method\n input_text[named_proc_processor.proc_defn_start..named_proc_processor.proc_defn_end] = method_defn\n end\n input_text\n end", "def update!(**args)\n @parent = args[:parent] if args.key?(:parent)\n @permission = args[:permission] if args.key?(:permission)\n end", "def obj_change(obj,klass)\n #raise_if_obj_is_not obj , klass\n session do \n # raise_if_transaction_running\n cmd = klass.to_s.split(\"::\").last.downcase\n transaction do\n self.send(\"#{cmd}_delete\", obj)\n self.send(\"#{cmd}_create\", obj)\n end\n obj_pull obj, klass\n end\n end", "def mod _obj, _args\n \"_obj mod _args;\" \n end", "def obj\n return @args[:obj]\n end", "def update!(**args)\n @metadata = args[:metadata] if args.key?(:metadata)\n @temporary_data = args[:temporary_data] if args.key?(:temporary_data)\n @vertex = args[:vertex] if args.key?(:vertex)\n end", "def setSide _obj, _args\n \"_obj setSide _args;\" \n end", "def set _obj, _args\n \"_obj set _args;\" \n end", "def call(_obj, args, _ctx)\n\n update_table = Table.find(args[:table_id])\n return update_table if update_table.update_attributes(name: args[:name], quantity: args[:quantity])\n GraphQL::ExecutionError.new(\"invalid data\")\n end", "def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end", "def call(_obj, args, _ctx)\n\n update_table = User.find(args[:user_id])\n return update_table if update_table.update_attributes(name: args[:name], email: args[:email], password: args[:password])\n GraphQL::ExecutionError.new(\"invalid data\")\n end", "def evalObjectArgument _obj, _args\n \"_obj evalObjectArgument _args;\" \n end", "def call(_obj, args, ctx)\n if !Authentication::editor_is_valid(ctx)\n return GraphQL::ExecutionError.new(\"Invalid user token. Please log in.\")\n end\n\n ActiveRecord::Base.transaction do\n media_type = args[\"media_type\"]\n if media_type != \"illustration\" && media_type != \"photo\"\n return GraphQL::ExecutionError.new(\n \"#{media_type} is currently unsupported\"\n )\n end\n\n if media_type == \"illustration\"\n roleTitle = \"Illustrator\"\n else \n roleTitle = \"Photographer\"\n end\n role = Role.find_by(title: roleTitle)\n\n profile = Profile.find_or_create_by(\n role_id: role.id,\n user_id: args[\"user_id\"]\n )\n\n @medium = Medium.new(\n title: args[\"title\"],\n article_id: args[\"article_id\"],\n profile_id: profile.id,\n is_featured: args[\"is_featured\"] || false,\n caption: args[\"caption\"],\n media_type: args[\"media_type\"],\n attachment: args[\"attachment\"],\n )\n Authentication::generate_new_header(ctx) if @medium.save!\n end\n return @medium\n end", "def mutation_for(index)\n @mutations[index] ||= OpenStruct.new(indexes: [], deletes: [])\n end", "def ready?(**args)\n # Called with mutation args.\n # Use keyword args such as employee_id: or **args to collect them\n if context[:current_user].nil?\n raise GraphQL::ExecutionError, \"Only logged users can run this mutation\"\n else\n true\n end\n end", "def inflame _obj, _args\n \"_obj inflame _args;\" \n end", "def apiMutation(mutation, vars)\n query = \"mutation(#{vars.map{|name, pair| \"$#{name}: #{pair[0]}\"}.join(\", \")}) { #{mutation} }\"\n varHash = Hash[vars.map{|name,pair| [name.to_s, pair[1]]}]\n headers = { 'Content-Type' => 'application/json' }\n headers['Privileged'] = ENV['ESCHOL_PRIV_API_KEY'] or raise(\"missing env ESCHOL_PRIV_API_KEY\")\n response = HTTParty.post($api_url, :headers => headers, :body => { variables: varHash, query: query }.to_json)\n response.code == 200 or raise(\"Internal error (graphql): HTTP code #{response.code}\")\n response['errors'] and raise(\"Internal error (graphql): #{response['errors'][0]['message']}\")\n response['data']\nend", "def update!(**args)\n @content = args[:content] if args.key?(:content)\n @derived_struct_data = args[:derived_struct_data] if args.key?(:derived_struct_data)\n @id = args[:id] if args.key?(:id)\n @json_data = args[:json_data] if args.key?(:json_data)\n @name = args[:name] if args.key?(:name)\n @parent_document_id = args[:parent_document_id] if args.key?(:parent_document_id)\n @schema_id = args[:schema_id] if args.key?(:schema_id)\n @struct_data = args[:struct_data] if args.key?(:struct_data)\n end", "def cutObj _obj, _args\n \"_obj cutObj _args;\" \n end", "def mutation(query:)\n path = '/graphql/mutation'\n\n if query.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"query\"')\n end\n\n params = {\n query: query,\n }\n \n headers = {\n \"x-sdk-graphql\": 'true',\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n )\n end", "def call(_obj, args, _ctx)\n unless args[:price]\n raise GraphQL::ExecutionError.new('Price cannot be negative')\n end\n\n unless args[:inventory_count]\n raise GraphQL::ExecutionError.new('Product cnnot have negative inventory')\n end\n\n # Create new Product\n Product.create!(\n title: args[:title],\n price: args[:price],\n inventory_count: args[:inventory_count],\n )\n\n # Catch all validation errors\n rescue ActiveRecord::RecordInvalid => e\n GraphQL::ExecutionError.new(\"Invalid input: #{\n e.record.errors.full_messages.join(', ')\n }\")\n end", "def glanceAt _obj, _args\n \"_obj glanceAt _args;\" \n end", "def update!(**args)\n @child_link = args[:child_link] if args.key?(:child_link)\n @created = args[:created] if args.key?(:created)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @permissions = args[:permissions] if args.key?(:permissions)\n @self_link = args[:self_link] if args.key?(:self_link)\n @starred = args[:starred] if args.key?(:starred)\n @updated = args[:updated] if args.key?(:updated)\n end", "def args\n [object, transition]\n end", "def update(args = {})\n object\n end", "def update!(**args)\n @parent = args[:parent] if args.key?(:parent)\n @pipeline_job = args[:pipeline_job] if args.key?(:pipeline_job)\n @pipeline_job_id = args[:pipeline_job_id] if args.key?(:pipeline_job_id)\n end", "def update!(**args)\n @city_objects = args[:city_objects] if args.key?(:city_objects)\n @transform = args[:transform] if args.key?(:transform)\n @vertex_xyz = args[:vertex_xyz] if args.key?(:vertex_xyz)\n end", "def tvData _obj, _args\n \"_obj tvData _args;\" \n end", "def skill _obj, _args\n \"_obj skill _args;\" \n end", "def update_from_object(obj)\n\t\tfor to_type,fields in [[\"to_block_length\",%w{x y z stance}],[\"to_rotation_in_degrees\",%w{yaw pitch}],[\"to_i\",[\"is_on_ground\"]]]\n\t\t\tfor field in fields do\n\t\t\t\t#puts \"checking field #{field}\"\n\t\t\t\tif obj.respond_to?(field)\n\t\t\t\t\tinstance_variable_set(\"@\"+field,obj.send(field).send(to_type))\n\t\t\t\t#\tputs \"\\tset field #{field} to value #{obj.send(field)} enforcing type #{to_type}\"\n\t\t\t\tend\n\t\t\t\t\n\t\t\tend\n\t\tend\n\tend", "def child_post_set_hook( index, object, is_insert = false, parent_array = nil )\n \n return object\n \n end", "def call(_obj, args, _ctx)\n product = Product.find_by(id: args[:product_id])\n cart = ShoppingCart.find_by(user_id: args[:user_id])\n if product.nil?\n raise GraphQL::ExecutionError, \"Product with the product id #{args[:product_id]} does not exist.\"\n end\n existing = cart.cart_items.find_by(product_id: product.id)\n if existing.nil?\n cart.cart_items.create(product_id: product.id, quantity: args[:quantity])\n cart.completed = false\n puts cart.cart_items\n else\n existing.quantity += args[:quantity]\n cart.completed = false\n cart.save\n existing.save\n end\n cart.total_cost += product.price * args[:quantity] + product.shipping\n cart.save\n cart\n end", "def commandFSM _obj, _args\n \"_obj commandFSM _args;\" \n end", "def update!(**args)\n @bucket = args[:bucket] if args.key?(:bucket)\n @generation = args[:generation] if args.key?(:generation)\n @object = args[:object] if args.key?(:object)\n end", "def update\n @mutation = Mutation.find(params[:id])\n\n respond_to do |format|\n if @mutation.update_attributes(params[:mutation])\n format.html { redirect_to @mutation, notice: 'Mutation was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mutation.errors, status: :unprocessable_entity }\n end\n end\n end", "def internal_object_update(params)\n end", "def internal_object_update(params)\n end", "def update!(**args)\n @object_version = args[:object_version] if args.key?(:object_version)\n @original_object = args[:original_object] if args.key?(:original_object)\n end", "def skillFinal _obj, _args\n \"_obj skillFinal _args;\" \n end", "def update!(**args)\n @bucket_id = args[:bucket_id] if args.key?(:bucket_id)\n @obj_id = args[:obj_id] if args.key?(:obj_id)\n end", "def put(obj)\n end", "def setObjectArguments _obj, _args\n \"_obj setObjectArguments _args;\" \n end", "def call(_obj, args, _ctx)\n create_table = Table.new(\n name: args[:name],\n quantity: args[:quantity],\n )\n return create_table if create_table.save\n GraphQL::ExecutionError.new(\"invalid data\")\n end", "def object=(_arg0); end", "def object=(_arg0); end", "def object=(_arg0); end", "def object=(_arg0); end", "def revealMine _obj, _args\n \"_obj revealMine _args;\" \n end", "def call(obj, args, ctx)\n parent = ctx.object\n nodes = @resolve_proc.call(obj, args, ctx)\n if ctx.schema.lazy?(nodes)\n nodes\n else\n nodes.map { |item| @edge_class.new(item, parent) }\n end\n end", "def sideChat _obj, _args\n \"_obj sideChat _args;\" \n end", "def update!(**args)\n @initiator_id = args[:initiator_id] if args.key?(:initiator_id)\n @mutations = args[:mutations] if args.key?(:mutations)\n end", "def raw_value(obj)\n GraphQL::Execution::Interpreter::RawValue.new(obj)\n end", "def *(obj)\n if obj.kind_of?(Quaternion)\n concatenate(obj)\n else\n transform(obj)\n end\n end", "def exec _obj, _args\n \"_obj exec _args;\" \n end", "def initialize(mutation, view, data)\n @mutation = mutation\n @view = view\n @data = data\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def create\n @mutation = Mutation.new(params[:mutation])\n\n respond_to do |format|\n if @mutation.save\n format.html { redirect_to @mutation, notice: 'Mutation was successfully created.' }\n format.json { render json: @mutation, status: :created, location: @mutation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mutation.errors, status: :unprocessable_entity }\n end\n end\n end", "def call(object); end", "def update!(**args)\n @child = args[:child] if args.key?(:child)\n @label = args[:label] if args.key?(:label)\n @phrase = args[:phrase] if args.key?(:phrase)\n end", "def update!(**args)\n @child = args[:child] if args.key?(:child)\n end", "def update!(**args)\n @child = args[:child] if args.key?(:child)\n end", "def update!(**args)\n @child = args[:child] if args.key?(:child)\n end", "def call(obj, args, ctx)\r\n \r\n puts(\"LALALALAL\", ctx, ctx[:current_user],ctx[:session].values(),ctx[:session][:token])\r\n puts(\"args:\", args, args[:token], args[:user])\r\n Ride.create!(\r\n #description: args[:description],\r\n #url: args[:url],\r\n from: args[:from],\r\n to: args[:to],\r\n date: args[:date],\r\n current_seats: args[:current_seats],\r\n max_seats: args[:max_seats],\r\n client_ids: args[:client_ids],\r\n user: ctx[:current_user]#AuthToken.user_from_token(ctx)#\r\n )\r\n rescue ActiveRecord::RecordInvalid => e\r\n # this would catch all validation errors and translate them to GraphQL::ExecutionError\r\n GraphQL::ExecutionError.new(\"Invalid input: #{e.record.errors.full_messages.join(', ')}\")\r\n end", "def update!(**args)\n @bucket = args[:bucket] if args.key?(:bucket)\n @generation_number = args[:generation_number] if args.key?(:generation_number)\n @object = args[:object] if args.key?(:object)\n end", "def update\n # checks if user is authorized\n if authorise(request)\n # operation parameter tells what put operation should be done on vertex\n operation = params[:operation]\n case operation\n when 'connection'\n update_connection(params[:from_vertex_id], params[:to_vertex_id])\n when 'transformation'\n update_transformation(params[:id], params[:pos_x], params[:pos_y], params[:width],\n params[:height], params[:z_index])\n when 'attribute'\n update_attribute(params[:id], params[:name], params[:estimated_time], params[:clue],\n params[:description])\n else\n render json: { success: false, message: 'Operation does not exist' }, status: :bad_request\n end\n else\n render json: { success: false, message: 'Unauthorized' }, status: 401\n end\n end", "def update!(**args)\n @object_location = args[:object_location] if args.key?(:object_location)\n end", "def update!(**args)\n @agent = args[:agent] if args.key?(:agent)\n @create_time = args[:create_time] if args.key?(:create_time)\n @human_review = args[:human_review] if args.key?(:human_review)\n @id = args[:id] if args.key?(:id)\n @parent = args[:parent] if args.key?(:parent)\n @parent_ids = args[:parent_ids] if args.key?(:parent_ids)\n @processor = args[:processor] if args.key?(:processor)\n end", "def update!(**args)\n @normalized_vertices = args[:normalized_vertices] if args.key?(:normalized_vertices)\n @vertices = args[:vertices] if args.key?(:vertices)\n end", "def setFriend _obj, _args\n \"_obj setFriend _args;\" \n end", "def update!(**args)\n @entity = args[:entity] if args.key?(:entity)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @permissions = args[:permissions] if args.key?(:permissions)\n @self_link = args[:self_link] if args.key?(:self_link)\n @user_ref = args[:user_ref] if args.key?(:user_ref)\n end", "def commandFollow _obj, _args\n \"_obj commandFollow _args;\" \n end", "def moveTo _obj, _args\n \"_obj moveTo _args;\" \n end", "def emit_send_remove_mutation\n array = node.arguments.array\n return unless array.length == 1\n emit(array.first)\n end", "def ppEffectCommit _obj, _args\n \"_obj ppEffectCommit _args;\" \n end", "def obj_manipulate(*args,&block)\n obj,klass,member = args\n manipulator = Brocade::SAN::Provisioning::ObjectManipulator.new\n # block can define checks and in_session handlers\n yield manipulator\n # standard template follows\n # check if class is proper\n raise_if_obj_is_not obj , klass\n # run run check block - should contain checks not requiring session -> switch access\n manipulator.run_checks\n # starting session\n session do\n # standard transaction check\n raise_if_transaction_running\n # run block defined in in_session block\n manipulator.run_session\n # returns the fresh object\n obj_pull(obj,klass)\n end\n end" ]
[ "0.65596694", "0.65596694", "0.65596694", "0.5902132", "0.5861612", "0.580183", "0.5696194", "0.56958014", "0.5448331", "0.5357971", "0.5352801", "0.5303301", "0.52614623", "0.5225044", "0.5191746", "0.5154176", "0.5154176", "0.5144797", "0.51191396", "0.5087069", "0.50791335", "0.50654924", "0.50194925", "0.50092256", "0.5008178", "0.5007834", "0.5005547", "0.50009716", "0.49927032", "0.49865505", "0.49761164", "0.49603167", "0.49255115", "0.49065635", "0.49035797", "0.48940772", "0.4893279", "0.48907775", "0.48906788", "0.48647186", "0.4848691", "0.48382723", "0.48373228", "0.48243615", "0.48183605", "0.48036993", "0.47954038", "0.47933286", "0.47874862", "0.47736907", "0.47736236", "0.47703907", "0.47675547", "0.47592846", "0.47576737", "0.47443974", "0.47393104", "0.47371823", "0.47300524", "0.47284338", "0.47249043", "0.47249043", "0.47238", "0.47237748", "0.4712754", "0.47097865", "0.47067824", "0.4703213", "0.4700774", "0.4700774", "0.4700774", "0.4700774", "0.4699221", "0.46963558", "0.46945506", "0.468501", "0.46815526", "0.46766394", "0.46763888", "0.46745452", "0.46678627", "0.46678627", "0.4663098", "0.46625164", "0.4661778", "0.46584406", "0.46584406", "0.46584406", "0.46575725", "0.46565986", "0.46509582", "0.46483254", "0.46478325", "0.46397096", "0.4639656", "0.46345615", "0.46168444", "0.46155998", "0.4607045", "0.4595841", "0.45783356" ]
0.0
-1
Adds a remember token in digest form to the database and creates two cookies for the user that logs in.
def remember(user) user.remember cookies.permanent.signed[:user_id] = user.id cookies.permanent[:remember_token] = user.remember_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remember!(cookies)\n cookie_expiration = 10.years.from_now\n cookies[:remember_me] = { :value => \"1\",\n :expires => cookie_expiration }\n self.authorization_token = unique_identifier\n save!\n cookies[:authorization_token] = { :value => authorization_token,\n :expires => cookie_expiration }\n end", "def remember!(cookies)\n cookie_expiration = 10.years.from_now\n cookies[:remember_me] = {:value => \"1\",\n :expires => cookie_expiration}\n self.authorization_token = unique_identifier\n self.save!\n cookies[:authorization_token] = {\n :value => self.authorization_token,\n :expires => cookie_expiration }\n end", "def remember!(cookies)\n cookie_expiration = 14.days.from_now\n cookies[:remember_me] = {:value => \"1\",\n :expires => cookie_expiration}\n self.authorization_token = unique_identifier\n save!\n cookies[:authorization_token] = {:value => authorization_token,\n :expires => cookie_expiration}\n end", "def remember!(cookies)\n cookies[:remember_me] = {:value => \"1\",\n :expires => COOKIE_EXPIRATION }\n \n self.authorization_token = unique_identifier\n self.save!\n cookies[:authorization_token] = {:value => self.authorization_token,\n :expires => COOKIE_EXPIRATION }\n end", "def remember!(cookies)\n\t\tcookie_expiration = 10.years.from_now\n\t\tcookies[:remember_me] = { :value => \"1\",\n\t\t\t\t\t\t\t\t :expires => cookie_expiration}\n\t\tself.authorization_token = secure_unique_identifier \n\t\tsave!\n\t\tcookies[:authorization_token] = {:value => authorization_token,\n\t\t\t\t\t\t\t\t\t\t :expires => cookie_expiration }\n\tend", "def remember(user)\n user.remember # Defined in the User model\n cookies[:user_id] = { value: user.id,\n expires: 20.years.from_now.utc }\n\n cookies[:remember_token] = { value: user.remember_token,\n expires: 20.years.from_now.utc }\n end", "def remember(user)\n#goes to remember method in user.rb and returns user.remember_token, and saves hashed one\n user.remember\n# saves users id\n cookies.permanent.signed[:user_id]=user.id\n# saves users cookies token\n cookies.permanent[:remember_token]=user.remember_token\n end", "def login_from_cookie\nuser = cookies[:auth_token] && User.find_by_remember_token(cookies[:auth_token])\nif user && user.remember_token?\ncookies[:auth_token] = { :value => user.remember_token, :expires => user.remember_token_expires_at }\nself.current_user = user\nend\nend", "def set_cookie\n self.current_user.remember\n cookies[:auth_token] = { \n :value => self.current_user.remember_token, \n :expires => self.current_user.remember_token_expires_at }\n end", "def remember\n # store virtually the new token\n self.remember_token = User.new_token\n # save the hash digest of the token on the database\n self.update_attribute(:remember_digest, User.digest(self.remember_token))\n end", "def remember\n self.remember_token = User.new_token\n # Writes token to db\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def add_token_to_cookie(cookies)\n token = SecureRandom.urlsafe_base64()\n @user.update(token: token)\n cookies['token'] = token\n create_return_object()\n end", "def remember(user) \n user.remember # the method creates remember_token for that user and saves the hashed the version in the db \n cookies.permanent.signed[:user_id] = user.id # This stores the user.ID(encrypted) in the browser cookie\n cookies.permanent[:remember_token] = user.remember_token # This stores the remember token(encrypted) in the cookie \n # the remember token was created in the first line of code \"user.remember\"\n end", "def remember\n self.remember_token = User.new_token\n self.remember_digest = User.digest(self.remember_token)\n update_attribute(:remember_digest, self.remember_digest) #for new user, this creates record\n end", "def remember\n self.remember_token_expires_at = 1.weeks.from_now.utc\n self.remember_token = Cryptography.encrypt_with_salt(\n SecureRandom.hex(10),\n remember_token_expires_at)\n save(false)\n end", "def remember\n self.remember_token = User.new_token\n update remember_digest: User.digest(remember_token)\n end", "def remember\n self.remember_token = User.new_token\n # encrypt remember_token and save it in :remember_digest field in db\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember(user)\n user.save_remember_digest\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember # call remember method from User model class\n # places these two cookies on the browser\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\nend", "def remember(user)\n\t\tuser.remember #generate remember token and save digest to db\n\t\tcookies.permanent.signed[:user_id] = user.id #create permanent cookie for user id\n\t\tcookies.permanent[:remember_token] = user.remember_token #remember token\n\tend", "def create_remember_token\n self.remember_token = User.digest(User.new_remember_token)\n end", "def remember\n # Give the user a remember_me token string\n self.remember_token = User.new_token\n\n # Store the digest of the remember_token in the user model\n update_attribute(:remember_digest, User.digest(self.remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = Incline::User::new_token\n update_attribute(:remember_digest, Incline::User::digest(self.remember_token))\n end", "def remember\n self.remember_token = User.newtoken\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember(remember_token)\n remember_digest = BCrypt::Password.create(remember_token)\n self.update(remember_digest: remember_digest)\n\tend", "def remember(user)\n # generates the remember token and saves it's digest to the db\n user.remember\n # sets a cookies to expire 20 years from now (.permanent) and securely encrypts it (.signed)\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_token_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end" ]
[ "0.77533257", "0.77488613", "0.773324", "0.7685765", "0.7661955", "0.76143205", "0.760548", "0.7587984", "0.75822616", "0.7577065", "0.7541134", "0.75278544", "0.75133455", "0.74843866", "0.74745387", "0.7467267", "0.74627763", "0.7444205", "0.74207646", "0.73831546", "0.73803186", "0.7365555", "0.73625636", "0.7362543", "0.73561925", "0.7350079", "0.7345451", "0.7345451", "0.73446435", "0.7341527", "0.7338828", "0.733771", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135", "0.7337135" ]
0.0
-1
Returns the current logged in user.
def current_user if (user_id = session[:user_id]) @current_user ||= User.find_by(id: user_id) elsif (user_id = cookies.signed[:user_id]) user = User.find_by(id: user_id) if user && user.authenticated(cookies[:remember_token]) log_in user @current_user = user end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end", "def current_user\n return unless session[:user_id]\n User.find(session[:user_id])\n end", "def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end", "def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end", "def get_current_user\n if session[:authenticated]\n return User.find_by_id(session[:user_id])\n end\n return nil\n end", "def current_user\n\t\tif session[:user_id].present?\n\t\t\tUser.find(session[:user_id])\n\t\tend\n\tend", "def current_user\n if valid_session?\n User.find(session[:user_id])\n end\n end", "def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend", "def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend", "def current_user\n if logged_in?\n return User.get(session['user'])\n end\n AnonymousUser.new\n end", "def current_user\n if session[:user_id]\n return @user ||= User.find(session[:user_id]['$oid'])\n else\n return nil\n end\n end", "def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n end\n end", "def current_user\n if session[:user_id]\n user = User.find(session[:user_id])\n else\n nil\n end\n end", "def current_user\n if session[:user_id]\n User.find_by(id: session[:user_id])\n end\n end", "def get_current_user\n if @current_user\n return @current_user\n else\n @current_user = User.find_by(id: session[:user_id])\n end\n end", "def current_user\n return @current_user if @current_user.present?\n\n if session[:uid]\n @current_user = User.from_session(session)\n end\n\n @current_user\n end", "def current_user(id = session[:user_id])\n User.get_one id\n end", "def get_current_user\n @current_user ||= User.find(session[:user_id]) unless session[:user_id].blank?\n return @current_user\n end", "def current_user\n get_from_options_or_controller(:current_user)\n end", "def current_user\n\t\t\tUser.find_by_id(session[:user_id])\n\t\tend", "def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end", "def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end", "def current_user\n User.find_by(id: session[:user_id])\n end", "def current_user\n User.find_by(id: session[:user_id])\n end", "def current_user\n user_id = get_log_in_session\n if user_id\n get_user(user_id)\n else\n user = get_user(cookies.signed['user_id'])\n if user&.authenticated?(:remember, cookies[:remember_token])\n set_log_in_session user\n user\n end\n end\n end", "def current_user\n load_session\n @current_user\n end", "def get_current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[\"user_id\"])\n end\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n return @current_user\n end", "def user\n\t\t\treturn nil if ! logged_in?\n\n\t\t\tPicombo::Session.instance.get('user')\n\t\tend", "def get_current_user\n unless session[:user_id]\n @current_user = nil\n return\n end\n @current_user = User.first(:conditions => {:id => session[:user_id] })\n end", "def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end", "def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end", "def current_user\n @current_user if logged_in?\n end", "def current_user\n @current_user if logged_in?\n end", "def current_user\n return unless session[:user_id]\n @current_user ||= User.find_by_id(session[:user_id])\n end", "def current_user\n User.find_by(uid: session[:user]) if logged_in?\n end", "def get_logged_in_user\n if logged_in?\n user = User.find(session[:current_user_id])\n if user\n return user\n else\n return nil\n end\n end\n \n #default return nil\n nil\n end", "def current_user\n session.user\n end", "def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end", "def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end", "def current_user\n\t\tUser.find_by(:id => session[:user_id])\n\tend", "def current_user\n return unless session[:user_id]\n @current_user ||= User.first(:id => session[:user_id])\n end", "def current_user\n if Rails.application.config.use_omniauth\n return nil unless session[:user_info]\n @current_user ||= User.find_user_from_omniauth(session[:user_info])\n else\n @current_user ||= User.where(username: request.env['aker.check'].user.username).first\n end\n end", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end", "def current_user\n @current_user ||= User.find_by_id(session[:uid]) || User.from_auth_header(request.headers['HTTP_AUTHORIZATION'])\n\n @current_user\n end", "def current_user\n User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n\t\tif !@current_user\n\t\t\t@current_user = User.find_by(id: session[:user_id])\n\t\tend\n\t\t@current_user\n\tend", "def get_current_user\n unless session[:user_id].blank?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end", "def current_user\n # User.find would throw an error if we cannot find the user\n User.find_by({ id: session[:user_id] })\n end", "def current_user\n return @current_user\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if @current_user.nil?\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end", "def current_user\n\n sql = \"SELECT * FROM users WHERE id = $1;\"\n \n results = run_sql(sql, [session[:user_id]]) \n return results.first\n end", "def current_user\n if !session[:user_id] then nil else User.find(session[:user_id]) end\n end", "def current_user\n session[:user]\n end", "def current_user\n if !@current_user.nil?\n @current_user\n elsif !session[:current_user_id].nil?\n begin\n @current_user = User.find(session[:current_user_id])\n rescue ActiveRecord::RecordNotFound\n @current_user = nil\n end\n end\n end", "def current_user\n current_session.user\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n # ||= is used for memoization of @current_user variable\n end", "def current_user\n if session[:current_user_id]\n @current_user ||= User.find(session[:current_user_id])\n end\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n end\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user if @current_user already exists.\n #if there's no current user, return the user with ID == session user ID, if there is one.\n end", "def current_user\n return nil unless session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end", "def current_user\n if(@current_user.nil?)\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end", "def current_user\n if session[:user_id].present?\n @current_user = User.find_by(uid: session[:user_id])\n # session.clear if @current_user.nil?\n return @current_user\n end\n end", "def current_user\n\t\tif session[:user_id]\n\t\t\t@current_user ||= User.find_by(id: session[:user_id])\n\t\tend\n\tend", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by_id(session[:user_id])\n end\n end", "def current_user\n\n \tif session[:user_id].present?\n \t\tUser.find(session[:user_id])\n\n \tend\n\n end", "def current_user\n return unless session[:user_id]\n @current_user = User.find_by_id(session[:user_id])\n end", "def current_user\n if logged_in?\n session[:user] = nil\n return temporary_logged_in_user ? temporary_logged_in_user :\n set_temporary_logged_in_user(cached_user)\n else\n session[:user] ||= create_new_user # if there wasn't one\n session[:user] = create_new_user unless session[:user].respond_to?(:stale?)\n session[:user] = create_new_user if session[:user].stale?\n return session[:user]\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n return @current_user ||= User.find(session[:user_id]) unless session[:user_id].nil?\n end", "def current_user\n return @current_user ||= User.first(token: request.cookies['user']) if request.cookies['user']\n\n @current_user ||= User.first(token: session[:user]) if session[:user]\n end", "def current_user\n core_id = Origen::Users::User.current_user_id\n user = app_users.find { |user| user.core_id == core_id }\n user || User.new(core_id)\n end", "def current_user\n User.find(session[:user])\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n abort \"You have no current user set!\".yellow unless current_user_exists?\n config.current_user\n end", "def current_user\n\t\t\treturn unless session[:user_id]\n\t\t\t@current_user ||= User.find_by_id(session[:user_id])\n\t\tend", "def current_user\n User.all(public_key: security.public_key).first\n end", "def current_user\n\tif session[:user_id].present?\n\t\tUser.find(session[:user_id])\t\n\tend\nend", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by_id(session[:user_id])\n end\n end", "def current_user\n @current_user ||= User.find_by id: session[:user_id]\n end", "def current_user\n @current_user ||= fetch_user_from_request\n end" ]
[ "0.84699243", "0.84194994", "0.8411229", "0.8362353", "0.83438027", "0.8321469", "0.83055735", "0.8301718", "0.8301718", "0.8286003", "0.82849735", "0.8275174", "0.82517356", "0.825006", "0.8203894", "0.81748176", "0.81680363", "0.816268", "0.81472313", "0.8137677", "0.8136486", "0.8136486", "0.81340104", "0.8116565", "0.8116565", "0.81103766", "0.8095684", "0.8074664", "0.80709094", "0.8067126", "0.80625284", "0.80532336", "0.80532336", "0.8050018", "0.8050018", "0.804461", "0.8040765", "0.8038619", "0.8034842", "0.8033075", "0.8033075", "0.8029244", "0.80264866", "0.8012301", "0.801024", "0.801024", "0.801024", "0.801024", "0.8009575", "0.8009575", "0.8008905", "0.8006189", "0.8006189", "0.8000666", "0.79961103", "0.7994558", "0.7992458", "0.79919255", "0.7986208", "0.79860556", "0.79860556", "0.7985273", "0.7974614", "0.79742897", "0.7972653", "0.7971202", "0.7968341", "0.79650396", "0.7957499", "0.7957499", "0.7949775", "0.79463744", "0.7939472", "0.7937263", "0.7936158", "0.79331785", "0.792347", "0.792347", "0.792347", "0.792347", "0.792347", "0.792056", "0.79180175", "0.7917647", "0.7912731", "0.79114634", "0.79083735", "0.7906172", "0.7902757", "0.7898649", "0.78982854", "0.78957725", "0.78957725", "0.78957725", "0.7895552", "0.78924537", "0.7888932", "0.7885363", "0.78842694", "0.7883823", "0.78753614" ]
0.0
-1
Calls the current_user method above to check for a logged in user.
def logged_in? !current_user.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_and_set_current_user_if_logged_in\n\n if x = Services::PropsFromServer.props[:current_user]\n\n user = User.parse(x)\n\n CurrentUser.set_user_and_login_status(user, true)\n\n end\n\n end", "def check_current_user\n if !current_user.nil?\n Thread.current[:user] = current_user\n end\n end", "def user_is_current\n fetch_user\n\n unless current_user?(@user)\n flash[:error] = t(:not_authorized)\n redirect_to root_path\n end\n end", "def check_logged_in\n unless current_user\n redirect_to '/login'\n end\n end", "def check_current_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) || is_manager_or_admin?\n end", "def check_user\n if current_user.nil?\n render status: :forbidden, json: false\n return\n end\n end", "def check_if_logged_in\n redirect_to(new_user_path) if @current_user.nil?\n end", "def check_if_logged_in\n redirect_to(new_user_path) if @current_user.nil?\n end", "def check_if_current_user\r\n User.current_user && User.current_user != self\r\n end", "def is_current_user(user)\n logged_in? && @current_user.id == user.id\n end", "def current_user # Check the current user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end", "def check_correct_user(user)\n \tcurrent_user?(user)\n end", "def current_user?(user)\n logged_in? and user == current_user\n end", "def ensure_user_logged_in\n bounce_user unless current_user\n end", "def logged_in\n\t \t!current_user.nil?\n\t end", "def logged_in_user\n unless current_user \n redirect_to root_path\n end\n end", "def current_user?(user)\n\t\tcurrent_user == user\n\tend", "def logged_in_user\n unless logged_in?\n puts \"not logged in\"\n end\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def check_user\n return nil unless userlogin_signed_in?\n\n User.find_by(email: current_userlogin.email)\n end", "def current_user\n super\n if @current_user\n return @current_user\n end\n\n authenticate_user!\n @current_user\n end", "def current_user?(user)\r\n user == current_user\r\n end", "def current_user?(user)\n user && user == current_user\n end", "def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end", "def current_user?(user)\n\t\tuser == self.current_user\n\t\t\n\tend", "def ensure_logged_in\n login! if @user.nil?\n end", "def current_user?(user)\n \t\tuser == current_user\n \tend", "def check_user\n @user = User.find(params[:user_id])\n redirect_to root_path unless current_user == @user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def set_current_user\n if logged_in?\n @current_user = current_user\n end\n end", "def logged_in_user\n unless !current_user.nil?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n \t\tuser == current_user\n \tend", "def check_user\n if user_signed_in? && (current_user.has_role?(:admin) || current_user.id == @listing.user_id )\n else \n flash[:alert] = \"You are not authorized to do that!\"\n redirect_to root_path\n end\n end", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def check_current_user_owns\n head :not_found unless @user == current_user\n end", "def setup_current_user\n @current_user = User.find(session[:user_id]) unless session[:user_id].nil?\n end", "def check_user\n @user = authenticate(@campaign.user_id, request.path, nil)\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end" ]
[ "0.7641624", "0.75562036", "0.7522021", "0.7450313", "0.7401374", "0.7387889", "0.7384047", "0.7384047", "0.7344179", "0.7319652", "0.72893524", "0.72702", "0.7268101", "0.72503144", "0.72426987", "0.7234913", "0.7192522", "0.716954", "0.7169324", "0.7169324", "0.7169324", "0.7169324", "0.7169324", "0.7169324", "0.7169324", "0.7154824", "0.7146499", "0.7143502", "0.71378523", "0.713027", "0.7125172", "0.71158886", "0.71094453", "0.71061504", "0.7104571", "0.710389", "0.710389", "0.710389", "0.710389", "0.710389", "0.710389", "0.710389", "0.710389", "0.7099704", "0.7094017", "0.709387", "0.7092178", "0.70919305", "0.70917356", "0.70917356", "0.70917356", "0.70917356", "0.70917356", "0.70917356", "0.70917356", "0.70917356", "0.70917356", "0.70917356", "0.70836556", "0.70821345", "0.70763326", "0.7074341", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545", "0.70740545" ]
0.0
-1
Deletes the rember token digest from the database and both cookies.
def forget(user) user.forget cookies.delete(:user_id) cookies.delete(:remember_token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_cookie(cookies)\n cookies.delete('token')\n @user.update(token: '')\n end", "def destroy\n\t\tcookies.delete(:auth_token)\n\t\tredirect_to root_url\n\tend", "def delete_cookie\n cookies.delete :auth_token\n end", "def destroy\n @token.destroy\n\n head :no_content\n end", "def delete(session, context = Context.current)\n digest = session.instance_variable_get(\"@digest\")\n @cache.delete(digest)\n super\n end", "def delete_lock\n digests.delete_by_digest(lock_digest)\n end", "def forget\n self.remember_token = nil\n update_attribute(:remember_token_digest, nil)\n end", "def destroy\n @token = Token.find(params[:id])\n @token.destroy\n\n head :no_content\n end", "def clear_cookies\n \tcookies.delete(:auth_token)\n end", "def destroy\n @token = @user.tokens.find(params[:id])\n @user.tokens.delete(@token)\n @user.save\n\n respond_to do |format|\n format.html { redirect_to user_tokens_url }\n format.json { head :no_content }\n end\n end", "def httpdigest_logout\n session.delete(SESSION_NONCE)\n session.delete(SESSION_OPAQUE)\n end", "def delete_token(token)\n delete token_path(token)\n end", "def remove_mfa_secret!\n transaction do\n update!(mfa_secret: nil)\n nonce_tokens.delete_all\n end\n end", "def remove_token\n update(token: nil)\n end", "def delete(token)\n @store.delete(key_for(token))\n end", "def del\n redis do |conn|\n conn.multi do |pipeline|\n pipeline.zrem(DIGESTS, key.digest)\n pipeline.del(key.digest, key.queued, key.primed, key.locked, key.info)\n end\n end\n end", "def forget\n self.remember_token = nil\n update_attribute(:remember_digest, nil)\n end", "def forget\n self.remember_token = nil\n update_attribute(:remember_digest, nil)\n end", "def destroy\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @resource.destroy\n head :no_content\n end", "def forget\n self.remember_token = nil\n self.update_attribute(:remember_digest, nil)\n end", "def delete_token(token = nil)\n token = token || settings.token\n delete \"authToken/#{token.to_s}\"\n end", "def delete(id, post)\n File.unlink(post_path(post))\n\n update_digests do |digests|\n digests.delete(id)\n end\n end", "def destroy\n @token = Token.find(params[:id])\n @token.destroy\n \n respond_to do |format|\n format.html { redirect_to tokens_url }\n format.json { head :ok }\n end\n end", "def forget\n update_attribute(:remember_digest, nil)\n # We don't need the below line because if we update remember_digest to nil, then\n # you cannot use the old remember_token anyway, so it is unnecessary\n # self.remember_token = nil\n end", "def nuke_auth_token\n\t\t\tfile = get_access_token_file\n\t\t\[email protected] \"Removing persisted access token: #{file}\"\n\t\t\tFile.delete file\n\t\t\tset_access_token(nil)\n\t\t\tset_auth_header ''\n\t\tend", "def destroy\n @globus_token.destroy\n\n respond_to do |format|\n format.html { redirect_to globus_tokens_url, notice: \"Globus token was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n # Delete the user access tokens on logout\n User.find(session[:user_id]).delete\n # Delete the session as well\n session = {}\n \n redirect_to root_path\n end", "def destroy\n self.current_person.forget_me if logged_in?\n cookies.delete :auth_token\n reset_session\n flash[:notice] = t('sessions.destroy.logged_out')\n redirect_to login_path\n end", "def destroy\n\t\tcookies.delete 'Vanilla'\n\t\tcookies.delete 'Vanilla-Volatile'\n\t\tsuper\n\tend", "def destroy\n cookies.delete :web_session_token\n reset_session\n redirect_to root_path\n end", "def destroy\n cookies.delete :web_session_token\n reset_session\n redirect_to root_path\n end", "def delete_dbtoken\n @project = Project.find(params[:id])\n @project.dropbox_token=nil\n @project.save\n redirect_to session[:return_to] \n end", "def destroy\n\t\t\t\tcurrent_user.reset_authentication_token!\n\t\t\t\trender_success\n\t\t\tend", "def deleteRecoveryPasswordToken(token)\n \n begin\n query = \"DELETE FROM `#{DB_NAME}`.`#{RECOVERY_TABLE}` WHERE `#{TOKEN_TABLE}`.`token` = ?\"\n queryReset = \"ALTER TABLE #{RECOVERY_TABLE} AUTO_INCREMENT = 1\"\n self.connect unless self.connected? # => connect to the DB server if not connected\n sth = @dbh.prepare(query)\n sth.execute(token)\n sth = @dbh.prepare(queryReset)\n sth.execute\n \n sth.finish\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 \n \n end", "def destroy\n @user = User.user_by_token(request.cookies[\"token\"])\n return if @user != @reservation.user\n\n @reservation.destroy\n head :no_content\n end", "def revoke_token\n raise 'To be implemented in child classes'\n end", "def destroy\n self.current_ubiquo_user.forget_me if logged_in?\n cookies.delete :auth_token\n session.delete(:ubiquo)\n flash[:notice] = t 'ubiquo.auth.logout'\n redirect_back_or_default(ubiquo.home_path)\n end", "def destroy\n current_user.remove_token\n render json: { status: :success, data: 'Successfully signed out' }\n end", "def logout\r\n self.update(token: nil) \r\n end", "def destroy\n @token.destroy\n respond_to do |format|\n format.html { redirect_to admin_tokens_url, notice: 'Token was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete!\n Recliner.delete(uri)\n end", "def delete_token(filename)\n begin\n File.delete(File.join(@token_folder, filename))\n rescue => e\n @logger.error \"Error deleting token file for VM #{vm_id}\"\n @logger.error e.message\n end\n end", "def delete\n self.class.delete_payment_token_by_id(self.id)\n end", "def delete\n user = getUserByAuthToken(request)\n user.soft_delete\n head :no_content\n end", "def destroy\n @secret.destroy\n head :no_content\n end", "def clear_cache(auth_token)\n Authentication::RedisStore.instance.delete(auth_token)\n end", "def delete_all_cookies; end", "def destroy\n @guild = @raid.guild\n expire_fragment(@raid)\n @raid.destroy\n respond_to do |format|\n format.html { redirect_to(guild_raids_path(@guild)) }\n format.xml { head :ok }\n end\n end", "def logout_user\n cookies.delete(:auth_token)\n end", "def delete_token(filename)\n begin\n File.delete(File.join(@token_folder, filename))\n rescue StandardError => e\n @logger.error \"Error deleting token file for VM #{vm_id}\"\n @logger.error e.message\n end\n end", "def delete(cookie)\n # self\n end", "def destroy\n self.current_user.forget_me if logged_in?\n cookies.delete :auth_token\n reset_session\n flash[:notice] = \"You have been logged out.\"\n redirect_back_or_default\n end", "def destroy_session_token!\n update_attribute(:session_token, nil)\n end", "def destroy\n # invalidate the token\n client.logout\n\n # client is not valid anymore\n @client = nil\n\n # reset client for records\n Confluence::Record.client = nil\n end", "def destroy_tokens\n if saved_change_to_address? || destroyed?\n tokens = ['recovery']\n Token.where(:user_id => user_id, :action => tokens).delete_all\n end\n end", "def destroy\n result = database.delete self\n if result['ok']\n self['_rev'] = nil\n self['_id'] = nil\n end\n result['ok']\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def reset_auth_token!\n reset_auth_token\n save(:validate => false)\n end", "def forget!(cookies)\n cookies.delete(:remember_me)\n cookies.delete(:authorization_token)\n end", "def forget!(cookies)\n cookies.delete(:remember_me)\n cookies.delete(:authorization_token)\n end", "def forget!(cookies)\n cookies.delete(:remember_me)\n cookies.delete(:authorization_token)\n end", "def forget!(cookies)\n cookies.delete(:remember_me)\n cookies.delete(:authorization_token)\n end", "def destroy\n current_user.authentication_token = nil\n current_user.save\n render json: {success: true, message: \"Logged out successfully\"}\n end", "def destroy\n hashback_backend.delete(_hashback_id_key)\n end", "def sign_out\n current_user.update_attribute(:remember_token,\n User.digest(User.new_remember_token))\n cookies.delete(:remember_token)\n current_user.meal.delete\n self.current_user = nil\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n\t\tupdate_attribute(:remember_digest, nil)\n\tend", "def forget\n\t\tupdate_attribute(:remember_digest, nil)\n\tend", "def forget\n\t\tupdate_attribute(:remember_digest, nil)\n\tend", "def destroy\n @user = User.user_by_token(request.cookies[\"token\"])\n return if @user != @elevator_booking.user\n\n @elevator_booking.destroy\n head :no_content\n end", "def destroy\n signed_out_user = current_user\n sign_out :user\n session.try(:delete, :_csrf_token)\n # Prevent Token Fixation attacks by generating a new token upon user logout.\n signed_out_user.authentication_token = Devise.friendly_token\n signed_out_user.save\n super\n end", "def forget_user_from_cookie(user)\n user.forget_digest\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget\n update_attribute(:remember_digest, nil)\n \n end", "def delete_job_by_digest\n call_script(:delete_job_by_digest,\n keys: [\"#{QUEUE}:#{queue}\", SCHEDULE, RETRY],\n argv: [lock_digest])\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def reset_authentication_token!\n reset_authentication_token\n self.save\n end", "def reset\n reset_token\n end", "def delete_cookie(name); end", "def destroy\n @credential = Credential.find(params[:id])\n @credential.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end", "def destroy\n @grant_round = GrantRound.find(params[:id])\n @grant_round.destroy\n\n head :no_content\n end", "def destroy\n @role_auth_ref.destroy\n respond_to do |format|\n format.html { redirect_to role_auth_refs_url, notice: 'Role auth ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def reset_authentication_token!\n reset_authentication_token\n save(:validate => false)\n end", "def revoke_authentication_token key\n redis_token = Redis::Value.new(authentication_token_key(id.to_s, key))\n redis_token.delete unless redis_token.nil?\n end", "def clear_reset_password_token; end" ]
[ "0.6797032", "0.65304476", "0.6466311", "0.6444831", "0.6335044", "0.6201575", "0.61564255", "0.6135223", "0.60680383", "0.6034675", "0.602228", "0.60193723", "0.6016331", "0.6014343", "0.6001633", "0.5973922", "0.59739083", "0.59739083", "0.596917", "0.59651345", "0.59497726", "0.5868694", "0.58432925", "0.5829339", "0.58195144", "0.5818089", "0.58061844", "0.5803692", "0.57955205", "0.5789416", "0.5789416", "0.57668054", "0.5756739", "0.57465386", "0.574251", "0.5712262", "0.57010245", "0.5700687", "0.5693301", "0.56892693", "0.5680437", "0.5677467", "0.5669645", "0.56631815", "0.5660979", "0.56580824", "0.5654055", "0.56529933", "0.56513536", "0.56407464", "0.56293267", "0.5627813", "0.562045", "0.5618652", "0.5598044", "0.5592487", "0.5587548", "0.5587548", "0.55800563", "0.5579043", "0.5579043", "0.5579043", "0.5579043", "0.5577788", "0.5577231", "0.55623525", "0.5554921", "0.5539994", "0.5539994", "0.5539994", "0.55398464", "0.5531566", "0.5529392", "0.55284375", "0.5526777", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.5523608", "0.55211455", "0.5511272", "0.5503879", "0.5501397", "0.5491541", "0.5489874", "0.54853636", "0.547879", "0.5478576" ]
0.0
-1
Calls the forget method above, deletes the session cookie and sets the current user instance variable to nil.
def log_out forget(current_user) session.delete(:user_id) @current_user = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout\n forget_user_from_cookie(current_user)\n session.clear\n @current_user = nil\n end", "def log_out\n forget(current_user) #called from user.rb. it sets remember_token attribute to nil.\n session.delete(:user_id) #deletes session.\n @current_user = nil # new value of this instance variable.\n end", "def logout\n forget(current_user)\n session.delete(:user)\n @current_user = nil\n end", "def destroy\n cookies.signed[:current_user_id] = nil\n redirect_to new_session_path\n end", "def destroy\n self.current_user.forget_me if logged_in?\n cookies.delete :auth_token\n reset_session\n flash[:notice] = \"You have been logged out.\"\n redirect_back_or_default\n end", "def forget(user)\n user.unpersist # In the database\n cookies.delete(:user_id) # In the browser\n cookies.delete(:remember_token) # In the browser\n end", "def forget\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\nend", "def logout\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def logout\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n current_user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\nend", "def log_out\n forget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n session.delete(:user_id)\n forget(@current_user)\n @current_user=nil\n end", "def log_out\n # destroys cookies token\n cookies[:remember_token] = nil\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def destroy\n @session[:user_id] = nil\n @current_user = nil\n end", "def forget(user)\n user.forget #nil out remember_digest\n cookies.delete(:current_user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget # Defined in the User model\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete :id\n cookies.delete :remember_token\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n\n end", "def logout!\n session[:user_id] = nil\n session[:return_to] = nil\n @current_user = nil\n cookies.delete(:remember_token)\n end", "def forget(user)\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def log_out\n # Here, current_user is the return value of the current_user method\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def forget(user)\n # Sets the remember_digest attribute to nil in the DB\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def log_out\r\n forget(current_user)\r\n session.delete(:user_id)\r\n @current_user = nil\r\n end", "def log_out\n\t\t#delete the cookie\n\t\tforget(current_user)\n\t\t#delete the sessionid\n \t\tsession[:user_name]=nil\n \t\t#then currentuser is deleted\n\t\tcurrent_user=nil\n\tend", "def forget (user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget # set user.remember_digest as nil\n cookies.delete(:user_id)\n cookies.delete(:remember_token) \n end", "def forget(user)\r\n user.forget\r\n cookies.delete(:user_id)\r\n cookies.delete(:remember_token)\r\n end", "def log_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def unset_current_user\n unless current_user.nil?\n current_user.remember_token = nil\n current_user.save\n end\n cookies[:remember_token] = nil\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def log_out\n forget(current_user)\n session.delete(:session_database)\n session.delete(:user_id)\n @current_user = nil\n end", "def forget(user)\n user.forget!\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def forget(user)\n user.forget\n cookies.delete(:username)\n cookies.delete(:remember_token)\n end", "def forget(user)\n\t user.forget\n\t cookies.delete(:user_id) #delete user_id cookie\n\t cookies.delete(:remember_token) #delete remember_token cookie\n\tend", "def forget(user)\n user.forget\n cookies.delete(:user)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.delete_remember_digest\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def sign_out_user\n self.current_user = nil\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget # Calls model function\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def log_out\n session.delete(:user_id) #remove the user id from the browser cache\n @current_user = nil\n end", "def sign_out\n cookies.delete(:remember_token)\n self.current_user = nil\n end", "def forget(user)\n\t user.forget\n\t cookies.delete(:user_id)\n\t cookies.delete(:remember_token)\n end", "def forget_user(user)\n user.forget_user\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget_user(user)\n user.forget_user\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def destroy\n self.current_person.forget_me if logged_in?\n cookies.delete :auth_token\n reset_session\n flash[:notice] = t('sessions.destroy.logged_out')\n redirect_to login_path\n end", "def sign_out\r\n self.current_user = nil\r\n cookies.delete(:remember_token)\r\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n session.delete(:user_type_string)\n @current_user = nil\n end", "def sign_out\n\t\t\n\t\t# Set the current_user for session to nil\n\t\tself.current_user = nil\n\n\t\t# Destroy cookie with hash remember_token\n\t\t# essentially letting the browser forget the user\n\t\tcookies.delete(:remember_token)\n\tend", "def user_log_out\n forget_user(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.clear\n cookies.clear\n @current_user = nil\n end", "def log_out\n @current_user.forget_token(cookies.signed[:remember_token])\n @current_user = nil\n session.delete(:authentication_id)\n cookies.delete :authentication_id\n cookies.delete :remember_token\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end" ]
[ "0.83014494", "0.8291249", "0.8194289", "0.8160981", "0.8135859", "0.8128195", "0.81079453", "0.8101312", "0.8101312", "0.80956066", "0.8093549", "0.809146", "0.80810225", "0.80788547", "0.8076023", "0.8073099", "0.8065215", "0.80618143", "0.80574983", "0.8053794", "0.80458015", "0.8044852", "0.80424833", "0.80419606", "0.8041599", "0.8041424", "0.8039857", "0.8037315", "0.80221915", "0.80155414", "0.80143076", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8012529", "0.8011421", "0.80112255", "0.8010376", "0.8010035", "0.8009921", "0.8009246", "0.8006461", "0.79966944", "0.79893416", "0.7988387", "0.79870963", "0.7983601", "0.7981731", "0.7978498", "0.7977987", "0.7968704", "0.79583836", "0.79583836", "0.7951981", "0.79497045", "0.7946884", "0.79450625", "0.79404855", "0.7940445", "0.79386824", "0.79355377", "0.79355377", "0.79355377", "0.79355377", "0.79355377", "0.79355377", "0.79355377", "0.79355377", "0.79355377", "0.79355377", "0.79355377", "0.79355377", "0.79355377", "0.79355377" ]
0.0
-1
:responseMessage, :amountReceived, :cardNumberMask, :cardType, :cardTypeCode, :responseCode, :transactionID, :xref Checks for attributes
def ifFlex if method == "flex" if card_number.length != 7 errors.add(:cardNumber, 'unique ID must be 7 digits') end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_response(response)\r\n\r\n#\r\n#\tSetup default response values.\r\n#\r\n message = nil\r\n authorization = nil\r\n success = false\r\n exception = nil\r\n#\r\n#\tExtract key elements from the response.\r\n#\r\n reasonCode = response.Get(RocketGate::GatewayResponse::REASON_CODE);\r\n message = @@response_codes[('r' + reasonCode).to_sym] || \"ERROR - \" + reasonCode\r\n responseCode = response.Get(RocketGate::GatewayResponse::RESPONSE_CODE);\r\n if ((responseCode != nil) && (responseCode == \"0\"))\r\n success = true; # Transaction succeeded\r\n authorization = response.Get(RocketGate::GatewayResponse::TRANSACT_ID);\r\n else\r\n exception = response.Get(RocketGate::GatewayResponse::EXCEPTION);\r\n end\r\n\r\n#\r\n#\tExtract values that are not dependent up success/failure.\r\n#\r\n avsResponse = response.Get(RocketGate::GatewayResponse::AVS_RESPONSE)\r\n cvv2Response = response.Get(RocketGate::GatewayResponse::CVV2_CODE)\r\n fraudResponse = response.Get(RocketGate::GatewayResponse::SCRUB_RESULTS)\r\n\r\n#\r\n#\tCreate the response object.\r\n#\r\n card_hash = response.Get(RocketGate::GatewayResponse::CARD_HASH)\r\n Response.new(success, message, {:result => responseCode, :exception => exception, :card_hash => card_hash},\r\n :test => test?,\r\n :authorization => authorization,\r\n :avs_result => {:code => avsResponse},\r\n :cvv_result => cvv2Response,\r\n :fraud_review => fraudResponse\r\n )\r\n end", "def response\n result = {}\n res_xml.blank? ? xml = '' : xml = res_xml\n doc = Hpricot.XML(xml)\n case status\n when 'REQUEST'\n result[:status] = 'BEGIN'\n when 'UPDATE'\n result[:status] = 'NORMAL'\n when 'EXCEPTION'\n result[:status] = 'ERROR'\n end\n result[:xml] = ErpHelper.xml2html(doc.to_s)\n case (doc/:IAVSResult).inner_text\n when 'Y'\n result[:avsresult] = 'Match'\n when 'N'\n result[:avsresult] = 'No Match'\n when 'X'\n result[:avsresult] = 'No Provide'\n end\n result[:zipmatch] = (doc/:AVSResult/:ZipMatch).inner_text\n result[:streetmatch] = (doc/:AVSResult/:StreetMatch).inner_text\n pfp_res_code_msg = open(RAILS_ROOT+\"/db/pfp_transaction_result_code_and_message.yml\") {|f| YAML.load(f)}\n pfp_res_code_msg[res_code].blank? ? result[:pfp_res_code_msg] = 'Credit Card Processing Gateway Error.' : result[:pfp_res_code_msg] = pfp_res_code_msg[res_code]\n return result\n end", "def attributes\n {\n card_token: card_token,\n card_type: card_type,\n expiration_date: expiration_date,\n card_number: card_number\n }\n end", "def set_fields result\n @txn.confirmation_no = result.id \n if CREDIT_CARD_API == 'balanced'\n @txn.payment_type, @txn.credit_card_no, @txn.debit_token = result.source.card_type, result.source.last_four, result.uri\n else\n @txn.payment_type, @txn.credit_card_no, @txn.debit_token = result.source.brand, result.source.last4, result.source.id\n end\n end", "def initialize(response, card)\n @response = response\n @card = card\n end", "def message_from(response)\n case response[:response_code]\n when 0\n return \"OK\"\n when 2000\n return \"ERROR 2000: Invalid Connection Ticket\"\n when 10303\n return \"ERROR 10303: TransRequestID is empty\"\n when 10305\n return \"ERROR 10305: An error occurred when validating the supplied payment data\"\n when 10309\n return \"ERROR 10309: The credit card number is formatted incorrectly\"\n when 10312\n return \"ERROR 10312: The credit card Transaction ID was not found\"\n when 10409\n return CVVResult.messages[ response[:card_code] ] if CARD_CODE_ERRORS.include?(response[:card_code])\n end\n end", "def initialize(attributes = {})\n @response_xml = attributes[:xml]\n @response_code = attributes[:response_code]\n @reason_code = attributes[:reason_code]\n @message = attributes[:message]\n end", "def valid_attributes\n %w[\n amount\n authorisationId\n automaticResponseUrl\n captureDay\n captureMode\n complementaryCode\n complementaryInfo\n currencyCode\n customerLanguage\n expirationdate\n keyVersion\n maskedPan\n merchantId\n normalReturnUrl\n orderId\n paymentMeanBrand\n paymentMeanBrandList\n paymentMeanType\n responseCode\n transactionDateTime\n transactionReference\n ]\n end", "def required_attributes\n %w[\n amount\n transactionReference\n orderId\n responseCode\n ]\n end", "def initialize(response)\n @data = response[:data]\n @status = response[:status]\n super ApduError.message_for_apdu_response(response)\n end", "def ai_response_description\n case ai_response\n when 0 then \"Unable to respond\"\n when 1 then \"Reception acknowledged\"\n when 2 then \"Response to follow\"\n when 3 then \"Able to respond but currently inhibited\"\n else\n \"Reserved for future use\"\n end\n end", "def create\n @request = CardDetail.new.verify_transaction(params[:trxref]).parsed_response\n\n @user = User.find_by_email(@request['data']['customer']['email'])\n\n @card_detail = CardDetail.new(auth_code: @request['data']['authorization']['authorization_code'],\n bin: @request['data']['authorization']['bin'],\n last_four: @request['data']['authorization']['last4'],\n bank: @request['data']['authorization']['bank'],\n brand: @request['data']['authorization']['brand'],\n country_code: @request['data']['authorization']['country_code'],\n user: @user)\n respond_to do |format|\n if @card_detail.save\n format.html { redirect_to user_card_details_path(@user.id), notice: 'Card detail was successfully created.' }\n format.json { render json: request.headers['Content-Type'], head: :ok }\n else\n format.html { render :new }\n format.json { render json: @card_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def avs_result(response)\n attrs={}\n # Check the Street Address:\n case response[:raw][:AVSStreet]\n when \"Pass\"\n attrs[:street_match] = 'Y'\n when \"Fail\"\n attrs[:street_match] = 'N'\n else\n attrs[:street_match] = nil\n end \n \n # Check the Postal Code:\n case response[:raw][:AVSZip]\n when \"Pass\"\n attrs[:postal_match] = 'Y'\n when \"Fail\"\n attrs[:postal_match] = 'N'\n else\n attrs[:postal_match] = nil\n end\n \n attrs \n end", "def optionals\r\n %w[\r\n response_code\r\n message\r\n e_164_format\r\n formatted\r\n country\r\n line_type\r\n line_provider\r\n mobile_country_code\r\n mobile_network_code\r\n ]\r\n end", "def well_formated_response?\n all_expected_fields_received? && validate_bank_response_signature\n end", "def successful_visa_no_3d_purchase_response\n %(<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n <soap:Body>\n <CardDetailsTransactionResponse xmlns=\"https://www.thepaymentgateway.net/\">\n <CardDetailsTransactionResult AuthorisationAttempted=\"True\">\n <StatusCode>0</StatusCode>\n <Message>AuthCode: 939772</Message>\n </CardDetailsTransactionResult>\n <TransactionOutputData CrossReference=\"110706093540191601939772\">\n <AuthCode>939772</AuthCode>\n <AddressNumericCheckResult>PASSED</AddressNumericCheckResult>\n <PostCodeCheckResult>PASSED</PostCodeCheckResult>\n <CV2CheckResult>PASSED</CV2CheckResult>\n <GatewayEntryPoints>\n <GatewayEntryPoint EntryPointURL=\"https://gw1.cardsaveonlinepayments.com:4430/\" Metric=\"100\"/>\n <GatewayEntryPoint EntryPointURL=\"https://gw2.cardsaveonlinepayments.com:4430/\" Metric=\"200\"/>\n <GatewayEntryPoint EntryPointURL=\"https://gw3.cardsaveonlinepayments.com:4430/\" Metric=\"300\"/>\n </GatewayEntryPoints>\n </TransactionOutputData>\n </CardDetailsTransactionResponse>\n </soap:Body>\n </soap:Envelope>)\n end", "def parse_response(event)\r\n iter = event.messageIterator()\r\n result = Hash.new\r\n \r\n while iter.hasNext()\r\n \r\n message = iter.next()\r\n raise Bberg::BbergException.new(\"Got a response with incorrect correlation id!\") if message.correlationID != @req_id\r\n msg_type = message.messageType().toString()\r\n raise Bberg::BbergException.new(\"Expected message of type ReferenceDataResponse but got #{msg_type}\") if msg_type != \"ReferenceDataResponse\"\r\n \r\n security_data_array = message.getElement(\"securityData\")\r\n (0..(security_data_array.numValues - 1)).each do |sec_num|\r\n security_data = security_data_array.getValueAsElement(sec_num)\r\n security_name = security_data.getElementAsString(\"security\")\r\n field_data = security_data.getElement(\"fieldData\")\r\n\r\n result[security_name] ||= Hash.new\r\n \r\n (0..(field_data.numElements - 1)).each do |field_num|\r\n field_element = field_data.getElement(field_num)\r\n values = if field_element.isArray\r\n process_array_type(field_element)\r\n else\r\n get_element_values(field_data, field_num)\r\n end\r\n result[security_name][field_element.name.toString] = values\r\n end\r\n end\r\n end\r\n result\r\n end", "def validate_for_card\n tt = self.transaction_type.to_i\n \n # mandatory: transaction_type must != (30, 31, 32, 34, 35)\n append_error(:cc_number, \"cc_number must not be set for tagged transactions\") if [30,31,32,34,35].include?(tt)\n \n # amount, cardholder_name always mandaory\n mandatory = [:amount, :cardholder_name]\n \n # card_number & expiry_date mandatory for all except 50, 54\n # pan mandatory for only 50, 54\n mandatory << ([50,54].include?(tt) ? :pan : [:cc_number, :cc_expiry])\n mandatory.flatten!\n\n # reference_no mandatory for 60\n mandatory << :reference_no if tt == 60\n \n # auth_number mandatory for (02, 03, 11, 12, 13)\n mandatory << :authorization_num if [02, 03, 11, 12, 13].include?(tt)\n \n check_mandatory(mandatory)\n end", "def response(response)\n \t\traw_response = CGI::parse(decrypt_data(response,@working_Key,\"AES-128-CBC\"))\n\n \t\tauth_desc = raw_response[\"AuthDesc\"][0]\n \t\torder_id = raw_response[\"Order_Id\"][0]\n \t\tamount = raw_response[\"Amount\"][0]\n \t\tchecksum = raw_response[\"Checksum\"][0]\n\n \t\tverification = verifyChecksum(order_id,amount,auth_desc,checksum)\n \t\treturn auth_desc,verification,raw_response\n \tend", "def card_params\n {\n \"name\": @card_name,\n \"document\": @current_user.document,\n \"number\": @card_number,\n \"expMonth\": @card_exp_month,\n \"expYear\": @card_exp_year,\n \"type\": @card_type,\n \"address\": {\n \"line1\": @card_address,\n \"postalCode\": @card_postal_code,\n \"city\": @card_city_name,\n \"country\": \"CO\",\n \"phone\": @current_user.phone\n }\n }\n end", "def add_credit_card(xml, credit_card, address)\n xml.tag! :Card do\n \n # DataCash calls the CC number 'pan'\n xml.tag! :pan, credit_card.number\n xml.tag! :expirydate, format_date(credit_card.month, credit_card.year)\n \n # optional values - for Solo etc\n if [ 'switch', 'solo' ].include?(credit_card.type.to_s)\n \n xml.tag! :issuenumber, credit_card.issue_number unless credit_card.issue_number.blank?\n \n if !credit_card.start_month.blank? && !credit_card.start_year.blank?\n xml.tag! :startdate, format_date(credit_card.start_month, credit_card.start_year)\n end\n end\n \n xml.tag! :Cv2Avs do\n xml.tag! :cv2, credit_card.verification_value if credit_card.verification_value?\n xml.tag! :street_address1, address[:address1] unless address[:address1].blank?\n xml.tag! :street_address2, address[:address2] unless address[:address2].blank?\n xml.tag! :street_address3, address[:address3] unless address[:address3].blank?\n xml.tag! :street_address4, address[:address4] unless address[:address4].blank?\n xml.tag! :postcode, address[:zip] unless address[:zip].blank?\n \n # The ExtendedPolicy defines what to do when the passed data \n # matches, or not...\n # \n # All of the following elements MUST be present for the\n # xml to be valid (or can drop the ExtendedPolicy and use\n # a predefined one\n xml.tag! :ExtendedPolicy do\n xml.tag! :cv2_policy, \n :notprovided => POLICY_REJECT,\n :notchecked => POLICY_REJECT,\n :matched => POLICY_ACCEPT,\n :notmatched => POLICY_REJECT,\n :partialmatch => POLICY_REJECT\n xml.tag! :postcode_policy,\n :notprovided => POLICY_ACCEPT,\n :notchecked => POLICY_ACCEPT,\n :matched => POLICY_ACCEPT,\n :notmatched => POLICY_REJECT,\n :partialmatch => POLICY_ACCEPT\n xml.tag! :address_policy, \n :notprovided => POLICY_ACCEPT,\n :notchecked => POLICY_ACCEPT,\n :matched => POLICY_ACCEPT,\n :notmatched => POLICY_REJECT,\n :partialmatch => POLICY_ACCEPT\n end\n end\n end\n end", "def response(datas)\n\n response = ExceptionHandler.validate_binary_output(:response, `#{@response_path} pathfile=#{@pathfile_path} message=#{datas}`)\n\n { \n :code => response[1],\n :error => response[2],\n :merchant_id => response[3],\n :merchant_country => response[4],\n :amount => response[5],\n :transaction_id => response[6],\n :payment_means => response[7],\n :transmission_date => response[8],\n :payment_time => response[9],\n :payment_date => response[10],\n :response_code => response[11],\n :payment_certificate => response[12],\n :authorisation_id => response[13],\n :currency_code => response[14],\n :card_number => response[15],\n :cvv_flag => response[16],\n :cvv_response_code => response[17],\n :bank_response_code => response[18],\n :complementary_code => response[19],\n :complementary_info => response[20],\n :return_context => response[21],\n :caddie => response[22],\n :receipt_complement => response[23],\n :merchant_language => response[24],\n :language => response[25],\n :customer_id => response[26],\n :order_id => response[27],\n :customer_email => response[28],\n :customer_ip_address => response[29],\n :capture_day => response[30],\n :capture_mode => response[31],\n :data => response[32]\n } \n \n end", "def response_metadata=(_); end", "def attribute_to_check_message_against; end", "def parse(xml)\n # puts \"response:\\n#{xml}\"\n reply = {}\n xml = REXML::Document.new(xml)\n if (root = REXML::XPath.first(xml, \"//CardDetailsTransactionResponse\")) or\n (root = REXML::XPath.first(xml, \"//CrossReferenceTransactionResponse\")) or\n (root = REXML::XPath.first(xml, \"//ThreeDSecureAuthenticationResponse\"))\n root.elements.to_a.each do |node|\n case node.name \n when 'Message'\n reply[:message] = reply(node.text)\n else\n parse_element(reply, node)\n end\n end\n elsif root = REXML::XPath.first(xml, \"//soap:Fault\") \n parse_element(reply, root)\n reply[:message] = \"#{reply[:faultcode]}: #{reply[:faultstring]}\"\n end\n return reply\n end", "def parse_response(response)\n\n if response[\"outcome\"]==\"success\"\n\n #Assign calorie counts and grams breakdown\n self.total_calories=response[\"fields\"][\"total_calories\"].to_i\n self.protein_grams=response[\"fields\"][\"total_calories\"].to_i\n self.fat_grams=response[\"fields\"][\"fat_grams\"].to_i\n self.carbohydrate_grams=response[\"fields\"][\"carbohydrate_grams\"].to_i\n self.fiber_grams=response[\"fields\"][\"fiber_grams\"].to_i\n\n #Number of coffees\n self.number_of_coffees=response[\"fields\"][\"number_of_coffees\"].to_i\n\n #Assign medications based on response\n if response[\"choice\"]=='only_took_morning_meds'\n self.morning_medications=true\n self.evening_medications=false\n\n elsif response[\"choice\"]=='only_took_evening_meds'\n self.morning_medications=false\n self.evening_medications=true\n\n elsif response[\"choice\"]=='took_both_morning_and_evening'\n self.morning_medications=true\n self.evening_medications=true\n\n else\n self.morning_medications=false\n self.evening_medications=false\n\n end\n\n self.save \n\n else\n raise \"Bad Scale API callback data\"\n end\n\n end", "def response=(response)\n self.success = response.success?\n self.authorization = response.authorization\n self.message = response.message\n self.params = response.params\n rescue ActiveMerchant::ActiveMerchantError => e\n self.success = false\n self.authorization = nil\n self.message = e.message\n self.params = {}\n end", "def prepare_data\n \t@card_number = @card_number.to_s.gsub(/[^\\d]/, \"\") unless @card_number.nil?\n \t\n \t@test_request = @test_transaction.to_s.downcase == 'true' ? 'TRUE' : 'FALSE'\n\n \tif @recurring_billing.class != String\n \t\tif @recurring_billing == true\n \t\t\t@recurring_billing = \"YES\"\n \t\telsif @recurring_billing == false\n \t\t\t@recurring_billing = \"NO\"\n \t\tend\n \tend\n \t\n \t@expiration = @expiration.strftime \"%m/%y\" rescue nil # in case a date or time is passed\n \t\n \t@method = (@method.nil? || @card_number) ? 'CC' : @method.upcase\n \t\n \t# convert the action\n \tif TYPES.include?(@type)\n \t\t@type = TYPES[@type]\n \telsif ! TYPES.has_value?(@type)\n \t\traise PaymentError, \"The type '#{@type}' is not valid\"\n \tend\t\t\n \t\n \t# add some required fields specific to this payment gateway and the provided data\n \t@required += %w(method type login test_request delim_data relay_response)\n \n # If a transaction key is specified, use that instead\n \tif @transaction_key.nil?\n \t @transaction_key = nil\n \t\t@required += %w(password)\n \telse\n \t @password = nil\n \t\t@required += %w(transaction_key)\n \tend\n \t\n \tunless @method == 'VOID'\n \t\tif @method == 'ECHECK'\n \t\t\t@required += %w(amount routing_code account_number account_type bank_name account_name account_type)\n \t\t\t@required += %w(customer_org customer_ssn) unless @customer_org.nil?\n \t\telsif @method == 'CC'\n \t\t\t@required += %w(amount)\n \t\t\tif @type == 'PRIOR_AUTH_CAPTURE'\n \t\t\t\t@required += @order_number ? %w(order_number) : %w(card_number expiration)\n \t\t\telse\n \t\t\t\t@required += %w(card_number expiration)\n \t\t\tend\n \t\telse\n \t\t\traise PaymentError, \"Can't handle transaction method: #{@method}\"\n \t\tend\n \tend\n \t\n \[email protected]!\n end", "def process(amount, action, response_body, options={})\n result = Paygate::Response.new(false, amount, \"debit\", options)\n response = Hash.from_url_params(response_body)\n if response['Len'] && response['Data']\n length = response[:Len].to_i\n encrypted_text = response['Data']\n raw_text = Blowfish.decrypt(encrypted_text, length)\n \n puts \"-> raw response \" + raw_text\n \n content = Hash.from_url_params(raw_text)\n\n status = case content['Status']\n when /FAILED/ then false\n when /OK/ then true\n else\n false\n end\n \n result = Paygate::Response.new(status, amount, action, \n {:trans_id => content['TransID'], :pay_id => content['PayID'], :x_id => content['XID'],\n :description => content['Description'], :code => content['Code'], :m_id => content['mid']})\n end\n result\n end", "def add_credit_card(xml, credit_card, address)\n\n xml.tag! :Card do\n\n # DataCash calls the CC number 'pan'\n xml.tag! :pan, credit_card.number\n xml.tag! :expirydate, format_date(credit_card.month, credit_card.year)\n\n # optional values - for Solo etc\n if [ 'switch', 'solo' ].include?(card_brand(credit_card).to_s)\n\n xml.tag! :issuenumber, credit_card.issue_number unless credit_card.issue_number.blank?\n\n if !credit_card.start_month.blank? && !credit_card.start_year.blank?\n xml.tag! :startdate, format_date(credit_card.start_month, credit_card.start_year)\n end\n end\n\n xml.tag! :Cv2Avs do\n xml.tag! :cv2, credit_card.verification_value if credit_card.verification_value?\n xml.tag! :cv2_present, '1' if credit_card.verification_value?\n\n if address\n xml.tag! :street_address1, address[:address1] unless address[:address1].blank?\n xml.tag! :street_address2, address[:address2] unless address[:address2].blank?\n xml.tag! :street_address3, address[:city] unless address[:city].blank?\n xml.tag! :street_address4, address[:state] unless address[:state].blank?\n xml.tag! :postcode, address[:zip] unless address[:zip].blank?\n xml.tag! :country, address[:country] unless address[:country].blank?\n end\n\n # The ExtendedPolicy defines what to do when the passed data\n # matches, or not...\n #\n # All of the following elements MUST be present for the\n # xml to be valid (or can drop the ExtendedPolicy and use\n # a predefined one\n # xml.tag! :ExtendedPolicy do\n # xml.tag! :cv2_policy,\n # :notprovided => POLICY_REJECT, # REJ\n # :notchecked => POLICY_REJECT, # REJ\n # :matched => POLICY_ACCEPT,\n # :notmatched => POLICY_REJECT, # REJ\n # :partialmatch => POLICY_REJECT\n # xml.tag! :postcode_policy,\n # :notprovided => POLICY_ACCEPT,\n # :notchecked => POLICY_ACCEPT,\n # :matched => POLICY_ACCEPT,\n # :notmatched => POLICY_REJECT, # REJ\n # :partialmatch => POLICY_ACCEPT\n # xml.tag! :address_policy,\n # :notprovided => POLICY_ACCEPT,\n # :notchecked => POLICY_ACCEPT,\n # :matched => POLICY_ACCEPT,\n # :notmatched => POLICY_REJECT, # REJ\n # :partialmatch => POLICY_ACCEPT\n # end\n end\n end\n end", "def parse(xml)\n response = {}\n\n xml = REXML::Document.new xml \n\n # every Wirecard-Response, success or failure, must have a status and transaction-state\n status = REXML::XPath.first(xml, \"//status\")\n transaction_id = REXML::XPath.first(xml, \"//transaction-id\")\n request_id = REXML::XPath.first(xml, \"//request-id\")\n transaction_state = REXML::XPath.first(xml, \"//transaction-state\")\n \n if status and transaction_state and transaction_state.text\n\n # either extract response values...\n response[:TransactionState] = transaction_state.text\n response[:Code] = status.attributes[\"code\"]\n response[:Description] = status.attributes[\"description\"]\n response[:Severity] = status.attributes[\"severity\"]\n response[:TransactionId] = transaction_id.text if transaction_id\n response[:RequestId] = request_id.text if request_id\n\n else\n # ...or add general failure message\n response[:Message] = \"No valid XML response message received. \\nPropably wrong credentials supplied with HTTP header.\"\n end\n\n response\n end", "def credit_card_type; end", "def action_card_bd(input)\n utoken = params[:xml][:FromUserName]\n card_info = Card.where(:utoken=>utoken).order('updated_at desc').first\n return build_response_text_temp {|msg|\n msg.Content=t(:notbindinghelp)\n } if card_info.nil?\n card_info[:isbinded]=true\n card_info.save\n #persist user request\n log_use_request {|request|\n request.lastaction = RequestAction::ACTION_JF_BIND\n }\n return build_response_text_temp {|msg|\n msg.Content = t(:bindingsuccess)\n }\n end", "def transaction_response(hash)\n @direct_pay = @response.body\n @transaction = CGI::parse(@direct_pay)\n if @transaction['ACK'].to_sentence == \"Failure\" and @transaction['L_LONGMESSAGE0'].to_sentence.present? and @transaction['L_ERRORCODE0'].present?\n message = @transaction['L_LONGMESSAGE0'].to_sentence\n return true, message\n elsif @transaction['ACK'].to_sentence == \"Success\"\n @amount = @transaction['AMT'].to_sentence.to_i\n # @event_order_id =\n @transaction_id = @transaction['TRANSACTIONID'].to_sentence\n @status = 'success'\n @currency_code = 'USD'#, payment_params[:currency_code]\n @pg_sy_paypal_payment = create_paypal_payment(amount: @amount, event_order_id: @event_order_id, transaction_id: @transaction_id, status: @status, currency_code: @currency_code)\n return @pg_sy_paypal_payment\n else\n message = 'Error in payment'\n return true, message\n end\n end", "def response_pair_attributes\n ['enum', 'version', 'ctime', 'pair_type', 'code1', 'time1', 'code2', 'time2', 'time_diff']\n end", "def build_transaction_info\r\n if info_available?\r\n @message = qsi_response\r\n all_keys.each do |key|\r\n key.chomp!\r\n @response[key] = digital_reciept_info(key)\r\n end \r\n end\r\n end", "def process_response(params={})\n member=params[:member]\n text=params[:text]\n mode=params[:mode] # (SMS or email)\n#puts \"**** process_response: self.id=#{self.id}, member=#{member}, text=#{text}\"\n#puts \"**** sent_messages = #{self.sent_messages}\"\n sent_message = self.sent_messages.detect {|m| m.member_id == member.id}\n#puts \"**** sent_message=#{sent_message}\"\n if sent_message && (sent_message.msg_status.nil? || sent_message.msg_status < MessagesHelper::MsgResponseReceived ) \n sent_message.update_attributes(:msg_status=>MessagesHelper::MsgResponseReceived,\n :confirmation_message=>text, :confirmed_time => Time.now, :confirmed_mode => mode)\n else\n AppLog.create(:code => \"Message.response\", \n :description=>\"Message#process_response called for message #{self.id}, member=#{member}, but corresponding sent_message record was not found\", :severity=>'error')\n end\n end", "def build_res_obj(card_title, speech_text, attribution = \"\", card_image = nil, card_text = nil,)\n res = {\n \"version\" => \"1.0\",\n \"response\" => {\n \"outputSpeech\" => {\n \"type\" => \"PlainText\",\n \"text\" => speech_text\n },\n \"card\" => {\n \"title\" => card_title\n },\n \"shouldEndSession\" => true\n }\n }\n\n if card_text == nil\n card_text = speech_text\n end\n\n if attribution != \"\"\n card_text += \"\\n\\n\" + attribution\n end\n\n if card_image == nil\n res[\"response\"][\"card\"][\"type\"] = \"Simple\"\n res[\"response\"][\"card\"][\"content\"] = card_text\n else\n res[\"response\"][\"card\"][\"type\"] = \"Standard\"\n res[\"response\"][\"card\"][\"text\"] = card_text\n res[\"response\"][\"card\"][\"image\"][\"largeImageUrl\"] = card_image\n end\n\n return res\nend", "def initialize(params = {})\n @card_number = nil\n @errors = []\n @expiration_date = nil\n self.attributes = params\n end", "def optionals\r\n %w[\r\n request_id\r\n status\r\n failed_telephone_numbers\r\n result\r\n ]\r\n end", "def handle_verify_response(response)\n verify_response = response\n status = verify_response[\"data\"][\"status\"]\n charge_code = verify_response[\"data\"][\"chargecode\"]\n\n if charge_code == \"00\" && status == \"successful\"\n res = {\"error\": false, \"transaction_complete\": true, \"data\": verify_response[\"data\"]}\n return JSON.parse(res.to_json)\n else\n res = {\"error\": false, \"transaction_complete\": false, \"data\": verify_response[\"data\"]}\n return JSON.parse(res.to_json)\n end\n end", "def response_message\n parsed_response['message']\nend", "def card\n @data[:credit_card]\n end", "def process_card(card_data) # card_dat --> hash con toda la informacion de l tarjeta de credito\n\t\toptions = payment_options #options es todo el hash \n\t\toptions[:payer][:payment_method] = \"credit_card\"\n\t\toptions[:payer][:funding_instruments] = [{\n\t\t\tcredit_card: {\n\t\t\t\ttype: CreditCardValidator::Validator.card_type(card_data[:number]), #visa, mastercard\n\t\t\t\tnumber: card_data[:number], #numero de la cuenta\n\t\t\t\texpire_month: card_data[:expire_month],\n\t\t\t\texpire_year: card_data[:expire_year],\n\t\t\t\tcvv2: card_data[:cvv2]\n\t\t\t}\n\t\t}]\n\t\tself.payment = Payment.new(options)\n\t\tself.payment\n\tend", "def cvv_result(response)\n case response[:raw][:CardSecurityCodeMatch]\n when \"Pass\"\n return \"M\" # Match\n when \"Fail\"\n return \"N\" # No Match\n else\n return \"P\" # Not Processed\n end\n end", "def update_credit_card\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def testable_response_attributes(response)\n testable_response(response)['data']['attributes']\n end", "def response_params\n # params[:response]\n params.require(:response).permit(:response_num, :thread_board_id, :user_name, :user_email, :user_ipaddress, :comment)\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 success_response(api_response, response)\n @response_details = response[:envelope][:body][:create_pickup_reply]\n end", "def attributes\n {\n cards_attributes: cards.map(&:attributes), # { |card| card.attributes },\n wallet_token: wallet_token,\n first_name: first_name,\n last_name: last_name,\n email: email,\n age: age,\n account_number: account_number\n }\n end", "def success_response(api_response, response)\n @response_details = response[:cancel_pickup_reply]\n end", "def card_detection\n end", "def process_response\n case @msg.sip_method\n when :INVITE\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n when :ACK\n when :CANCEL\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response_to_cancel(@msg)\n return\n end\n else\n if client_transaction = @msg.connection.class.non_invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n end\n log_system_debug \"ignoring a response non matching a client transaction (#{@msg.sip_method} #{@msg.status_code})\" if $oversip_debug\n end", "def attributes\n {\n cards_attributes: cards.map(&:attributes),\n wallet_token: wallet_token,\n first_name: first_name,\n last_name: last_name,\n email: email,\n age: age,\n account_number: account_number\n }\n end", "def attributes_status_messages\n messages = []\n # messages << ( senior.blank? ? \"Senior is blank\" : nil)\n # # check all these attributes, but save processor time with condition within block\n messages += [ :senior, :installation_datetime, :created_by, :credit_debit_card_proceessed, :bill_monthly, :legal_agreement_at, :paper_copy_submitted_on, :created_at, :updated_at, :shipped_at, :sc_account_created_on ].collect {|e| e if self.send(e).blank? }\n # messages += [ :installation_datetime, :created_by, :credit_debit_card_proceessed, :bill_monthly,\n # :legal_agreement_at, :paper_copy_submitted_on,\n # :created_at, :updated_at ].collect {|e| self.send(e).blank? ? \"#{e.to_s.gsub('_',' ').capitalize} is blank\" : nil }\n # # check some methods too\n messages += [:chest_strap, :belt_clip, :gateway, :call_center_account].collect {|e| e if self.senior.send(e).blank? }\n # messages += [:chest_strap, :belt_clip, :gateway,\n # :call_center_account].collect {|e| self.senior.send(e).blank? ? (\"Senior does not have \"+ e.to_s.gsub('_',' ').capitalize) : nil }\n # # dial_up_numbers should also be ok\n messages += :dial_up_numbers if dial_up_numbers_ok?\n # dial_up_numbers_ok? ? nil : \"Dial up numbers are not as expected\" # do not bother if already failed\n # messages.compact\n messages.flatten.compact.uniq.collect {|e| e.to_s.gsub('_',' ').capitalize }\n end", "def sample_fund_account_response(success)\n if success\n raw_response = OpenStruct.new(\n parsed_response: {\"success\"=>true, \"fund_id\"=>\"RF13-09261098-12\", \"amount\"=>5000},\n code: 200\n )\n else\n raw_response = OpenStruct.new(\n parsed_response: {\n \"success\"=>false,\n \"error_message\"=>\"The supplied input entity was invalid.\",\n \"invalid_inputs\"=>[\n {\n \"field\"=>\"credit_card.billing_address.zip\",\n \"error\"=>\"integer value found, but a string is required \"\n }\n ]\n },\n code: 403\n )\n end\n Tangocard::Response.new(raw_response)\n end", "def test_successful_authorize_credit_card_webhook_metadata\n test_successful_purchase_credit_card_webhook_metadata(false, true, false)\n end", "def extract_transfer_response(counter_sign)\n if counter_sign == true\n self.tx_id = response[\"transfer\"]\n else\n hsh = {\n \"tx_id=\" => \"bitmarkId\",\n \"pay_tx_id=\" => \"transferId\",\n }\n extract_values_from_response(hsh)\n parse_payments\n tx_info\n end\n end", "def build_verify_request(credit_card, options)\n timestamp = new_timestamp\n xml = Builder::XmlMarkup.new indent: 2\n xml.tag! 'request', 'timestamp' => timestamp, 'type' => 'otb' do\n add_merchant_details(xml, options)\n xml.tag! 'orderid', sanitize_order_id(options[:order_id])\n add_card(xml, credit_card)\n add_comments(xml, options)\n add_signed_digest(xml, timestamp, @options[:login], sanitize_order_id(options[:order_id]), credit_card.number)\n end\n xml.target!\n end", "def parse_response_packet(data_received)\n begin\n answers_received = Array.new\n transaction_ID, flags, questions, answers, authority_rrs, additional_rrs, lookup_host, query_type, query_class = data_received.unpack(\"S>S>S>S>S>S>Z*S>S>\")\n \n offset = (2 * 6) + (lookup_host.length + 1) + (2 * 2)\n answer_offset = offset\n\n for answer_index in 1..answers \n answer_name, answer_type, answer_class, answer_time_to_live, answer_data_length = data_received.slice(answer_offset, data_received.length - offset).unpack(\"S>S>S>L>S>\")\n answer_offset += (2 * 3) + (1 * 4) + (2 * 1)\n answer_host = parse_answer_host(data_received, answer_offset, answer_data_length, answer_type)\n answer_offset += answer_data_length\n\n answer = OpenStruct.new\n answer.type = answer_type\n answer.time_to_live = answer_time_to_live\n answer.address = answer_host\n answers_received.push(answer)\n end\n \n rescue\n puts \"Unable to parse response\"\n return nil\n end\n return answers_received\nend", "def prepare_credit_card\n @card = ActiveMerchant::Billing::CreditCard.new({\n :number => card_number,\n :month => card_month,\n :year => card_year,\n :first_name => card_first_name,\n :last_name => card_last_name,\n :verification_value => card_verification,\n :type => card_type\n })\n \n if @card.valid?\n @result[:card] = true\n else\n @result[:card] = false\n end\n @result[:card]\n end", "def code\n @response_attributes['Code'];\n end", "def attributes\n \tdata = super # get the current JSON object\n \n # check if user is valid, and if so return appropriate info\n data[:is_valid] = object.valid?\n unless object.valid?\n # lets handle only the first error for now\n data[:error_field] = object.errors.messages.first[0]\n data[:error_string] = object.errors.messages.first[1][0]\n\n # these are all the errors\n data[:errors] = object.errors.messages\n end\n\n # card flavors\n card_flavors = CardFlavor.where(card_id: data[:id])\n data[:card_flavors] = card_flavors\n\n # card images\n card_images = CardImage.where(card_id: data[:id])\n \n # card_image_urls = card_images.map { \n # \t|image| image.picture.url if image.picture? \n \t\t# }.compact\n\n \tdata[:card_images] = card_images\n\n \tdata\n end", "def extra\n {\n identifier_type: raw_info[\"identifierType\"],\n method: raw_info[\"method\"],\n assurance_level: raw_info[\"assuranceLevel\"],\n status: raw_info[\"status\"]\n }\n end", "def attributes\n \tdata = super # get the current JSON object\n \n # check if user is valid, and if so return appropriate info\n order = object\n data[:is_valid] = order.valid?\n unless order.valid?\n # lets handle only the first error for now\n data[:error_field] = order.errors.messages.first[0]\n data[:error_string] = order.errors.messages.first[1][0]\n\n # these are all the errors\n data[:errors] = order.errors.messages\n end\n\n data[:order_occasion] = order.occasion\n\n # attach card information if the order is a card\n card_id = data[:card_id]\n card = Card.find_by(id: card_id)\n data[:card] = card\n\n card_images = CardImage.where(card_id: card_id)\n card_image_urls = card_images.map { \n |image| image.picture.url if image.picture? \n }.compact\n data[:card_images] = card_image_urls\n\n # attach recipient information\n recipient_id = data[:recipient_id]\n if recipient = Recipient.find_by(id: recipient_id)\n data[:recipient] = recipient\n\n # get recipient address\n recipient_address = recipient.addresses.first\n data[:recipient_address] = recipient_address\n\n # recipient profile picture if it exists\n profile_picture = recipient.profile_pictures.first\n if profile_picture && profile_picture.picture?\n data[:recipient_picture] = profile_picture.picture.url\n end\n end\n\n data\n\n end", "def validate_response(response) \n case response.code\n when '200' \n return\n when '400' # Bad Request error - invalid request\n raise ResponseError::BadRequestError.new(extact_error_message(response.body))\n when '401' # Unauthorised error\n raise ResponseError::UnauthorisedError.new(extact_error_message(response.body))\n when '403' # Forbidden error - valid request but server is refusing, may be due to lack of permissions (RETRY enabled)\n raise ResponseError::ForbiddenError.new(extact_error_message(response.body))\n when '404' # Not Found error - server is unable to locate the resource to serve\n raise ResponseError::NotFoundError.new(extact_error_message(response.body))\n when '500' # Internal Server error - error due to unknown reason\n raise ResponseError::InternalServerError.new(extact_error_message(response.body))\n when '502' # Bad Gateway error - error due to not receiving valid response from backend server \n raise ResponseError::BadGatewayError.new(extact_error_message(response.body))\n when '503' # Service Unavailable error - server is overloded or under maintainance (RETRY enabled)\n raise ResponseError::ServiceUnavailableError.new(extact_error_message(response.body))\n when '504' # Gateway Timeout error - not receiving response within the allowed time period (RETRY enabled)\n raise ResponseError::GatewayTimeoutError.new(extact_error_message(response.body))\n else\n raise ResponseError::UnexpectedError.new(extact_error_message(response.body))\n end\n end", "def error_code_from(response)\n success_from(response) ? nil : STANDARD_ERROR_CODE[:card_declined]\n end", "def initialize(attributes = {})\n requires!(attributes, :xml, :code, :message)\n \n @response_xml = attributes[:xml]\n @response_code = attributes[:code]\n @message = attributes[:message]\n end", "def response_params\n params.require(:response).permit(:text_value, :numeric_value, :date_value, :enumeration_id, :plan_id, :requirement_id, :label_id, :lock_version, :current_user_id)\n end", "def credit_card_number; end", "def card_params\n params.require(:card).permit(:card_type, :request_type, :activity_type, :requester_name, :requester_email, :requester_div, :contact_names, :title, :short_description, :prev_work, :accomplish, :benefits, :goal_alignment, :at_stake, :ext_pressure, :non_tech, :time_constraints, :priority, :sponsor, :more_info, :short_name, :in_cycle, :start_cycle, :done_cycle, :card_status, :ext_link, :lit_lead, :lit_dept, :service_lead, :other_contacts, :comments, :at_stake_details, :accomplish_details, :non_tech_details, :benefits_details, :ext_pressure_details, :time_constraints_details, :exp_start_month, :exp_start_month_month, :exp_start_month_year, :exp_end_month, :exp_end_month_month, :exp_end_month_year, :epic)\n end", "def failed_purchase_response\n <<~XML\n <ccTxnResponseV1 xmlns=\"http://www.optimalpayments.com/creditcard/xmlschema/v1\">\n <confirmationNumber>126740506</confirmationNumber>\n <decision>DECLINED</decision>\n <code>3009</code>\n <actionCode>D</actionCode>\n <description>Your request has been declined by the issuing bank.</description>\n <avsResponse>B</avsResponse>\n <cvdResponse>M</cvdResponse>\n <detail>\n <tag>InternalResponseCode</tag>\n <value>160</value>\n </detail>\n <detail>\n <tag>SubErrorCode</tag>\n <value>1005</value>\n </detail>\n <detail>\n <tag>InternalResponseDescription</tag>\n <value>auth declined</value>\n </detail>\n <txnTime>2009-01-08T17:00:46.529-05:00</txnTime>\n <duplicateFound>false</duplicateFound>\n </ccTxnResponseV1>\n XML\n end", "def wrapperresult(response)\n\t\tif response.class == String\n\t\t\treturn response\n\t\telse\n\t\t\tresult = Hash.new\n\t\t\t#set header value\n\t\t\theader = response.getAuthenticationResponse\n\t\t\tresult['sessionId'] = header.getSessionId\n\t\t\tresult['timeStamp'] = header.getTimeStamp\n\t\t\tresult['messageCode'] = header.getMessageCode\n\t\t\tresult['message'] = header.getMessage\n\t\t\t\n\t\t\t#set body value\n\t\t\tif (response.getResponseBody.value != nil)\n\t\t\t\tbody = response.getResponseBody.value.getClearingRefused\n\t\t\t\tabody = response.getResponseBody.value.getClearingAcknowledgement\n\t\t\t\tif ( body != nil)\n\t\t\t\t\tresult['messageId'] = body.getHeader().getMessageId().getValue()\n\t\t\t\t\tresult['inReplyTo'] = body.getHeader().getInReplyTo().getValue()\n\t\t\t\t\tresult['sentBy'] = body.getHeader().getSentBy().getValue()\n\t\t\t\t\tresult['correlationId'] = body.getCorrelationId().getCorrelationIdScheme()\n\t\t\t\t\tresult['correlationIdValue'] = body.getCorrelationId().getValue()\n\t\t\t\t\treason = body.getReason\n\t\t\t\t\tresult['reasonCode'] = reason.get( 0 ).getReasonCode().getValue() \n\t\t\t\t\tresult['description'] = reason.get( 0 ).getDescription()\n\t\t\t\tend\n\t\t\t\tif ( abody != nil)\n\t\t\t\t\tresult['hashToken reference'] = response.getResponseBody.value.getHashToken().getReference()\n\t\t\t\t\tresult['hashToken value'] = response.getResponseBody.value.getHashToken().getValue()\n\t\t\t\t\tresult['messageId'] = abody.getHeader().getMessageId().getMessageIdScheme()\n\t\t\t\t\tresult['messageIdValue'] = abody.getHeader().getMessageId().getValue()\n\t\t\t\t\tresult['inReplyTo'] = abody.getHeader().getInReplyTo().getMessageIdScheme()\n\t\t\t\t\tresult['inReplyToValue'] = abody.getHeader().getInReplyTo().getValue()\n\t\t\t\t\tresult['sentBy'] = abody.getHeader().getSentBy().getMessageAddressScheme()\n\t\t\t\t\tresult['sentByValue'] = abody.getHeader().getSentBy().getValue()\n\t\t\t\t\tresult['correlationId'] = abody.getCorrelationId().getCorrelationIdScheme()\n\t\t\t\t\tresult['correlationIdValue'] = abody.getCorrelationId().getValue()\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn result\n\t\tend\n\tend", "def response_fields\n metadata.fetch(:fields, []).map do |name_hash, field|\n ResponseField.new(name_hash[:name], field)\n end\n end", "def parse_response(context) \n @user_context = {\n :cobrand_id => context[:cobrand_id],\n :channel_id => context[:channel_id],\n :locale => { \n :country => context[:locale][:country], \n :language => context[:locale][:language], \n :variant => context[:locale][:variant] \n },\n :tnc_version => context[:tnc_version],\n :application_id => context[:application_id],\n :cobrand_conversation_credentials => {\n :session_token => context[:cobrand_conversation_credentials][:session_token]\n }, \n :preference_info => {\n :currency_code => context[:preference_info][:currency_code],\n :time_zone => context[:preference_info][:time_zone],\n :date_format => context[:preference_info][:date_format],\n :currency_notation_type => context[:preference_info][:currency_notation_type],\n :number_format => {\n :decimal_separator => context[:preference_info][:number_format][:decimal_separator],\n :grouping_separator => context[:preference_info][:number_format][:grouping_separator],\n :group_pattern => context[:preference_info][:number_format][:group_pattern]\n }\n },\n :conversation_credentials => {\n :session_token => context[:conversation_credentials][:session_token]\n }, \n :valid => context[:valid],\n :is_password_expired => context[:is_password_expired],\n :attributes! => {\n :conversation_credentials => {\"xsi:type\" => \"login:SessionCredentials\"},\n :cobrand_conversation_credentials => { \"xsi:type\" => \"login:SessionCredentials\"}\n }\n }\n end", "def parse_response(context) \n @user_context = {\n :cobrand_id => context[:cobrand_id],\n :channel_id => context[:channel_id],\n :locale => { \n :country => context[:locale][:country], \n :language => context[:locale][:language], \n :variant => context[:locale][:variant] \n },\n :tnc_version => context[:tnc_version],\n :application_id => context[:application_id],\n :cobrand_conversation_credentials => {\n :session_token => context[:cobrand_conversation_credentials][:session_token]\n }, \n :preference_info => {\n :currency_code => context[:preference_info][:currency_code],\n :time_zone => context[:preference_info][:time_zone],\n :date_format => context[:preference_info][:date_format],\n :currency_notation_type => context[:preference_info][:currency_notation_type],\n :number_format => {\n :decimal_separator => context[:preference_info][:number_format][:decimal_separator],\n :grouping_separator => context[:preference_info][:number_format][:grouping_separator],\n :group_pattern => context[:preference_info][:number_format][:group_pattern]\n }\n },\n :conversation_credentials => {\n :session_token => context[:conversation_credentials][:session_token]\n }, \n :valid => context[:valid],\n :is_password_expired => context[:is_password_expired],\n :attributes! => {\n :conversation_credentials => {\"xsi:type\" => \"login:SessionCredentials\"},\n :cobrand_conversation_credentials => { \"xsi:type\" => \"login:SessionCredentials\"}\n }\n }\n end", "def success_response(api_response, response)\n @response_details = response[:create_pickup_reply]\n end", "def receive_response(response); end", "def get_card_params\n params.require(:get_card).permit(:result_no, :generate_no, :e_no, :name, :card_id, :get_type)\n end", "def customer_credit_card_capture_rq(amount, authorization, options)\n xml = Builder::XmlMarkup.new(:indent => 2)\n \n create_qbmsxml_msgs_rq(xml,options) {\n xml.tag!('CustomerCreditCardCaptureRq') do\n xml.tag!('TransRequestID', options[:order_id])\n xml.tag!('CreditCardTransID', authorization)\n xml.tag!('Amount', amount)\n end\n }\n \n xml.target!\n end", "def test_successful_authorize_credit_card_metadata\n test_successful_purchase_credit_card_metadata(false, true, false)\n end", "def initialize(attributes = {})\n @id = attributes[:id] || \"\"\n @token = attributes[:token] || \"\"\n @status = attributes[:status] || \"\"\n @created = attributes[:created] || \"\"\n @original_amount = Utils::Money.from_response(attributes[:originalAmount]) || Money.from_amount(0)\n @open_to_capture_amount = Utils::Money.from_response(attributes[:openToCaptureAmount]) || Money.from_amount(0)\n @payment_state = attributes[:paymentState] || \"\"\n @merchant_reference = attributes[:merchantReference] || \"\"\n @refunds = attributes[:refunds].map { |refund| Refund.from_response(refund) } || [] unless attributes[:refunds].nil?\n @order = Order.from_response(attributes[:orderDetails]) || Afterpay::Order.new\n @events = attributes[:events].map { |event| PaymentEvent.from_response(event) } || [] unless attributes[:events].nil?\n @error = Error.new(attributes) if attributes[:errorId]\n end", "def test_successful_authorize_stored_card_webhook_metadata\n test_successful_purchase_credit_card_webhook_metadata(false, true, true)\n end", "def print_response_details(response)\n # Parse the mutate response to print details about the entities that\n # were created by the request.\n suffix = \"_result\"\n response.mutate_operation_responses.each do |result|\n result.to_h.select {|k, v| v }.each do |name, value|\n if name.to_s.end_with?(suffix)\n name = name.to_s.delete_suffix(suffix)\n end\n\n puts \"Created a(n) #{::Google::Ads::GoogleAds::Utils.camelize(name)} \" \\\n \"with #{value.to_s.strip}.\"\n end\n end\nend", "def successful_purchase_response_without_avs_results\n <<~XML\n <ccTxnResponseV1 xmlns=\"http://www.optimalpayments.com/creditcard/xmlschema/v1\">\n <confirmationNumber>126740505</confirmationNumber>\n <decision>ACCEPTED</decision>\n <code>0</code>\n <description>No Error</description>\n <authCode>112232</authCode>\n <detail>\n <tag>InternalResponseCode</tag>\n <value>0</value>\n </detail>\n <detail>\n <tag>SubErrorCode</tag>\n <value>0</value>\n </detail>\n <detail>\n <tag>InternalResponseDescription</tag>\n <value>no_error</value>\n </detail>\n <txnTime>2009-01-08T17:00:45.210-05:00</txnTime>\n <duplicateFound>false</duplicateFound>\n </ccTxnResponseV1>\n XML\n end", "def all_expected_fields_received?\n @signature_fields ||= %w(idterminal idcomercio idtransaccion importe moneda coderror codautorizacion firma).map{|value| value = value.to_sym}\n [email protected]? && @fields.areset?(@signature_fields)\n end", "def successful_purchase_response\n <<~XML\n <ccTxnResponseV1 xmlns=\"http://www.optimalpayments.com/creditcard/xmlschema/v1\">\n <confirmationNumber>126740505</confirmationNumber>\n <decision>ACCEPTED</decision>\n <code>0</code>\n <description>No Error</description>\n <authCode>112232</authCode>\n <avsResponse>B</avsResponse>\n <cvdResponse>M</cvdResponse>\n <detail>\n <tag>InternalResponseCode</tag>\n <value>0</value>\n </detail>\n <detail>\n <tag>SubErrorCode</tag>\n <value>0</value>\n </detail>\n <detail>\n <tag>InternalResponseDescription</tag>\n <value>no_error</value>\n </detail>\n <txnTime>2009-01-08T17:00:45.210-05:00</txnTime>\n <duplicateFound>false</duplicateFound>\n </ccTxnResponseV1>\n XML\n end", "def card_params\n params.require(:card).permit(:user_id, :ip_address, :first_name, :last_name, :card_type, :card_expires_on, :card_number, :card_verification)\n end", "def attributes_of(response)\n response && response.reject{|k,v| k =~ /^(_rev|puppet_)/ }\n end", "def parse(action, data)\n h = recursively_symbolize_keys(Hash.from_xml(data))\n results = {}\n\n case action\n when 'session_ticket'\n if results[:raw] = h[:QBMSXML][:SignonMsgsRs][:SignonAppCertRs]\n results[:session_ticket] = results[:raw][:SessionTicket]\n end\n \n when 'authonly'\n if results[:raw] = h[:CustomerCreditCardAuthRs]\n results[:transaction_id] = results[:raw][:CreditCardTransID]\n results[:authorization_code] = results[:raw][:AuthorizationCode]\n results[:card_code] = results[:raw][:CardSecurityCodeMatch]\n end\n \n when 'capture'\n if results[:raw] = h[:CustomerCreditCardCaptureRs]\n results[:transaction_id] = results[:raw][:CreditCardTransID]\n results[:authorization_code] = results[:raw][:AuthorizationCode]\n end\n\n when 'purchase'\n if results[:raw] = h[:QBMSXML][:QBMSXMLMsgsRs][:CustomerCreditCardChargeRs]\n results[:transaction_id] = results[:raw][:CreditCardTransID]\n results[:authorization_code] = results[:raw][:AuthorizationCode]\n end\n\n when 'void'\n if results[:raw] = h[:QBMSXML][:QBMSXMLMsgsRs][:CustomerCreditCardTxnVoidOrRefundRs]\n results[:transaction_id] = results[:raw][:CreditCardTransID]\n results[:void_type] = results[:raw][:VoidOrRefundTxnType]\n end\n end\n\n results[:response_code] = results[:raw][:statusCode].to_i\n results[:response_reason_code] = results[:raw][:statusSeverity]\n results[:response_reason_text] = results[:raw][:statusMessage]\n \n results\n end", "def customer_credit_card_txn_void_or_refund_rq(authorization, options)\n xml = Builder::XmlMarkup.new(:indent => 2)\n\n create_qbmsxml_msgs_rq(xml,options) {\n xml.tag!('CustomerCreditCardTxnVoidOrRefundRq') do\n xml.tag!('TransRequestID', options[:order_id])\n xml.tag!('CreditCardTransID', authorization)\n xml.tag!('Amount', options[:amount])\n end\n }\n \n xml.target!\n end", "def card_params\n params.require(:card).permit(:result_no, :generate_no, :e_no, :s_no, :name, :possession, :kind, :card_id)\n end", "def response_message response\n \"%s %s: %s %s (%f)\\n%s\" % [\n *response[:_response_meta].slice(\n :request_method, :request_url, :status_code, :status_message, :total_time\n ).values,\n Yajl::Encoder.encode(response.except(:_response_meta))\n ]\n end", "def response?(params)\n params.key?('responseStatusCode') || params.key?('responseErrorReason')\n end", "def create_response(response, first_response=nil)\n message = message_from(response)\n\n # This allows the second response to grab the auth info from the first\n first_response ||= response\n\n Response.new(!response.has_key?(:ErrCode), message, response,\n :test => test?,\n # The AccessPass and AccessID are used for all alterations to a\n # transaction, so we store that as the authorization instead of TranID\n :authorization => \"#{first_response[:AccessID]}-#{first_response[:AccessPass]}\"\n )\n end", "def card_data\n {:cc_type => cc_type, :last_digits => last_digits, :first_name => first_name, :last_name => last_name, :year => year, :month => month}\n end", "def components(the_body)\n super\n @msisdn = the_body.dig(\"event\", \"resource\", \"sender_msisdn\")\n @till_number = the_body.dig(\"event\", \"resource\", \"till_number\")\n @system = the_body.dig(\"event\", \"resource\", \"system\")\n @first_name = the_body.dig(\"event\", \"resource\", \"sender_first_name\")\n @middle_name = the_body.dig(\"event\", \"resource\", \"sender_middle_name\")\n @last_name = the_body.dig(\"event\", \"resource\", \"sender_last_name\")\n end", "def assign_back_office_data(response)\n @flbt_type = response[:flbt_type]\n @srv_code = response[:service_code]\n @version = response[:tare_version]\n @submitted_date = response[:submitted_date]\n @effective_date = response[:effective_date]\n @filing_date = response[:filing_date]\n @number_of_buyers = response[:no_of_buyers].to_i\n @ads_included = (response[:ads_included] == 'Y')\n @ads_amount = response[:ads_amount]\n end", "def initialize(response, connection)\n @location = response.header[\"location\"]\n @status_code = response.code\n @status_message = response.message\n \n if response.body\n \n #If a receipt was returned, parse it\n begin\n #ensure that there are not parse errors. If there are, warn, rather then raise\n @entry = ::Atom::Entry.parse(response.body) \n @has_entry = true\n @entry.http = connection\n rescue Exception => message\n @has_entry = false\n $stderr.puts \"ERROR: An error occured processing the Response XML: #{message}\"\n rescue StandardError => error\n @has_entry = false\n $stderr.puts \"WARN: The deposit was successful, but there was an issue with Response XML. It could be missing. (#{error})\"\n end\n \n else\n #if the receipt was not returned, try and retrieve it\n if @location\n @entry = ::Atom::Entry.parse(connection.get(@location).body)\n @has_entry = true\n else\n #Otherwise, there is no receipt (e.g. for a delete)\n @has_entry = false\n @entry = nil\n end\n end\n end", "def reply_card(response)\n target_word = response.matches[0][0]\n card = create_card(target_word)\n response.reply(card)\n end" ]
[ "0.61268073", "0.60191095", "0.5977031", "0.5905689", "0.5897183", "0.58259875", "0.58104795", "0.57855916", "0.56892395", "0.5680177", "0.561494", "0.5587721", "0.5579416", "0.5546234", "0.55269426", "0.5503862", "0.54973763", "0.5494215", "0.54765517", "0.5470537", "0.5466945", "0.5460733", "0.5433648", "0.54195976", "0.54061997", "0.53762853", "0.5374506", "0.5368931", "0.5362308", "0.53608674", "0.5354924", "0.53546524", "0.53543824", "0.5341233", "0.5339457", "0.53213257", "0.5303963", "0.52958375", "0.5288809", "0.52505547", "0.5249837", "0.52373004", "0.5221283", "0.52148736", "0.52100927", "0.52029514", "0.5199579", "0.51989704", "0.519365", "0.5192098", "0.51816154", "0.51793665", "0.5178413", "0.5173957", "0.51666564", "0.5164463", "0.51627034", "0.51475877", "0.5143324", "0.5140829", "0.5140061", "0.5132764", "0.5116768", "0.5106986", "0.510349", "0.50972885", "0.509688", "0.50959504", "0.5088109", "0.50878066", "0.5079568", "0.5079327", "0.5064286", "0.506108", "0.50504565", "0.5041323", "0.5041323", "0.50412285", "0.50375676", "0.5035779", "0.5033178", "0.50272435", "0.5022621", "0.5010901", "0.50058544", "0.50039285", "0.50037175", "0.5003109", "0.49991694", "0.49955526", "0.49954656", "0.49822783", "0.4980611", "0.4975911", "0.49755195", "0.49731198", "0.49730268", "0.4968469", "0.49607816", "0.49537033", "0.49507666" ]
0.0
-1
GET /users GET /users.json
def index @users = User.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def list_users\n self.class.get('/users')\n end", "def users\n get('get_users')\n end", "def index\n users = User.all\n json_response(users)\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end", "def get \n render :json => User.find(params[:id])\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def index\n users = User.all\n render json: users \n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n json_response(User.all) \n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def index\n users = User.all \n render json: users \n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend", "def list\n render json: User.all\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def user\n render :json=> User.find(params[:id])\n end", "def index\n\n users = User.all \n render json: users\n\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end", "def list\n get('users')['users']\n end", "def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end", "def index\n @users = User.all \n render json: @users, status: :ok \n end", "def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n render json: User.all\n end", "def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end", "def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end", "def index\n render json: User.all\n end", "def index\n render json: User.all\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend", "def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end", "def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def show\n user = User.find(params[:id])\n\n render json: user\n end", "def index \n render json: User.all\n end", "def index\n @myusers = Myuser.all\n\n render json: @myusers\n end", "def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end", "def users\n\t\trespond_with User.all\n\tend", "def index\n @users = User.all\n\n respond_with do |format|\n format.json do\n render json: @users,\n each_serializer: Api::UserSerializer,\n root: 'users'\n end\n end\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end" ]
[ "0.82109934", "0.7873764", "0.7860689", "0.78108346", "0.78067017", "0.7678852", "0.76586664", "0.76318866", "0.7582366", "0.75291824", "0.7487637", "0.74485743", "0.7439024", "0.7437192", "0.7427442", "0.73978853", "0.73978853", "0.73978853", "0.73978853", "0.7377353", "0.7372414", "0.736885", "0.7368531", "0.7367068", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7351495", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.73463756", "0.73426867", "0.7331111", "0.73231107", "0.73227614", "0.73126787", "0.7295692", "0.7274169", "0.7265484", "0.72624177", "0.72607577", "0.722517", "0.72189873", "0.71941674", "0.71883225", "0.7187108", "0.71815044", "0.717089", "0.71695215", "0.7156781", "0.71546155", "0.71546155", "0.7140691", "0.7135879", "0.7134857", "0.71316093", "0.71315825", "0.712011", "0.7114429", "0.7112858", "0.7107888", "0.7098051", "0.70957917", "0.70957917", "0.7093039", "0.70904744", "0.70890427", "0.70889443", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685" ]
0.0
-1
GET /users/1 GET /users/1.json
def show @user = User.find_by(params[:id]) @weather = OpenWeatherApi.new("dae8d10e4ffe898434f2932fc31d48d2").get_weather(current_user.checklists.last.destination) @description = @weather['weather'][0]['description'] @icon = @weather['weather'][0]['icon'] @temp = @weather['main']['temp'] @humidity = @weather['main']['humidity'] wind = @weather['wind']['speed'] @wind = wind.round # @temp = @weather.get_weather('miami')['weather'][0]['description'] @date = @user.checklists.last.date # @weather = OpenWeatherApi.new('dae8d10e4ffe898434f2932fc31d48d2').get_weather(@user.checklists.last.destination)['main'] # Start of destination scrape destUrl = "http://www.10best.com/destinations/all/" destResponse = HTTParty.get(destUrl) # p response.headers['Content-Type'] #String => Nokgiri::HTML => DocumentObjectModel (DOM) destDom = Nokogiri::HTML(destResponse.body) # p dom.css('html') #gives everything wthin the html tag destinations = destDom.css('a.rss') @cities = [] destinations.each do |city| @cities << city.text end @links = [] destinations.each do |link| @links << 'http://www.10best.com' + link['href'] end # End of destination scrape @cityQuery = @cities.sample cat = "Miami" if @cities.include? @@citySearch @cityQuery = @@citySearch cat = @@cityCat @tryit = @@cityCat else @tryit = "NOpe!" end @citySelect = @cityQuery.split(",")[0] @cityIndex = @cities.index(@cityQuery) # Start of attractions scrape @attrUrl = @links[@cityIndex] + "attractions/best-attractions-activities/" attrResponse = HTTParty.get(@attrUrl) #String => Nokgiri::HTML => DocumentObjectModel (DOM) attrDom = Nokogiri::HTML(attrResponse.body) # p dom.css('html') #gives everything wthin the html tag attractions = attrDom.css('.list-headline h2') @venue = [] attractions.each do |place| @venue << place.text end # Get two random attractions and give them their own variables @venues = @venue.sample(3) @venue_one = @venues[0] @venue_two = @venues[1] @venue_three = @venues[2] # Index of random photo to grab correct picture @index_one = @venue.index(@venue_one) @index_two = @venue.index(@venue_two) @index_three = @venue.index(@venue_three) images = attrDom.css('img.lazy') @image = [] images.each do |picture| @image << 'https:' + picture['data-src'] end # Select image link based on index of random photo @image_one = @image[@index_one] @image_two = @image[@index_two] @image_three = @image[@index_three] # End of attractions scrape # # Start of Flickr API FlickRaw.api_key="3d403357fbd5a290f43a9b6cd0216a4a" FlickRaw.shared_secret="7ea1e588cac6c790" args = {:tags => "#{@citySelect} #{cat}"} @flickrsearch = [] discovered_pictures = flickr.photos.search args discovered_pictures.each{|p| url = FlickRaw.url p; @flickrsearch << url} # @flickrpics = @flickrsearch.map {|f| "<img src='#{f}'>"} # End of Flickraw API end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def get \n render :json => User.find(params[:id])\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def user\n render :json=> User.find(params[:id])\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n user = User.find(params[:id])\n\n render json: user\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end", "def show\n render json: User.find(params[\"id\"])\n end", "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end", "def show\n @user = User.find(params[:id])\n render json: @user\nend", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def show\n render json: User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end", "def show\n render json: User.find(params[:id])\n end", "def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end", "def list_users\n self.class.get('/users')\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end", "def show\n render :json => User.find(params[:id])\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end", "def index\n users = User.all\n json_response(users)\n end", "def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def index\n json_response(User.all) \n end", "def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end", "def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end", "def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end", "def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end", "def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end", "def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end", "def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end", "def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def show\n # puts params[:id]\n render json: User.find(params[:id])\n end", "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 show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end", "def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end", "def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def index\n users = User.all\n render json: users \n end", "def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end", "def index\n users = User.all \n render json: users \n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end", "def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end", "def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n render :json => User.all, status: 200\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end" ]
[ "0.81049806", "0.77023244", "0.77010894", "0.7625595", "0.75821865", "0.74811673", "0.74603444", "0.7446582", "0.7305236", "0.72992796", "0.72888285", "0.72772574", "0.72345036", "0.72321355", "0.72321355", "0.72321355", "0.72321355", "0.72321355", "0.72321355", "0.72321355", "0.7223994", "0.7223994", "0.7223994", "0.7223994", "0.7223994", "0.7223994", "0.7223994", "0.7223994", "0.72214663", "0.7215248", "0.72132754", "0.72082794", "0.71929723", "0.7181689", "0.7180638", "0.7180638", "0.7178728", "0.7175399", "0.7172813", "0.71627665", "0.7162101", "0.7143687", "0.7143666", "0.7129714", "0.7124243", "0.71153057", "0.7094403", "0.7092913", "0.7077438", "0.7070191", "0.7069559", "0.7063156", "0.7055034", "0.702385", "0.7014574", "0.700358", "0.6997105", "0.69899493", "0.6982484", "0.69776964", "0.69716275", "0.69712365", "0.69668674", "0.6965548", "0.6956316", "0.69506884", "0.6944119", "0.69426507", "0.69335526", "0.6932269", "0.6932269", "0.6932269", "0.6932269", "0.69264674", "0.69239247", "0.69235474", "0.69178694", "0.690779", "0.6893773", "0.6882643", "0.6876047", "0.6874133", "0.6863834", "0.68603235", "0.6857571", "0.68555224", "0.6852691", "0.6852691", "0.6852691", "0.6852691", "0.6852691", "0.6852691", "0.6852691", "0.6852691", "0.6852691", "0.6852691", "0.68526655", "0.68495524", "0.68472683", "0.68472683", "0.68472683" ]
0.0
-1
POST /users POST /users.json
def create @user = User.new(user_params) @user.user_id = current_user.id respond_to do |format| if @user.save format.html { redirect_to @user, notice: 'user was successfully created.' } format.json { render :show, status: :created, location: @user } else format.html { render :new } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end", "def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def create\n user = User.create(user_params) \n render json: user, status: :created\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end", "def create\n user= User.create(user_params)\n render json: user\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend", "def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end", "def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def create(options = {})\n request(:post, '/users.json', default_params(options))\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end", "def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = @application.users.create(user_params)\n\n if @user.valid?\n render json: @user, status: :created, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end", "def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end", "def create\n\n puts '-----------------------create in user controller'\n\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end", "def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end", "def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user.users.build(user_params)\n\n if @user.save\n render json: @user\n else\n @user_items = []\n end\n end", "def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end", "def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render :json => user, :status => :created\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end", "def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end", "def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end", "def create\n user = User.new(params[:user].permit(:username))\n if user.save\n render json: user\n else\n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n puts '>>> params:'\n puts params.inspect\n @user = User.new(params[:user])\n puts '>>> User:'\n puts @user.inspect\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n \tdata = { data: @user, status: :created, message: \"User was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @user.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user.as_json(only: [:email, :authentication_token]), status: :created\n else\n head(:unprocessable_entity)\n end\n end", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def create\n @user = User.new(params[:user])\n\n if @user.save\n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n render :ok, json: @user.to_json\n else\n @errors = @user.errors.full_messages\n render json: { message: @errors }, status: :unauthorized\n end\n end", "def create\n puts params\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user.as_json(user: current_user), status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new({name: params[:name], email: params[:email], password: params[:password], photo: params[:photo]})\n @user.save\n render json:@user\n end", "def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end", "def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend", "def create\n\t\tresp = {} \n user = User.create(user_params)\n \tif user.valid?\n if user.save\n return render :json => user.as_json\n end\n end\n render json: user.errors.full_messages \n\tend", "def post_users_with_http_info(users, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_users ...'\n end\n # verify the required parameter 'users' is set\n if @api_client.config.client_side_validation && users.nil?\n fail ArgumentError, \"Missing the required parameter 'users' when calling UsersApi.post_users\"\n end\n # resource path\n local_var_path = '/users'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(users) \n\n # return_type\n return_type = opts[:return_type] || 'User' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#post_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_user(options = {})\n post \"/users\", options\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save \n format.html { redirect_to users_url, notice: \"User #{@user.name} was successfully created.\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(body)\n post 'create_user', body\n end", "def create\n @user = User.new(user_params)\n @user.email = params[:email].downcase\n if @user.save\n render json: @user, status: 200\n else\n render json: { errors: @user.errors.full_messages }, status: 400\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json:@user\n elsif @user.errors\n render json: {error: {code: 400, server_message: @user.errors}}, status: :bad_request\n else\n render json: {error: {code: 500, message: \"Could not save user\", server_message: @user.errors}}, status: :internal_server_error\n end\n\n end", "def create\n user = User.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end", "def create\n @user = User.new(user_params)\n @user.save\n respond_with @user\n end", "def create\n @user = User.new(user_params)\n render json: @user && return if @user.save\n\n render json: { error: \"Unable to save user: #{@user.errors.messages}\" }, status: 400\n end", "def create\n params[:user][\"_id\"] = params[:user][:name]\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save()\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(attributes)\n post(\"/v1/users\", attributes)\n end", "def create\n user = User.new(user_params)\n\n # if user is saved sucessfully it will return user and ith status 201 for created\n if user.save\n render json:user,status: :created\n #if request is properly served but data is wrong it ll give ubprocessable_entity with code 422\n else\n render json: user.errors, status: :unprocessable_entity\n end \n end", "def create\r\n @user = User.new(params[:user])\r\n\r\n respond_to do |format|\r\n if @user.save\r\n format.html { redirect_to users_path, notice: 'Os dados do usuário foram salvos com sucesso!' }\r\n format.json { render json: @user, status: :created, location: @user }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end", "def post(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/users\").with_json(hash.to_json).post { |hash| Apidoc::Models::User.new(hash) }\n end", "def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n render json: user, status: :created\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: {message: \"user create successfuly\"}\n else\n render json: {message: \"Error\"}\n end \n end", "def create\n # Insert new user in database\n user = User.new(user_params)\n\n if user.save\n # On success, send token information to authenticate user\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n # render json: @user, status: :created, location: @user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(params[:user])\n @user.status = 'active'\n\n respond_to do |format|\n if @user.save\n format.json { render :json => @user, :status => :created }\n format.html { redirect_to(users_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end", "def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end", "def create\n @user = User.new(params[:user])\n puts params[:user]\n respond_to do |format|\n if @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.create(user_params)\n if user.valid?\n user.username.downcase\n @token = issue_token(user)\n list = List.create(name: user.username)\n list.user_id = user.id\n user.save\n list.save\n render json: { user: UserSerializer.new(user), jwt: @token }, status: :created \n else \n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end \n end", "def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :json => { :status => 0 }\n else\n render :json => { :status => 1, :msg => @user.errors}\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token }, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n authorize :user, :create?\n @user = User.new(user_params)\n @user.save\n\n respond_to do |format|\n format.html\n format.json { render :json => @user, status: 200 }\n end\n end", "def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end", "def create\n user = User.new(username: params[:username])\n if user.save\n payload = {'user_id': user.id}\n token = JWT.encode(payload, 'chatapp')\n render json: {\n user: user,\n token: token\n }\n else \n render json: { message: 'There was an error creating your account' }\n end\n end", "def create\n user = User.create!(user_params)\n if user\n session[:user_id] = user.id\n render json: user, status: :created\n else\n render json: { errors: user.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def create\r\n @user = User.new user_params\r\n\r\n if @user.save\r\n render json: @user, serializer: SessionSerializer, root: nil\r\n else\r\n render json: { errors: @user.errors }, status: :unprocessable_entity\r\n end\r\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: { status: 'OK', msg: 'User was created.', error: 'nil' },\n status: :created\n else\n not_good(422)\n end\n end" ]
[ "0.77179813", "0.75206673", "0.73831296", "0.72405374", "0.719841", "0.7140812", "0.71038526", "0.7058827", "0.7041636", "0.70236504", "0.7003128", "0.70021695", "0.70021695", "0.70021695", "0.69936967", "0.6990463", "0.6980393", "0.6979075", "0.69788617", "0.69788617", "0.69762856", "0.6962628", "0.6952247", "0.69454783", "0.69454783", "0.6920555", "0.69181055", "0.691467", "0.6901315", "0.6898759", "0.689459", "0.6889815", "0.6880676", "0.6880467", "0.6880196", "0.68797004", "0.6877297", "0.686924", "0.6855058", "0.6851115", "0.6844058", "0.6814104", "0.6803589", "0.6777842", "0.6776859", "0.67678535", "0.6757897", "0.67471397", "0.6738628", "0.6734963", "0.6733872", "0.6720612", "0.6711659", "0.6670256", "0.66581875", "0.66573423", "0.6654514", "0.6638977", "0.66325235", "0.66199607", "0.6615226", "0.66148156", "0.65989614", "0.65910506", "0.65792614", "0.6578957", "0.6573529", "0.6573351", "0.6557221", "0.6553408", "0.6551572", "0.65466446", "0.6540912", "0.65399504", "0.6538697", "0.6535891", "0.6533581", "0.6526114", "0.65116656", "0.65072525", "0.6507116", "0.6503024", "0.6490388", "0.6488653", "0.64881754", "0.6473845", "0.64722794", "0.64702916", "0.64702916", "0.6469406", "0.64682525", "0.6462379", "0.64619774", "0.646129", "0.6455196", "0.645272", "0.6448271", "0.6447503", "0.64468706", "0.64460355", "0.6441883" ]
0.0
-1
PATCH/PUT /users/1 PATCH/PUT /users/1.json
def update respond_to do |format| if @user.update(user_params) format.html { redirect_to @user, notice: 'user was successfully updated.' } format.json { render :show, status: :ok, location: @user } else format.html { render :edit } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end", "def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end", "def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end", "def update\n user = find_user\n user.update!(user_params)\n render json: user\n end", "def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end", "def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end", "def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end", "def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_user(user_id, body)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?\n path = \"#{users_path}/#{user_id}\"\n patch(path, body)\n end", "def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end", "def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user.update(user_params)\n respond_with @user\n end", "def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = get_user(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_url, notice: \"User #{@user.login_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end", "def update\n @user.update(user_params_update)\n json_response(@user)\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to root_path}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend", "def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end", "def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end", "def update\n # not_found unless @user\n # @user = User.get(params[:id]) || not_found\n\n respond_to do |format|\n if @user.update(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => \"This user was successfully updated!\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end", "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: I18n.t(:users_update) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to user_path(@user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n @current_user.update(user_params)\n render json: @current_user\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7225568", "0.7129473", "0.70036036", "0.6903525", "0.6821961", "0.68157715", "0.6708618", "0.66936064", "0.66810983", "0.6673763", "0.6672601", "0.6664346", "0.6664346", "0.6659468", "0.6659468", "0.6654875", "0.66486204", "0.66436917", "0.6641295", "0.6635214", "0.6618464", "0.66153306", "0.6610267", "0.6607359", "0.6583569", "0.65825915", "0.65820843", "0.65801483", "0.65615994", "0.6558883", "0.6558883", "0.6543664", "0.6537492", "0.6515997", "0.6514648", "0.65062994", "0.65054137", "0.65054137", "0.65015376", "0.6468482", "0.6466442", "0.64641905", "0.6453641", "0.64496416", "0.6443516", "0.6441606", "0.6437562", "0.6428467", "0.6428467", "0.64279026", "0.6427495", "0.64269704", "0.6424723", "0.6424723", "0.64239854", "0.6418606", "0.64156115", "0.6411428", "0.64053625", "0.6405119", "0.6398354", "0.63945407", "0.6390761", "0.63903916", "0.63876307", "0.6383881", "0.63834596", "0.63829523", "0.6382388", "0.63776475", "0.63752687", "0.6374351", "0.63735604", "0.6373269", "0.6370833", "0.6363397", "0.63607967", "0.6360649", "0.6356513", "0.6356091", "0.6350332", "0.6342926", "0.6334242", "0.6333647", "0.6328633", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188" ]
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user.destroy respond_to do |format| format.html { redirect_to users_url, notice: 'user was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end", "def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n format.json { head :no_content }\n end", "def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end", "def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end", "def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.78750724", "0.77518034", "0.7713981", "0.7610077", "0.747295", "0.74073994", "0.74073994", "0.7369968", "0.7346072", "0.7340465", "0.7328618", "0.7309635", "0.73095363", "0.7306841", "0.7297868", "0.72917855", "0.7291585", "0.7289111", "0.7284347", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7245172", "0.7242216", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find_by(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup_handler\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def 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 setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def before_action \n end", "def action\n end", "def 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 setup_signals; end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def after_set_callback; end", "def initialize(*args)\n super\n @action = :set\nend", "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 around_hooks; end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def 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 default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def call\n setup_context\n super\n end", "def duas1(action)\n action.call\n action.call\nend", "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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0.53307265", "0.5312121", "0.5298173", "0.5296388", "0.52952695", "0.5258086", "0.52430934", "0.5237911", "0.5237911", "0.5237911", "0.5237911", "0.5237911", "0.52335346", "0.5232943", "0.5226392", "0.52221715", "0.5217978", "0.52136153", "0.52076435", "0.52067244", "0.5175402", "0.5174649", "0.5173085", "0.5165201", "0.5162052", "0.5157932", "0.5152905", "0.5152353", "0.5150909", "0.514719", "0.5138596", "0.51333916", "0.51139015", "0.5113431", "0.5113431", "0.5109581", "0.51066816", "0.5091428", "0.5089407", "0.5082971", "0.50822043", "0.50668514", "0.5055155", "0.50525695", "0.50499475", "0.50499475", "0.5034445", "0.50249445", "0.5022226", "0.50167644", "0.5014211", "0.4999924", "0.49996212", "0.49978727", "0.4989682", "0.4989682", "0.49851838", "0.49817684", "0.4979687", "0.49787104", "0.49688423", "0.49664098", "0.49564412", "0.49561828", "0.49547398", "0.4953481", "0.4952925", "0.4946049", "0.494379", "0.49319315", "0.49313048", "0.49269778", "0.49263066", "0.49257493", "0.4924526", "0.49212465", "0.49173486", "0.4915802", "0.49151486", "0.49150333", "0.49147308" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_params params.require(:user).permit(:id, :first_name, :last_name, :avatar ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def 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
Import an ActionSpace into the current context
def import_actionspace(name, as: nil) raise ArgumentError, "name may not be nil" if name.nil? # 1. Find the ActionSpace by name space = ActionSpace[name] raise ActionSpaceNotFound, "ActionSpace #{name} not found" if space.nil? # 2. Store the runner context raise InvalidImport, "No Fastlane runner context available" unless respond_to?(:runner) space.runner = runner # 3. Define a method to get the ActionSpace. # TODO: This applies to all instances of the class. Revisit this. self.class.send :define_method, as || name do space end space end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_space(slug, headers=default_headers)\n raise StandardError.new \"An export directory must be defined to import space.\" if @options[:export_directory].nil?\n @logger.info(\"Importing space definition from #{@options[:export_directory]}.\")\n\n # Loop over all provided files sorting files before folders\n Dir[\"#{@options[:export_directory]}/**/*.json\"].map { |file| [file.count(\"/\"), file] }.sort.map { |file| file[1] }.each do |file|\n rel_path = file.gsub(\"#{@options[:export_directory]}/\", '')\n body = JSON.parse(File.read(file))\n if rel_path == \"space.json\"\n api_path = \"/space\"\n @logger.info(\"Importing #{rel_path} to #{api_path}.\")\n body['slug'] = slug\n resp = put(\"#{@api_url}#{api_path}\", body, headers)\n elsif rel_path.match?(/.*\\/workflows\\/.*/)\n # skip workflows,they are inported independently\n next\n elsif body.is_a?(Array)\n api_path = \"/#{rel_path.sub(/^space\\//,'').sub(/\\.json$/,'')}\"\n body.each do |part|\n @logger.info(\"Importing #{rel_path} to #{api_path}.\")\n resp = post(\"#{@api_url}#{api_path}\", part, headers)\n end\n else\n api_path = \"/#{rel_path.sub(/^space\\//,'').sub(/\\/[^\\/]+$/,'')}\"\n # TODO: Remove this block when core API is updated to not export Key\n if api_path == \"/bridges\" && body.has_key?(\"key\")\n body.delete(\"key\")\n end\n @logger.info(\"Importing #{rel_path} to #{api_path}.\")\n resp = post(\"#{@api_url}#{api_path}\", body, headers)\n # TODO: Remove this block when core API is updated to not pre-create SPDs\n if api_path == \"/kapps\"\n kapp_slug = resp.content[\"kapp\"][\"slug\"]\n delete_security_policy_definitions(kapp_slug)\n delete_form_types_on_kapp(kapp_slug)\n end\n end\n end\n @logger.info(\"Finished importing space definition to #{@options[:export_directory]}.\")\n end", "def import\n end", "def import\n end", "def import\n end", "def import\n end", "def export_action_pack(args)\n root = File.expand_path('../..', __FILE__)\n path = root + ACTIONS_DIR\n path = root + '/' + args[:dir] unless args[:dir].nil?\n args[:state_machine].import_action_pack(path)\n end", "def importer\n Importer.new context\n end", "def load_actions\n lib_dir = File.dirname(__FILE__)\n\n a_lib_dir = lib_dir + \"/m_actions\"\n a_files = Dir[File.join(a_lib_dir, \"*.rb\")]\n\n Dir[File.join(a_lib_dir, \"*.rb\")].each do |file|\n f = a_lib_dir + \"/\" + File.basename(file.gsub(/\\.rb$/,''))\n Helpers::log \"Loading action: #{f}\"\n require f\n end\n end", "def context_to_action!\n @context_to_action = true\n end", "def apply\n\t\tunless @already_added\n\t\t\[email protected] @clone\n\t\t\t@already_added = true\n\t\tend\n\t\t\n\t\t@move_action.apply\n\tend", "def import()\n # TODO\n end", "def import\n begin\n Mapspace.import(params[:file])\n redirect_to mapspaces_path, notice: \"Mapspace Data Loaded.\"\n rescue\n redirect_to mapspaces_path, notice: \"Invalid CSV file format.\"\n end\n end", "def import(namespace, options={})\n mod = Namespace.open(namespace)\n\n name = options[:as] || options['as'] || Namespace.basename(namespace)\n raise ConflictError, \"name `#{name}` is already taken\" if method_defined?(name)\n instance_variable_set(\"@#{name}\", mod)\n attr_reader name\n private name\n\n mod\n end", "def import\n Gift.import(params[:file], params[:activity])\n redirect_to import_export_url, notice: \"Gifts imported.\"\n end", "def load_actions\n bin_dir = File.dirname($0)\n main_dir = File.dirname(bin_dir)\n\n lib_dir = File.join(main_dir, \"lib\")\n a_lib_dir = lib_dir + \"/a_actions\"\n a_files = Dir[File.join(a_lib_dir, \"*.rb\")]\n\n Dir[File.join(a_lib_dir, \"*.rb\")].each do |file|\n f = a_lib_dir + \"/\" + File.basename(file.gsub(/\\.rb$/,''))\n Helpers::log \"Loading action: #{f}\"\n require f\n end\n end", "def _actions(action = nil)\n @_actions ||= Mash.new{|h,k| h[k] = ActionManager.new}\n action.nil? ? @_actions : @_actions[action]\n end", "def local_action(command, id, action)\n super(command,id,ACTION[action])\n end", "def setup_projectile\n return unless PONY::ERRNO::check_sequence(current_act)\n skill_id = @acts[1]\n source = @acts[2]\n target = @acts[3]\n Game_Action.new(source, target, $data_skills[skill_id])\n end", "def import(name,namespace = nil)\n # TODO: Deal with recursion. If A imports B and B imports A, we\n # will get stuck.\n namespace = namespace.gsub(ContentClassesNamespace,C_empty).gsub(/^::/,C_empty)\n ft = File.join(@docroot,namespace.gsub(ClassSeparator,C_slash),name)\n template_class = nil\n if namespace != C_empty\n @@view_suffixes.each do |suffix|\n if FileTest.exist?(\"#{ft}#{suffix}\")\n template_class = \"#{namespace}::#{name}\"\n break\n end\n end\n end\n template_class = name unless template_class\n\n if reload_scan_mode == Csingular\n reloadModified(template_class,true,true)\n else\n reload File.new(pathForName(template_class))\n end\n end", "def boot_space\n @space = object_with_type Parfait::Space\n @space.classes = make_dictionary\n @space.types = make_dictionary\n Parfait::Space.set_object_space @space\n end", "def done_migrating(action)\n @free_tems[[@rindex_tems[action[:with]], action[:with]]] = true\n @with[action[:secpack]] << action[:to]\n end", "def import!\n return selected_importer.import!\n end", "def define_action_hook; end", "def wkf_action(action, context={})\n self.class.rpc_exec_workflow(action, self.id) #FIXME looks like OpenERP exec_workflow doesn't accept context but it might be a bug\n reload_from_record!(self.class.find(self.id, :context => context))\n end", "def import\n if params[:location_id]\n @location = Location.find(params[:location_id])\n elsif params[:resource_id]\n @parent_resource = Resource.find(params[:resource_id])\n @location = @parent_resource.location\n end\n\n command = ImportArchivesspaceEadCommand.new(\n params[:files], @parent_resource, @location, current_user,\n request.remote_ip)\n begin\n command.execute\n rescue => e\n flash['error'] = \"#{e}\"\n redirect_back fallback_location: location_url(@location)\n else\n if command.object.length > 0\n flash['success'] = \"Imported #{command.object.length} resource(s).\"\n else\n flash['notice'] = 'Unable to detect an ArchivesSpace EAD XML file in '\\\n 'any of the uploaded files.'\n end\n redirect_back fallback_location: location_url(@location)\n end\n end", "def instantiate_controller_and_action_names\n\t @current_action = action_name\n\t @current_controller = controller_name\n\tend", "def instantiate_controller_and_action_names\n @current_action = action_name\n @current_controller = controller_name\n end", "def allow_space\n name = params[:namespace]\n @space = Space.find_space(@user, name).take || not_found\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def run_actions; end", "def export\n\t\t\told_context = @current_context\n\t\t\t@current_context = Context.new(@project, nil)\n\t\t\t@exports << @current_context\n\t\t\tyield\n\t\t\told_context.add_import(@current_context)\n\t\t\t@current_context = old_context\n\t\tend", "def instantiate_controller_and_action_names\n @current_action = action_name\n @current_controller = controller_name\n end", "def instantiate_controller_and_action_names\n @current_action = action_name\n @current_controller = controller_name\n end", "def instantiate_controller_and_action_names\n @current_action = action_name\n @current_controller = controller_name\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def action_hook; end", "def actions; end", "def pass_control(action, point)\n\t\t# setup new one\n\t\taction.setup self, point\n\t\t\n\t\t# if there's an action currently in play,\n\t\t# clean up old one, and be rid of it\n\t\tif @active\n\t\t\[email protected]\n\t\t\t@active = nil\n\t\tend\n\t\t\n\t\t# store the new action\n\t\t@active = action\n\tend", "def set_space\n @space = Space.friendly.find(params[:id])\n redirect_to root_path unless @space.present?\n end", "def add_actions; end", "def scaffold_include(action = :default)\n @scaffold_include\n end", "def change_space(namespace)\n update!(name: namespace)\n end", "def _init_action(action_hash)\n obj = _load_asset(ASSET_TYPE_ACTION, action_hash[:name])\n obj.parameters = action_hash[:parameters]\n obj\n end", "def start_importation!\n if can?(:import)\n importing!\n Courses::ImportJob.perform_later self\n end\n end", "def set_space\n space_class = Thinkspace::Common::Space\n space_id = ENV['SPACE_ID']\n if space_id.present?\n @space = space_class.find_by(id: space_id)\n raise_error \"Space id #{space_id} not found.\" if space.blank?\n else\n create_space(space_class)\n end\n end", "def new_action(start_pos,end_pos,action_type)\n \n a = ActionManager.new_action(start_pos,end_pos,action_type)\n \n return a\n \n end", "def request_import\n end", "def action_manager\n require 'canis/core/include/actionmanager'\n @action_manager ||= ActionManager.new\n end", "def required_args_for_action\n args = []\n\n case action\n when 'import'\n args << :path\n\n when 'export'\n args << :path\n\n when 'dups'\n args << :format\n\n else\n # Noop\n end\n\n args\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 exec_action_object(action)\n\t\t\taction.execute\n\t\tend", "def add_space(space)\n raise \"Object was not an Innodb::Space\" unless space.is_a?(Innodb::Space)\n\n spaces[space.space_id.to_i] = space\n end", "def initialize_actions(actions, at_action: nil)\n @loading = true unless @strict\n filtered_actions, active_undos = self.class.filtered_actions(actions)\n\n # Store all actions for history navigation\n @raw_all_actions = actions\n filtered_actions.each.with_index { |action, index| @raw_all_actions[index]['skip'] = true unless action }\n\n @undo_possible = false\n # replay all actions with a copy\n filtered_actions.each.with_index do |action, index|\n next if @exception\n break if at_action && action && action['id'] > at_action\n\n if action\n action = action.copy(self) if action.is_a?(Action::Base)\n\n process_action(action)\n else\n # Restore the original action to the list to ensure action ids remain consistent but don't apply them\n @raw_actions << actions[index]\n end\n end\n @redo_possible = active_undos.any?\n @loading = false\n end", "def initialize(*args)\r\n super\r\n @action = :assign\r\nend", "def initialize( name , action )\n super(name)\n\n @action = action\n end", "def action(klass)\n def_delegator :default, klass.action_name\n define_method klass.action_name do |*args, &block|\n new_action = klass.new self, action\n directives.values.each {|it| it.setup! new_action }\n new_action.setup! *args, &block\n new_action.new_flow\n end\n end", "def import!\n return unless imported? or updated?\n\n Outgoing::Workcamp.transaction do\n import_changes.each do |change|\n change.apply(self)\n change.destroy\n end\n\n self.state = nil\n save!\n end\n end", "def import!\n return unless imported? or updated?\n\n Outgoing::Workcamp.transaction do\n import_changes.each do |change|\n change.apply(self)\n change.destroy\n end\n\n self.state = nil\n save!\n end\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def set_ledger_import\n puts \"Action = #{request[:action]}\"\n @ledger_import = LedgerImport.find(params[:id])\n end", "def import(arg = nil)\n set_or_return(\n :import, arg,\n :kind_of => String,\n :default => nil\n )\n end", "def import_workflows(slug, headers=default_headers)\n # Workflows were introduced in core v6\n version = app_version(headers).content[\"version\"]\n if version && version[\"version\"] < \"6\"\n @logger.info(\"Skip importing workflows because the Core server version doesn't support workflows.\")\n return\n end\n\n raise StandardError.new \"An export directory must be defined to import space.\" if @options[:export_directory].nil?\n @logger.info(\"Importing workflows from #{@options[:export_directory]}.\")\n\n # Map of existing workflows by space, kapp, form\n existing_workflows_cache = {}\n # Regular expressions to match workflow paths by space, kapp, or form\n form_re = /^\\/kapps\\/(?<kapp_slug>[a-z0-9]+(?:-[a-z0-9]+)*)\\/forms\\/(?<form_slug>[a-z0-9]+(?:-[a-z0-9]+)*)\\/workflows/\n kapp_re = /^\\/kapps\\/(?<kapp_slug>[a-z0-9]+(?:-[a-z0-9]+)*)\\/workflows/\n space_re = /^\\/workflows/\n\n # Loop over all provided files sorting files before folders\n Dir[\"#{@options[:export_directory]}/space/**/workflows/**/*.json\"].map { |file| [file.count(\"/\"), file] }.sort.map { |file| file[1] }.each do |file|\n rel_path = file.sub(\"#{@options[:export_directory]}/\", '')\n path_parts = File.dirname(rel_path).split(File::SEPARATOR)\n api_parts_path = path_parts[0..-1]\n api_path = \"/#{api_parts_path.join(\"/\").sub(/^space\\//,'').sub(/\\/[^\\/]+$/,'')}\"\n\n # populate the existing workflows for the workflowable object\n matches = form_re.match(api_path)\n # form workflows\n if matches\n form_slug = matches[\"form_slug\"]\n kapp_slug = matches[\"kapp_slug\"]\n map_key = self.space_slug + \"|\" + kapp_slug + \"|\" + form_slug\n if !existing_workflows_cache.has_key?(map_key)\n response = find_form_workflows(kapp_slug, form_slug, { \"includes\" => \"details\" }, headers)\n existing_workflows_cache[map_key] = response.content[\"workflows\"]\n end\n else\n matches = kapp_re.match(api_path)\n # kapp workflows\n if matches\n kapp_slug = matches[\"kapp_slug\"]\n map_key = self.space_slug + \"|\" + kapp_slug\n if !existing_workflows_cache.has_key?(map_key)\n response = find_kapp_workflows(kapp_slug, { \"includes\" => \"details\" }, headers)\n existing_workflows_cache[map_key] = response.content[\"workflows\"]\n end\n else\n # space workflows\n map_key = self.space_slug\n if !existing_workflows_cache.has_key?(map_key)\n response = find_space_workflows({ \"includes\" => \"details\" }, headers)\n existing_workflows_cache[map_key] = response.content[\"workflows\"]\n end\n end\n end\n\n tree_json = JSON.parse(File.read(file))\n event = path_parts.last.split(\"-\").map { |part| part.capitalize }.join(\" \")\n name = tree_json[\"name\"]\n\n body = {\n \"event\" => event,\n \"name\" => name,\n \"treeJson\" => tree_json\n }\n\n # check if the workflow already exists\n existing_workflow = (existing_workflows_cache[map_key] || []).select { |wf|\n wf[\"event\"] == event && wf[\"name\"] == name\n }.first\n\n if existing_workflow\n workflow_id = existing_workflow[\"id\"]\n url = \"#{@api_url}#{api_path}/#{workflow_id}\"\n @logger.info(\"Updating #{event} workflow #{workflow_id} from #{rel_path} to #{url}\")\n resp = put(url, body, headers)\n @logger.warn(\"Failed to update workflow (#{resp.code}): #{resp.content}\") unless resp.code == \"200\"\n else\n url = \"#{@api_url}#{api_path}\"\n @logger.info(\"Importing #{event} workflow from #{rel_path} to #{url}\")\n resp = post(url, body, headers)\n @logger.warn(\"Failed to import workflow (#{resp.code}): #{resp.content}\") unless resp.code == \"200\"\n end\n end\n end", "def import\n log.debug(\"Importing from #{@location}\")\n id = File.basename(@location)\n record = storage_engine.get_by_id(id)\n raise MainControllerError, \"Cannot import a non-exist record\" if record.nil?\n record.whitelist = file_rw_manager.read(\"#{@location}/whitelist\")\n record.blacklist = file_rw_manager.read(\"#{@location}/blacklist\")\n record.qual = \"true\"\n record.auditor = @auditor\n storage_engine.update(record)\n log.info(\"Qualified record #{id} has been successfully imported\")\n end", "def set_action\n @action = Action.find(params[:id])\n end", "def initialize(action: nil, method: nil, namespace: nil, **part_args)\n @action = action\n @method = method\n @namespace = namespace\n\n super(part_args)\n end", "def set_space\n @space = current_user.spaces.friendly.find(params[:id])\n end", "def act(act, file, *args)\n @actions << Action.for(act, file, *args)\n end", "def new(*action_names)\n Module.new do\n extend ActiveSupport::Concern\n include Common\n\n included do\n before_action(:load_interface, :load_dashboard_items, only: action_names)\n layout('etm', only: action_names)\n end\n end\n end", "def set_action_object\n @action_object = ActionObject.find(params[:id])\n end", "def start\n assign_globals\n register_space\n start_message\n build_actions\n start_threads\n end", "def begin_action(action_name, ttl: 600, data: nil)\n action_channel.begin_action(action_name, ttl: ttl, data: data)\n end", "def init_space\n\t\t\traise \"#{self.class} has not implemented a Space initializer\"\n\t\tend", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def apply_space_template(space)\n parent_space = space.space\n return if parent_space.blank?\n\n template = parent_space.space_template\n return if template.blank?\n\n template.space_template_nodes.each do |n|\n node = n.node\n case node\n when UserFile\n copy_service.copy(node, space.uid)\n when App\n copy_service.copy(node, space.uid)\n else\n raise(\"Space template #{template.id} has Unexpected node #{n.id} of #{node.class} class\")\n end\n end\n end", "def import\n DispensarySource.import(params[:file])\n flash[:success] = 'Dispensary Sources were successfully imported'\n redirect_to dispensary_sources_admin_path \n end", "def setup_action(id)\n # set action id\n @aid = id\n # set time to zero\n @time = 0\n # get commands\n @commands = Combos.commands(self)\n # reset movement commands and input windows\n @moves = []\n # set animation data\n @animation, @animation_frames, @sprite, @extension = Combos.anim_data(self)\n # request combo sprite from player if needed\n @ch.new_combo_sprite = true if @animation != 0 || @sprite != ''\n end", "def controller_action_scope\n @controller_action_scope ||= controller_path.split(\"/\") << action_name\n end", "def put(action, **args); end", "def action_run\n end", "def import_to_directededge\n @database.import('examplestore.xml')\n end", "def reset_action\n @action = nil\n if @@EXECS.include? task\n @action = Action.load(task, self)\n else\n warn \"No action set for #{task}\"\n end\n end", "def accept_space(space)\n space.active! if space.accepted? # always true for private_type spaces\n space.save!\n end", "def action\n @action ||= GroupAction.new(@attributes.fetch('action', {}))\n end", "def before_import ; end", "def set_space(space_id = params[:id])\n @space = Space.find(space_id)\n end", "def apply\n @item.run_action(@action_name, *@action_args, current_intention: self)\n end", "def set_action(action)\n @action = action\n end", "def import(key)\n if key.is_a? Symbol\n const_get(key.to_s.upcase).each { |key| import(key) }\n else\n export(key, ENV.get(key)) \n end\n end", "def set_actions\n actions :all\n end", "def action\n action_name.to_sym\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 unshift(action) \n throw 'Only TimeDomainStack::Action objects can be pushed' unless action.is_a? Action\n\n @actions_stack.unshift action\n end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end" ]
[ "0.54147905", "0.53291094", "0.53291094", "0.53291094", "0.53291094", "0.5287347", "0.52700603", "0.5247813", "0.5226853", "0.5176238", "0.5129133", "0.5105586", "0.5099724", "0.50697017", "0.5039565", "0.5032458", "0.49889284", "0.49663967", "0.49304217", "0.49274954", "0.49146557", "0.4913409", "0.49114025", "0.48624334", "0.48396334", "0.48306265", "0.48266807", "0.48139244", "0.48081848", "0.48081848", "0.48081848", "0.48081848", "0.48081848", "0.4807465", "0.47945085", "0.47890303", "0.47886842", "0.47886842", "0.47886842", "0.47789085", "0.47779188", "0.47779188", "0.47720417", "0.4766557", "0.4756085", "0.4755348", "0.47412997", "0.47412485", "0.471587", "0.47151062", "0.4711287", "0.4689887", "0.46791968", "0.4671554", "0.46682236", "0.4667798", "0.46677572", "0.46652755", "0.46597204", "0.46530345", "0.46483955", "0.46468914", "0.46463463", "0.46444064", "0.46444064", "0.46263587", "0.4625247", "0.46165684", "0.46150804", "0.46132684", "0.46101564", "0.46059802", "0.45957428", "0.4593471", "0.45767635", "0.4572545", "0.45529896", "0.45487085", "0.4545446", "0.454111", "0.4538452", "0.45373896", "0.45317927", "0.4529964", "0.45230192", "0.45215562", "0.45173493", "0.45109504", "0.45057353", "0.44986284", "0.44915444", "0.44898605", "0.44893923", "0.44885898", "0.44851777", "0.44811365", "0.44802982", "0.44751206", "0.44728664", "0.44710362" ]
0.82096606
0
strip off fields we are not interested in flatten and clean up entities
def cleanup(s) # use these fields: # :created_at, :text, :screen_name, # :hashtags, :urls, :user_mentions # puts "#{s.methods(all: false)}".red puts "language: #{s.lang}".red puts "#hashtags: #{s.hashtags.size}".bold if s.hashtags.any? hashtags = s.hashtags.to_a.map { |o| o["text"] } urls = s.urls.to_a.map { |o| o["expanded_url"] } user_mentions = s.user_mentions.to_a.map { |o| o["screen_name"] } { text: s[:text], screen_name: s[:user][:screen_name], created_at: s[:created_at], hashtags: hashtags, urls: urls, user_mentions: user_mentions } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trim_all_fields\n self.attributes.each{|a| a.strip! if a.class == 'String'}\n end", "def strip_attributes\n self.title = self.title.try :strip\n self.url = self.url.try :strip\n self.author = self.author.try :strip\n self.content = self.content.try :strip\n self.summary = self.summary.try :strip\n self.guid = self.guid.try :strip\n end", "def test_unflatten_model\r\n comm = @mymodel.commentary = 'should be able to recover'\r\n desc = @mymodel.description\r\n name = @mymodel.name\r\n ident = @mymodel.ident\r\n \r\n data = @mymodel.flatten_data\r\n Model.delete(@mymodel)\r\n\r\n seco = Model.model_from_data(data)\r\n\r\n assert_equal(ident, seco.ident) \r\n assert_equal(name, seco.name)\r\n assert_equal(desc, seco.description)\r\n assert_equal(comm, seco.commentary) \r\n \r\n end", "def unnormalized\n document.record_entity_expansion unless document.nil?\n v = value()\n return nil if v.nil?\n @unnormalized = Text::unnormalize(v, parent)\n @unnormalized\n end", "def nullify_fields\n user_fields = %W(\n comment\n )\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = nil if self[field].empty?\n end\n end", "def sanitize_json(json)\n IndexerCommonConfig.do_not_index.each do |k, v|\n if json[\"jsonmodel_type\"] == k\n # subrec is a reference used to navigate inside of the JSON as specified by the v[:location] to find the part of the tree to sanitize\n subrec = json\n\n v[:location].each do |l|\n unless subrec.nil?\n subrec = subrec[l]\n end\n end\n\n unless subrec.nil?\n subrec[v[:to_clean]] = []\n end\n end\n end\n\n return json\n end", "def sanitize_nested_attributes(mapping)\n key = mapping.keys.first\n klass = mapping[key]\n add_step do |attrs|\n if attrs.has_key?(key)\n attrs[key].compact!\n attrs[key].map! { |val| klass.sanitize_attributes(val) }\n end\n attrs\n end\n end", "def remove_field_names(json_doc, fields_set)\n\n json_doc.reject! { |k, v| not fields_set.include?(k) } if json_doc.is_a?(Hash)\n json_doc.each { |k, v| remove_field_names(json_doc[k], fields_set) } if json_doc.is_a?(Hash)\n json_doc.each { |doc| remove_field_names(doc, fields_set) } if json_doc.is_a?(Array)\n\n json_doc\nend", "def normalize_fields\n @fields = @fields.map do |field|\n case field\n when Symbol, String\n @properties[field]\n\n when Property, Operator\n field\n end\n end\n end", "def clean_attributes\n attributes.delete(:bare_metal)\n attributes.delete(:flavor_id)\n attributes.delete(:ephemeral_storage)\n end", "def nullify_fields\n user_fields = %W(\n name\n email\n address\n )\n\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = nil if self[field].empty?\n end\n end", "def clean_attributes\n return attributes if group.nil? || !group.empty?\n\n filtered_attributes = attributes.dup\n filtered_attributes.delete(:group)\n end", "def normalize_fields!\n # TODO: normalize Array of Symbol, String or DM::Property\n\n # TODO: loop over fields, and if the resource doesn't match\n # self.resource, append the property's resource to @links\n # eg:\n #if property.resource != self.resource\n # @links << discover_path_for_property(property)\n #end\n end", "def remove_field_names_exclusive(json_doc, fields_set)\n\n json_doc.reject! { |k, v| fields_set.include?(k) } if json_doc.is_a?(Hash)\n json_doc.each { |k, v| remove_field_names_exclusive(json_doc[k], fields_set) } if json_doc.is_a?(Hash)\n json_doc.each { |doc| remove_field_names_exclusive(doc, fields_set) } if json_doc.is_a?(Array)\n\n json_doc\nend", "def filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end", "def filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end", "def filter_skip_attributes_from_payload(obj)\n if obj.is_a? Hash\n obj.map do |k, v|\n if k == \"skip_attribute\" && v\n return ''\n else\n obj[k] = filter_skip_attributes_from_payload(v)\n if obj[k].blank?\n obj.delete(k)\n end\n end\n end\n elsif obj.is_a? Array\n obj.each_with_index do |o, i|\n obj[i] = filter_skip_attributes_from_payload(o)\n end\n end\n return obj\n end", "def test_flatten_model\r\n assert_equal( { \"ident\"=>1, \"name\"=>\"rubylicious\", \"commentary\"=>\"\", \"description\"=>\"\"},\r\n @mymodel.flatten_data)\r\n end", "def strip_string_fields\n all_fields = self.get_array_of_symbolic_keys\n # stripping\n all_fields.each do |field|\n unless self[field].nil?\n if self[field].class == String\n self[field] = self[field].strip\n end\n end\n end\n end", "def flattened_fields\n metadata_string = String.from_java_bytes @reader.getMetadata\n description_text = self.class.description_from_metadata_xml(metadata_string)\n begin\n metadata = JSON(description_text)\n flattened_fields = metadata.key?('jpdfer_flattened_fields') ? metadata['jpdfer_flattened_fields'] : {}\n rescue JSON::ParserError\n flattened_fields = {}\n end\n flattened_fields.each_with_object({}) do |(name, value), fields|\n fields[name.to_sym] = value\n end\n end", "def strip_params_before_orm(hash)\n new_hash = hash.dup\n new_hash.delete(\"route_properties\")\n new_hash.delete(\"data_object\")\n\n return new_hash\n end", "def strip_columns\n user_fields = %W(\n name\n email\n address\n )\n\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = self[field].strip\n end\n end", "def remove_excluded_attributes!(hash)\n hash.each do |attr, val|\n if attr.in?(EXCLUDED_ENTITY_ATTRIBUTES)\n hash.delete(attr)\n elsif val.is_a? Array\n val.each {|v| remove_excluded_attributes!(v) if v.is_a?(Hash) }\n elsif val.is_a? Hash\n remove_excluded_attributes!(val)\n end\n end\n end", "def get_field_deserializers()\n return super.merge({\n })\n end", "def get_field_deserializers()\n return super.merge({\n })\n end", "def get_field_deserializers()\n return super.merge({\n })\n end", "def sanitize_attributes!\n remove_invalid_subjects!\n remove_invalid_audiences!\n remove_invalid_levels!\n set_prices!\n nil\n end", "def remove_empty_fields\n self.each_pair do |k, v|\n if self[k].class == Hash\n self[k] = self[k].remove_empty_fields\n else\n self.delete(k) if v.to_s == \"\"\n end\n end\n self\n end", "def pare_entity(entity)\n entity.reject{|key,_| %w(id entityType links).include?(key)}\nend", "def flatten() end", "def flatten!() end", "def transform_attributes\n based_near_values = attributes.delete(:based_near)\n sanitized_attributes\n .merge(file_attributes)\n .merge(location_attributes(based_near_values))\n .merge(nesting_attributes)\n .merge(visibility_attributes)\n .merge(collection_membership_attributes)\n end", "def clean_json records\n json_data = records.as_json # this is as_json method of Mongoid::Criteria class \n\n if json_data.class == Array # if the json data is an array\n json_data.each do |row|\n row[\"id\"] = row.delete \"_id\" # this is to make sure angular recognizes @id when sending requests\n end\n else\n json_data[\"id\"] = json_data.delete \"_id\" # if the json_data is not an array\n end\n\n json_data\n end", "def normalize(input, entities = T.unsafe(nil), entity_filter = T.unsafe(nil)); end", "def sanitize_attributes\n %w(author title description keyword).each do |field|\n self.send(\"#{field}=\",HTMLEntities.new.decode(self.send(field)))\n end\n end", "def normalize(row)\n purchaser = Purchaser.find_by_name(row.fields[0])\n purchaser = Purchaser.create!({ name: row.fields[0] }) unless purchaser\n\n item = Item.find_by_description(row.fields[1])\n item = Item.create!({ description: row.fields[1], price: row.fields[2] }) unless item\n\n purchase = Purchase.new({ purchaser_id: purchaser.id, item_id: item.id, quantity: row.fields[3] })\n purchase.save!\n\n merchant = Merchant.find_by_name(row.fields[5])\n merchant = Merchant.create!({ name: row.fields[5], address: row.fields[4] }) unless merchant\n\n sale = Sale.new({ item_id: item.id, merchant_id: merchant.id})\n sale.save!\n end", "def deepcompact\n ASE::deepcompact(self)\n end", "def strip_columns\n user_fields = %W(\n comment\n )\n\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = self[field].strip\n end\n end", "def clean_attributes(attributes)\n attributes[:license] = Array(attributes[:license]) if attributes.key? :license\n attributes[:rights_statement] = Array(attributes[:rights_statement]) if attributes.key? :rights_statement\n remove_blank_attributes!(attributes)\n end", "def get_field_deserializers()\n return super.merge({\n \"administrativeUnits\" => lambda {|n| @administrative_units = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AdministrativeUnit.create_from_discriminator_value(pn) }) },\n \"attributeSets\" => lambda {|n| @attribute_sets = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttributeSet.create_from_discriminator_value(pn) }) },\n \"customSecurityAttributeDefinitions\" => lambda {|n| @custom_security_attribute_definitions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CustomSecurityAttributeDefinition.create_from_discriminator_value(pn) }) },\n \"deletedItems\" => lambda {|n| @deleted_items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DirectoryObject.create_from_discriminator_value(pn) }) },\n \"federationConfigurations\" => lambda {|n| @federation_configurations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::IdentityProviderBase.create_from_discriminator_value(pn) }) },\n \"onPremisesSynchronization\" => lambda {|n| @on_premises_synchronization = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnPremisesDirectorySynchronization.create_from_discriminator_value(pn) }) },\n })\n end", "def collapse_document(doc)\n doc.keys.each_with_object({}) do |(key, _), result|\n result[key] = doc[key] unless NESTED_OBJECT_FIELD_BLACKLIST.include?(key)\n end\n end", "def preprocess_data\n # Remove things if needed\n if @filter_keys\n @input = @input.delete_if{|k, v| !@filter_keys.include?(k)}\n end\n end", "def flatten!\n self.class.attributes.keys.select { |k| k.end_with?('_data') }.each do |data_attr|\n reference_attr = data_attr[/(.+?)_data$/, 1]\n value = send(data_attr)\n next if value.nil?\n\n send(\"#{data_attr}=\", value)\n send(\"#{reference_attr})\", nil)\n end\n\n self\n end", "def sanitize_associations\n sanitize_association('chapters', Chapter.fields_to_sanitize)\n sanitize_association('series', Series.fields_to_sanitize)\n end", "def normalize!; end", "def normalize; end", "def sanitize\n scrub_payload_emails\n scrub_actor_attributes\n end", "def fill_fields(bf, ef)\n bf.each do |key, value|\n if value != \" \"\n ef.delete(key)\n end\n end\nend", "def model_attributes(params)\n clean_params = super #hydra-editor/app/forms/hydra_editor/form.rb:54\n # model expects these as multi-value; cast them back\n clean_params[:rights] = Array(params[:rights]) if params[:rights]\n clean_params[:title] = Array(params[:title]) if params[:title]\n if params[:description]\n clean_params[:description] = Array(params[:description])\n clean_params[:description].map! do |description|\n ::DescriptionSanitizer.new.sanitize(description)\n end\n end\n # Model expects provenance as single-value.\n if params[:provenance]\n clean_params[:provenance] = ::DescriptionSanitizer.\n new.sanitize(params[:provenance])\n end\n\n # Oops; we're blanking out these values when changing permissions and probably versions, too\n # -- they don't have these fields in the form at all so they don't get repopulated.\n clean_params = encode_physical_container(params, clean_params)\n clean_params = encode_external_id(params, clean_params)\n\n clean_params.keys.each do |key|\n # strip ALL the things!\n if clean_params[key].is_a?(Array)\n clean_params[key].map!(&:strip)\n elsif clean_params[key].is_a?(String)\n clean_params[key] = clean_params[key].strip\n end\n end\n\n clean_params\n end", "def reset_unnecessary_fields\n self.department_id = nil\n self.media = nil\n self.telephone = nil\n self.organization = nil\n self.stream_flow_ids = []\n self.public_role_es = nil\n self.public_role_eu = nil\n self.public_role_en = nil\n self.gc_id = nil\n self.description_es = nil\n self.description_eu = nil\n self.description_en = nil\n self.politician_has_agenda = nil\n end", "def cleanup\n self.city = capwords(city) if (attribute_present?('city') && (self.city != nil))\n self.state = state.upcase if (attribute_present?('state') && (self.state != nil))\n self.street = street.split(\" \").map{|x| x.capitalize}.join(\" \") if (attribute_present?('street') && (street != nil))\n self.street_2 = street_2.split(\" \").map{|x| x.capitalize}.join(\" \") if (attribute_present?('street_2') && (street_2 != nil))\n self.phone = phone.split(\"-\").join(\"\").split(\".\").join(\"\") if (attribute_present?('phone') && (phone != nil))\n self.first_name = capwords(first_name) if (attribute_present?('first_name') && (first_name != nil))\n self.last_name = capwords(last_name) if (attribute_present?('last_name') && (last_name != nil))\n end", "def flattened_entities\n results = []\n \n # Add this organization's entities\n entities.where(:type == 'Person').each do |e|\n results << e\n end\n\n # Add all children organization's entities\n child_organizations.all.each do |o|\n o.flattened_entities.each do |e|\n results << e\n end\n end\n\n # Only return a unique list\n results.uniq{ |x| x.id }\n end", "def non_relationship_fields\n self.fields.select { |field| !field.is_relationship? }\n end", "def empty_unused_fields\n if @publication.scientific_article?\n # Empty fields specific to categories other than scientific_article\n @publication.book_title = ''\n @publication.book_authors = ''\n @publication.book_publisher = ''\n @publication.url = ''\n else\n # Empty fields specific to scientific_article\n @publication.journal_id = 0\n @publication.new_journal_name = ''\n @publication.DOI = ''\n @publication.volume = ''\n @publication.issue = ''\n @publication.pages = ''\n unless @publication.chapter?\n # Empty fields specific to book_chapter\n @publication.book_title = ''\n @publication.book_authors = ''\n end\n end\n end", "def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"owner\" => lambda {|n| @owner = n.get_string_value() },\n \"properties\" => lambda {|n| @properties = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ExtensionSchemaProperty.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_string_value() },\n \"targetTypes\" => lambda {|n| @target_types = n.get_collection_of_primitive_values(String) },\n })\n end", "def cleanup(pet_data, exclude=[])\n data = exclude_keys(pet_data.dup, exclude)\n clean_hash = {}\n data.each do |field|\n key = field[0]\n value = field[1]\n if is_plural? key\n result = value.empty? ? [] :\n value.first.count > 1 ? value.map(&:second).flatten.map { |f| f.first[1] } : value.map(&:second)\n else\n result = value.empty? ? \"\" :\n value.count > 1 ? Hash[value.map { |f| {f.first => f[1]['$t'] || \"\"} }.map(&:flatten)] : value['$t']\n end\n clean_hash[key.underscore.to_s] = result\n end\n clean_hash\n end", "def fix_attributes\n fix_encoding\n strip_attributes\n content_manipulation\n sanitize_attributes\n default_attribute_values\n fix_url\n calculate_unique_hash\n end", "def get_field_deserializers() \n return super.merge({\n \"categories\" => lambda {|o, n| o.categories = n.get_collection_of_primitive_values(String) },\n \"changeKey\" => lambda {|o, n| o.change_key = n.get_string_value() },\n \"createdDateTime\" => lambda {|o, n| o.created_date_time = n.get_date_value() },\n \"lastModifiedDateTime\" => lambda {|o, n| o.last_modified_date_time = n.get_date_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"assignedUserPrincipalName\" => lambda {|n| @assigned_user_principal_name = n.get_string_value() },\n \"groupTag\" => lambda {|n| @group_tag = n.get_string_value() },\n \"hardwareIdentifier\" => lambda {|n| @hardware_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"importId\" => lambda {|n| @import_id = n.get_string_value() },\n \"productKey\" => lambda {|n| @product_key = n.get_string_value() },\n \"serialNumber\" => lambda {|n| @serial_number = n.get_string_value() },\n \"state\" => lambda {|n| @state = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ImportedWindowsAutopilotDeviceIdentityState.create_from_discriminator_value(pn) }) },\n })\n end", "def normalize_includes!\n # TODO: normalize Array of Symbol, String, DM::Property 1-jump-away or DM::Query::Path\n end", "def normalize!\n end", "def cleanup_data(data)\n return data unless data.is_a?(Hash) && data.has_key?('collection')\n data['collection'].each do |item|\n item.each_pair do |k,v|\n # Purge whitespace within values\n v.is_a?(::String) ? v.strip! : v\n\n # Parse JSON values\n if v.is_a?(Array)\n v.map! do |e|\n e = safe_parse_json(e)\n end\n else\n item[k] = safe_parse_json(v)\n end\n end\n end\n data\n end", "def sanitize_attributes\n if self.sanitize_level\n self.description = Sanitize.clean(self.description, self.sanitize_level)\n self.name = Sanitize.clean(self.name, self.sanitize_level)\n end\n end", "def flatten!\n self.replace(flatten)\n end", "def get_field_deserializers()\n return super.merge({\n \"comment\" => lambda {|n| @comment = n.get_string_value() },\n \"createdBy\" => lambda {|n| @created_by = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IdentitySet.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"items\" => lambda {|n| @items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DocumentSetVersionItem.create_from_discriminator_value(pn) }) },\n \"shouldCaptureMinorVersion\" => lambda {|n| @should_capture_minor_version = n.get_boolean_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroups\" => lambda {|n| @section_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroupsUrl\" => lambda {|n| @section_groups_url = n.get_string_value() },\n \"sections\" => lambda {|n| @sections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"sectionsUrl\" => lambda {|n| @sections_url = n.get_string_value() },\n })\n end", "def denormalize(o)\n return o if o[\"denorm\"]\n if @denorm[o[\"Org Code\"]]\n new = o.dup\n new[\"denorm\"] = @denorm[o[\"Org Code\"]]\n return new\n else\n # Not going to deal with older addresses not in 2010\n # for now.\n return o\n end\n matches = o[\"Org Name\"].match(/(.*)\\s-\\s(.*)/)\n district = matches[1]\n school = matches[2]\n label = \n \"DISTRICT: \" + district +\n \", SCHOOL: \" + school\n address = school + ', Massachusetts'\n new = o.dup\n new[\"denorm\"] ||= {}\n new[\"denorm\"][\"district\"] = district\n new[\"denorm\"][\"school\"] = school\n geom = GeoGet.geometry_for(address, label)\n new[\"denorm\"][\"geometry\"] = {\n \"lat\" => geom[\"geometry\"][\"location\"][\"lat\"],\n \"lng\" => geom[\"geometry\"][\"location\"][\"lng\"]\n }\n @denorm[o[\"Org Name\"]] = new[\"denorm\"]\n new\nend", "def flatten\n raise\n end", "def normalize\n\t\t\tself.dup.normalize!\n\t\tend", "def partially_valid_clear\n @partially_valid_attributes = []\n end", "def strip(*fields)\n sanitize(*fields) { |value| value.strip }\n end", "def strip_unenriched(activities, includes)\n activities.map do |act|\n if act['activities'] # Recurse into activity groups\n act['activities'] = strip_unenriched(act['activities'], includes)\n else\n includes.each do |key|\n # If it's an array (nested enrichment), grab the top level\n key = key.first if key.is_a?(Array)\n # Delete if it's still a string\n act.delete(key.to_s) if act[key.to_s].is_a?(String)\n end\n end\n act\n end\n end", "def normalizer; end", "def strip_content(node)\n case node\n when Array\n node.map { |child| strip_content(child) }\n when Hash\n if node.keys.size == 1 && node[\"__content__\"]\n node[\"__content__\"]\n else\n node.inject({}) do |attributes, key_value|\n attributes.merge({ key_value.first => strip_content(key_value.last) })\n end\n end\n else\n node\n end\n end", "def normalized_attributes\n Buildable.normalize_attributes(@attributes ||= {})\n end", "def get_field_deserializers()\n return super.merge({\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"dataType\" => lambda {|n| @data_type = n.get_string_value() },\n \"isSyncedFromOnPremises\" => lambda {|n| @is_synced_from_on_premises = n.get_boolean_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"targetObjects\" => lambda {|n| @target_objects = n.get_collection_of_primitive_values(String) },\n })\n end", "def strip_attributes(attrs_to_check)\n attrs_to_check = model.attribute_names if @attrs_to_manage[:strip] == :all\n\n attrs_to_check.each do |attribute|\n value = strip_attribute(attribute)\n model[attribute] = value if value\n end\n end", "def enriched_fields(entity)\n original_fields = entity.fields\n additional_fields = additional_fields_for(entity)\n original_fields.merge(additional_fields)\n end", "def unnormalized; end", "def get_field_deserializers()\n return super.merge({\n \"appId\" => lambda {|n| @app_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"objectId\" => lambda {|n| @object_id_escaped = n.get_string_value() },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n })\n end", "def remove_initial_and_format_change(info) # removes middle initial for space_names and pipe_names AND puts comma_names into nested arrays\n if !info[0].include?(\"|\") && !info[0].include?(\",\")\n info.map! {|element| element.split(\" \")}\n info.each {|element| element.slice!(-4)} \n info\n elsif info[0].include?(\"|\")\n info.map! {|element| element.split(\" | \")}\n info.each {|element| element.slice!(-4)} \n info\n else\n info.map! {|element| element.split(\", \" )} \n end\nend", "def sanitize_whitespace_during_import!(ke)\n case ke.type\n when :text\n # reduce runs of whitespace and tabs to single space\n ke.value.gsub!(/[ \\t]+/, ' ')\n when :p, :header\n # Remove para or header outer whitespace\n # remove leading whitespace\n if(\n (fc = ke.children.first) &&\n :text == fc.type\n )\n fc.value.gsub!(/\\A[ \\t\\n]+/, '')\n if '' == fc.value\n # remove :text el if it is now empty\n ke.children.delete_at(0)\n # process ke again since there may be new leading whitespace\n sanitize_whitespace_during_import!(ke)\n end\n end\n # remove trailing whitespace\n if(\n (lc = ke.children.last) &&\n :text == lc.type\n )\n lc.value.gsub!(/[ \\t\\n]+\\z/, '')\n if '' == lc.value\n # remove :text el if it is now empty\n ke.children.delete_at(-1)\n # process ke again since there may be new trailing whitespace\n sanitize_whitespace_during_import!(ke)\n end\n end\n end\n end", "def flexi_fields_except_fk\n _field_names = self.associations.values.flatten.map { |_v| :\"#{_v.to_s.singularize}_id\" }\n if none_flexi_fields.present?\n none_flexi_fields.each do |field|\n ['file_name', 'content_type', 'file_size', 'updated_at'].each do |_suffix|\n _field_names << :\"#{field.name.to_s}_#{_suffix}\"\n end\n end\n end\n self.flexi_fields.select { |_f| !_field_names.include?(_f.name.to_sym) }\n end", "def null_controlled_fields!(attrs)\n ::ScoobySnacks::METADATA_SCHEMA.controlled_field_names.each do |field_name|\n # do not null fields that are not being changed\n next unless attrs.keys.include?(\"#{field_name}_attributes\")\n\n object.public_send(\"#{field_name}=\", [])\n end\n end", "def flatten!\n nil\n end", "def normalize\n end", "def blank_out_fields(record, fields)\n fields.to_a.each do |field|\n record[field.to_sym] = '' if record[field.to_sym].nil?\n end\n record\n end", "def termdef_unnest_cleanup(xmldoc)\n desgn = \"//p/admitted | //p/deprecates | //p/preferred | //p//related\"\n nodes = xmldoc.xpath(desgn)\n while !nodes.empty?\n nodes[0].parent.replace(nodes[0].parent.children)\n nodes = xmldoc.xpath(desgn)\n end\n end", "def reset_unnecessary_fields\n self.media = nil\n self.raw_location = nil\n self.lat = nil\n self.lng = nil\n self.city = nil\n self.state = nil\n self.country_code = nil\n self.zip = nil\n self.photo_file_name = nil\n self.photo_content_type = nil\n self.photo_file_size = nil\n self.photo_updated_at = nil\n self.url = nil\n self.organization = nil\n self.stream_flow_ids = []\n self.department_id = nil\n self.public_role_es = nil\n self.public_role_eu = nil\n self.public_role_en = nil\n self.gc_id = nil\n self.description_es = nil\n self.description_eu = nil\n self.description_en = nil\n self.politician_has_agenda = nil\n end", "def get_field_deserializers()\n return {\n \"hubSiteUrls\" => lambda {|n| @hub_site_urls = n.get_collection_of_primitive_values(String) },\n \"propagateToExistingLists\" => lambda {|n| @propagate_to_existing_lists = n.get_boolean_value() },\n }\n end", "def normalize_docs(docs)\n if docs.first.is_a?(::Hash)\n docs.map do |doc|\n attributes = { _association: _association, _parent: _base }\n attributes.merge!(doc)\n Factory.build(klass, attributes)\n end\n else\n docs\n end\n end", "def strip_blanks!\n @content.reject! { |item| item[:type] == :blank }\n end", "def cleanup\n datas[:model_feature_values].each_pair { |model_key, feature_values| \n model = Model.find(model_key)\n feature_keys = []\n model.features_list { |feature| feature_keys << feature.key }\n values(model).delete_if { |feature_key, value| !feature_keys.include?(feature_key) }\n }\n end", "def cleanup\n cleanup_nonces\n cleanup_associations\n end", "def unconverted_fields?() @unconverted_fields end", "def reset_unnecessary_fields\n self.raw_location = nil\n self.lat = nil\n self.lng = nil\n self.city = nil\n self.state = nil\n self.country_code = nil\n self.zip = nil\n self.photo_file_name = nil\n self.photo_content_type = nil\n self.photo_file_size = nil\n self.photo_updated_at = nil\n self.url = nil\n self.media = nil\n self.organization = nil\n self.department_id = nil\n self.public_role_es = nil\n self.public_role_eu = nil\n self.public_role_en = nil\n self.gc_id = nil\n self.description_es = nil\n self.description_eu = nil\n self.description_en = nil\n self.politician_has_agenda = nil\n end", "def deep_clean(data)\r\n proc = Proc.new { |k, v|\r\n if v.kind_of?(Hash) && !v.empty?\r\n v.delete_if(&proc)\r\n nil\r\n end\r\n v.nil? || v.empty?\r\n }\r\n hash.delete_if(&proc)\r\n end", "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdByAppId\" => lambda {|n| @created_by_app_id = n.get_string_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"level\" => lambda {|n| @level = n.get_number_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::PageLinks.create_from_discriminator_value(pn) }) },\n \"order\" => lambda {|n| @order = n.get_number_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSection\" => lambda {|n| @parent_section = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"userTags\" => lambda {|n| @user_tags = n.get_collection_of_primitive_values(String) },\n })\n end", "def normalized_exposures(entity, options)\n return easy_normalized_exposures(entity, options) unless deep_complex_nesting?(entity) # optimization\n\n table = nested_exposures.each_with_object({}) do |exposure, output|\n should_expose = exposure.with_attr_path(entity, options) do\n exposure.should_expose?(entity, options)\n end\n next unless should_expose\n\n output[exposure.key(entity)] ||= []\n output[exposure.key(entity)] << exposure\n end\n\n table.map do |key, exposures|\n last_exposure = exposures.last\n\n if last_exposure.nesting?\n # For the given key if the last candidates for exposing are nesting then combine them.\n nesting_tail = []\n exposures.reverse_each do |exposure|\n nesting_tail.unshift exposure if exposure.nesting?\n end\n new_nested_exposures = nesting_tail.flat_map(&:nested_exposures)\n NestingExposure.new(key, {}, [], new_nested_exposures).tap do |new_exposure|\n if nesting_tail.any? { |exposure| exposure.deep_complex_nesting?(entity) }\n new_exposure.instance_variable_set(:@deep_complex_nesting, true)\n end\n end\n else\n last_exposure\n end\n end\n end", "def clean\r\n\t\t\t@clean ||= json['innerCleanliness']\r\n\t\tend", "def get_field_deserializers()\n return {\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"entityType\" => lambda {|n| @entity_type = n.get_string_value() },\n \"mailNickname\" => lambda {|n| @mail_nickname = n.get_string_value() },\n \"onBehalfOfUserId\" => lambda {|n| @on_behalf_of_user_id = n.get_guid_value() },\n }\n end" ]
[ "0.6245511", "0.620712", "0.6163294", "0.60491514", "0.5951184", "0.591756", "0.5915053", "0.5903186", "0.58924365", "0.5860621", "0.58602786", "0.5823026", "0.57840526", "0.577622", "0.57332706", "0.57332706", "0.57135624", "0.5686968", "0.56647885", "0.5660902", "0.56240076", "0.5603682", "0.5578085", "0.5547943", "0.5547943", "0.5547943", "0.55461484", "0.55452347", "0.5534278", "0.5528153", "0.55243343", "0.55130434", "0.55092186", "0.5497516", "0.5496567", "0.54909676", "0.5485358", "0.5483258", "0.5482605", "0.5468582", "0.54586154", "0.5449935", "0.54366493", "0.54251945", "0.5411296", "0.5411288", "0.5407573", "0.540275", "0.5401014", "0.5378657", "0.53728163", "0.53698355", "0.5360401", "0.5356359", "0.53508013", "0.5343781", "0.53265905", "0.53252125", "0.53242457", "0.5322222", "0.5316705", "0.5314988", "0.531474", "0.5310541", "0.5309542", "0.5306749", "0.53060836", "0.53020626", "0.53019464", "0.5298023", "0.52976775", "0.5292908", "0.52894765", "0.5286502", "0.5284911", "0.52804375", "0.5268744", "0.5267376", "0.5263232", "0.52611744", "0.5260597", "0.525464", "0.5249598", "0.5249512", "0.52423745", "0.52419263", "0.5241659", "0.5241443", "0.5235968", "0.52350503", "0.52279073", "0.5213026", "0.52076834", "0.5206458", "0.5202152", "0.51999444", "0.5196978", "0.5188835", "0.5188088", "0.5186417", "0.5185627" ]
0.0
-1
GET /daftar_pustaka GET /daftar_pustaka.json
def index @daftar_pustaka = DaftarPustaka.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def show\n @sala = Sala.find(params[:id])\n\n render json: @sala, root: \"data\", include: '**', adapter: :json, status: :ok\n end", "def index\n @dnas = Dna.all\n\n render json: @dnas\n end", "def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end", "def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end", "def show\n @zayavka = Zayavka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zayavka }\n end\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def show\n @pengeluaran_bulanan = PengeluaranBulanan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pengeluaran_bulanan }\n end\n end", "def show\n @futbolada = Futbolada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @futbolada }\n end\n end", "def show\n @zakaz = Zakaz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zakaz }\n end\n end", "def set_daftar_pustaka\n @daftar_pustaka = DaftarPustaka.find(params[:id])\n end", "def show\n @vodka = Vodka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vodka }\n end\n end", "def show\n @parlamentarian = Parlamentarian.find_by_id(params[:rdf_uri])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parlamentarian }\n end\n end", "def show\n @deporte= set_deporte\n render json: @deporte, status: :ok\n\n end", "def show\n \n @tarih = Takvim.all\n\n # var olan kodlar\n @odeme_akademist = Odeme::Akademist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odeme_akademist }\n end\n end", "def show\n @db_pekerjaan = DbPekerjaan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @db_pekerjaan }\n end\n end", "def show\n @dato = Dato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dato }\n end\n end", "def show\n @kalplan_tltle = KalplanTltle.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kalplan_tltle }\n end\n end", "def show\n @deuda = Deuda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deuda }\n end\n end", "def index\n @prueba_jsons = PruebaJson.all\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def show\n @dart = Dart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dart }\n end\n end", "def show\n @laundromat = Laundromat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laundromat }\n end\n end", "def index\n @pacientes = Pacientes.all\n render json: @pacientes\n end", "def show\n render json: @departamento\n end", "def show\n @aadt = Aadt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aadt }\n end\n end", "def show\n @turma = Turma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turma }\n end\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def show\n @sklad = Sklad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sklad }\n end\n end", "def create\n @daftar_pustaka = DaftarPustaka.new(daftar_pustaka_params)\n\n respond_to do |format|\n if @daftar_pustaka.save\n format.html { redirect_to @daftar_pustaka, notice: 'Daftar pustaka was successfully created.' }\n format.json { render :show, status: :created, location: @daftar_pustaka }\n else\n format.html { render :new }\n format.json { render json: @daftar_pustaka.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @departamentos = Departamento.all\n\n render json: @departamentos\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 @daps = @farmer.daps.page(params[:page]).per(20)\n end", "def show\n @dolgnost = Dolgnost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dolgnost }\n end\n end", "def show\n @derpu = Derpu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @derpu }\n end\n end", "def show\n @diemtrentuyen = Diemtrentuyen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diemtrentuyen }\n end\n end", "def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\n end\n end", "def show\n @palestrante = Palestrante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palestrante }\n end\n end", "def show\n #@stanza = Stanza.find(params[:id])\n #@stanza = Stanza.where(:stanzno=>params[:id])\n @stanza = Stanza.find_by_no(params[:id]) || not_found\n logger.info @stanza\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stanza }\n end\n end", "def show\n @karteikarte = Karteikarte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @karteikarte }\n end\n end", "def show\n @prestador = Prestador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prestador }\n end\n end", "def show\n @presenza = Presenza.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presenza }\n end\n end", "def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end", "def show\n render json: @lugar\n end", "def show\n @kazoku = Kazoku.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kazoku }\n end\n end", "def show\n\n @fase_pdv = @fase.pdvs.find(params[:id])\n # @fase_pdv.asegurar\n @json = @fase_pdv.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pdv }\n\n end\n end", "def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end", "def show\n # @kokyaku = Kokyaku.find(params[:id])\n @kokyaku = Kokyaku.find(:first, :conditions => {:kokyakuId => params[:id], :delFlg => 0})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kokyaku }\n end\n end", "def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end", "def show\n render json: @archdiocese\n end", "def show\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipomedalla }\n end\n end", "def show\n @pichanga = Pichanga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pichanga }\n end\n end", "def index\n @puntajes = Puntaje.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puntajes }\n end\n end", "def show\n @diaoboshang = Diaoboshang.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diaoboshang }\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 @todofuken = Todofuken.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todofuken }\n end\n end", "def show\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n render json: @tipo_pregunta\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 @datoscontacto = Datoscontacto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @datoscontacto }\n end\n end", "def index\n @pendaftaran_kelas = PendaftaranKela.all\n end", "def index\n @pendaftarans = Pendaftaran.all\n end", "def show\n @penjualan_bahan = PenjualanBahan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @penjualan_bahan }\n end\n end", "def show\n @project_tak = ProjectTak.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_tak }\n end\n end", "def show\n @zoneamento = Zoneamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @zoneamento }\n end\n end", "def show\n @pun = Pun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pun }\n end\n end", "def show\r\n\r\n @pdv = Pdv.find(params[:id])\r\n @pdv.asegurar\r\n @json = @pdv.to_gmaps4rails\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @pdv }\r\n\r\n end\r\n end", "def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end", "def show\n @psa = Psa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa }\n end\n end", "def show\n render json: @pizza\n end", "def show\n @taf = Taf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taf }\n end\n end", "def index\n @puntajes = Puntaje.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puntajes }\n end\n end", "def show\n @dinosaur = Dinosaur.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dinosaur }\n end\n end", "def show\n @pedidodetalle = Pedidodetalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pedidodetalle }\n end\n end", "def show\n @zutat = Zutat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zutat }\n end\n end", "def show\n @sotrudniki = Sotrudniki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sotrudniki }\n end\n end", "def show\n render json: @grupoassunto\n end", "def show\n @konyu_rireki = KonyuRireki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konyu_rireki }\n end\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def show\n @nguoi_dung = NguoiDung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nguoi_dung }\n end\n end", "def show\n @lugar = Lugar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lugar }\n end\n end", "def show\n @palabras_buscar = PalabrasBuscar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palabras_buscar }\n end\n end", "def show\n @natulang = Natulang.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @natulang }\n end\n end", "def show\n @denuncia_tipo = DenunciaTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @denuncia_tipo }\n end\n end", "def show\n @palabra = PalabraDecorator.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palabra }\n end\n end", "def show\n @sluzby = Sluzby.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sluzby }\n end\n end", "def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end", "def index\n @dolgnosts = Dolgnost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dolgnosts }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devans }\n end\n end", "def show\n @zona = Zona.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zona }\n end\n end", "def index\n @kraje = Kraj.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kraje }\n end\n end", "def index\n @pizzas = Pizza.all\n render json: @pizzas\n end", "def show\n @produkt = Produkt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produkt }\n end\n end", "def show\n @periodo_academico = PeriodoAcademico.find(params[:id])\n\n render json: @periodo_academico\n end", "def show\n @db_pendidikan = DbPendidikan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @db_pendidikan }\n end\n end", "def show\n @cerveja = Cerveja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cerveja }\n end\n end", "def show\n @pinglun = Pinglun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinglun }\n end\n end", "def show\n @ptrack = Ptrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ptrack }\n end\n end", "def show\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end" ]
[ "0.64741474", "0.64741474", "0.63958836", "0.63112706", "0.62870246", "0.62870246", "0.6265626", "0.62654", "0.62566334", "0.62493145", "0.6246949", "0.6225987", "0.62189925", "0.6215199", "0.62139684", "0.62055737", "0.6189482", "0.6186862", "0.61809856", "0.6174301", "0.6171944", "0.6160637", "0.61571515", "0.61302114", "0.6129671", "0.6113726", "0.6103385", "0.6103238", "0.60997844", "0.60941714", "0.6091339", "0.6088913", "0.6087124", "0.6082087", "0.6080989", "0.6080502", "0.60803026", "0.60627043", "0.60626066", "0.6062275", "0.60432553", "0.60333437", "0.6017938", "0.6016648", "0.60156846", "0.60073805", "0.60039914", "0.6003575", "0.599348", "0.599161", "0.5986431", "0.59847087", "0.5983633", "0.59832776", "0.5981477", "0.5971738", "0.5967938", "0.5967301", "0.59570676", "0.59570676", "0.59488183", "0.59423685", "0.5941905", "0.5940633", "0.59348077", "0.59332746", "0.592556", "0.5920276", "0.59158736", "0.59132874", "0.59092885", "0.59064317", "0.5903192", "0.59030783", "0.5896618", "0.5896198", "0.5893474", "0.58904904", "0.5889978", "0.5877678", "0.5874247", "0.58730394", "0.5870105", "0.5869291", "0.58664554", "0.5862537", "0.58612674", "0.5858977", "0.5858566", "0.58557916", "0.5847813", "0.58474517", "0.5846172", "0.5845239", "0.5842182", "0.58381826", "0.58349603", "0.5831465", "0.5831319", "0.5828621" ]
0.6936833
0
GET /daftar_pustaka/1 GET /daftar_pustaka/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @daftar_pustaka = DaftarPustaka.all\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def show\n @sala = Sala.find(params[:id])\n\n render json: @sala, root: \"data\", include: '**', adapter: :json, status: :ok\n end", "def show\n @dato = Dato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dato }\n end\n end", "def show\n @parlamentarian = Parlamentarian.find_by_id(params[:rdf_uri])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parlamentarian }\n end\n end", "def show\n @dart = Dart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dart }\n end\n end", "def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end", "def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end", "def show\n @db_pekerjaan = DbPekerjaan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @db_pekerjaan }\n end\n end", "def show\n @futbolada = Futbolada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @futbolada }\n end\n end", "def show\n @derpu = Derpu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @derpu }\n end\n end", "def show\n @deuda = Deuda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deuda }\n end\n end", "def index\n @dnas = Dna.all\n\n render json: @dnas\n end", "def show\n @vodka = Vodka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vodka }\n end\n end", "def show\n #@stanza = Stanza.find(params[:id])\n #@stanza = Stanza.where(:stanzno=>params[:id])\n @stanza = Stanza.find_by_no(params[:id]) || not_found\n logger.info @stanza\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stanza }\n end\n end", "def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\n end\n end", "def show\n @pengeluaran_bulanan = PengeluaranBulanan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pengeluaran_bulanan }\n end\n end", "def show\n @diemtrentuyen = Diemtrentuyen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diemtrentuyen }\n end\n end", "def show\n @kalplan_tltle = KalplanTltle.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kalplan_tltle }\n end\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def show\n @dolgnost = Dolgnost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dolgnost }\n end\n end", "def show\n @zakaz = Zakaz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zakaz }\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 @palestrante = Palestrante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palestrante }\n end\n end", "def show\n @zayavka = Zayavka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zayavka }\n end\n end", "def show\n @laundromat = Laundromat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laundromat }\n end\n end", "def show\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n render json: @tipo_pregunta\n end", "def show\n @presenza = Presenza.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presenza }\n end\n end", "def show\n @datoscontacto = Datoscontacto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @datoscontacto }\n end\n end", "def show\n @prestador = Prestador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prestador }\n end\n end", "def show\n @sklad = Sklad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sklad }\n end\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def show\n @karteikarte = Karteikarte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @karteikarte }\n end\n end", "def show\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipomedalla }\n end\n end", "def show\n @aadt = Aadt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aadt }\n end\n end", "def show\n @deporte= set_deporte\n render json: @deporte, status: :ok\n\n end", "def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end", "def show\n @pichanga = Pichanga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pichanga }\n end\n end", "def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end", "def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end", "def index\n @prueba_jsons = PruebaJson.all\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 @turma = Turma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turma }\n end\n end", "def show\n @dinosaur = Dinosaur.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dinosaur }\n end\n end", "def index\n @pacientes = Pacientes.all\n render json: @pacientes\n end", "def show\n \n @tarih = Takvim.all\n\n # var olan kodlar\n @odeme_akademist = Odeme::Akademist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odeme_akademist }\n end\n end", "def show\n @diaoboshang = Diaoboshang.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diaoboshang }\n end\n end", "def show\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\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 @denuncia_tipo = DenunciaTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @denuncia_tipo }\n end\n end", "def show\n @consulta = Consulta.find(params[:id])\n\n render json: @consulta\n end", "def show\n @dteor = Dteor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dteor }\n end\n end", "def show\n @pinglun = Pinglun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinglun }\n end\n end", "def index\n @daps = @farmer.daps.page(params[:page]).per(20)\n end", "def show\n @prayers = Prayer.all\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end", "def show\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @punt }\n end\n end", "def show\n render json: @departamento\n end", "def show\n @psa = Psa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa }\n end\n end", "def show\n @pto = Pto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pto }\n end\n end", "def show\n @nguoi_dung = NguoiDung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nguoi_dung }\n end\n end", "def show\n @db_pendidikan = DbPendidikan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @db_pendidikan }\n end\n end", "def show\n @konyu_rireki = KonyuRireki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konyu_rireki }\n end\n end", "def show\n @kazoku = Kazoku.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kazoku }\n end\n end", "def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end", "def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end", "def show\n @kf_diary = Kf::Diary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_diary }\n end\n end", "def set_daftar_pustaka\n @daftar_pustaka = DaftarPustaka.find(params[:id])\n end", "def show\n @frais_repa = FraisRepa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @frais_repa }\n end\n end", "def show\n @datum = Datum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @datum }\n end\n end", "def show\n @datum = Datum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @datum }\n end\n end", "def show\n @sotrudniki = Sotrudniki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sotrudniki }\n end\n end", "def show\n @ptrack = Ptrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ptrack }\n end\n end", "def show\n @lugar = Lugar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lugar }\n end\n end", "def show\n # @kokyaku = Kokyaku.find(params[:id])\n @kokyaku = Kokyaku.find(:first, :conditions => {:kokyakuId => params[:id], :delFlg => 0})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kokyaku }\n end\n end", "def show\n @natulang = Natulang.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @natulang }\n end\n end", "def show\n @prepagada = Prepagada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prepagada }\n end\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def show\n @taf = Taf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taf }\n end\n end", "def show\n @cerveja = Cerveja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cerveja }\n end\n end", "def show\n render json: @archdiocese\n end", "def show\n @tare = Tare.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tare }\n end\n end", "def show\n @drip = Drip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drip }\n end\n end", "def show\n @pun = Pun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pun }\n end\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def show\n @zoneamento = Zoneamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @zoneamento }\n end\n end", "def show\n @produkt = Produkt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produkt }\n end\n end", "def show\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jamaat }\n end\n end", "def show\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end", "def show\n @project_tak = ProjectTak.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_tak }\n end\n end", "def show\n @periodo_academico = PeriodoAcademico.find(params[:id])\n\n render json: @periodo_academico\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def show\n @penjualan_bahan = PenjualanBahan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @penjualan_bahan }\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 @palabras_buscar = PalabrasBuscar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palabras_buscar }\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", "def show\n @prestacion = Prestacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prestacion }\n end\n end" ]
[ "0.6771569", "0.6655729", "0.6655729", "0.6578853", "0.6528574", "0.6527508", "0.65047264", "0.6503954", "0.6503954", "0.6501789", "0.6493941", "0.643001", "0.6425088", "0.64178", "0.6405621", "0.6390617", "0.6386576", "0.637904", "0.6369358", "0.6342857", "0.6332944", "0.6329211", "0.63276976", "0.63266426", "0.63179374", "0.63066226", "0.6305673", "0.6301626", "0.62951857", "0.62935364", "0.6291095", "0.6288813", "0.627969", "0.6276755", "0.62747663", "0.62507147", "0.62457836", "0.6243148", "0.62284166", "0.6224831", "0.6224562", "0.6217274", "0.6215548", "0.620647", "0.6205815", "0.6199785", "0.619872", "0.6190373", "0.6186492", "0.6185554", "0.6181405", "0.6181405", "0.6180573", "0.61797684", "0.6170472", "0.61661863", "0.61628586", "0.61596423", "0.6156467", "0.61446035", "0.61398464", "0.6133588", "0.61324126", "0.61311084", "0.6129861", "0.6128286", "0.6125458", "0.6123831", "0.61207604", "0.61156", "0.6114029", "0.6112757", "0.6112561", "0.6112036", "0.6112036", "0.61097175", "0.61088103", "0.61078584", "0.6105789", "0.6104106", "0.60971534", "0.60932916", "0.6091", "0.6089935", "0.60885155", "0.6084356", "0.6079997", "0.60776275", "0.6076574", "0.607507", "0.6074415", "0.6073745", "0.60723186", "0.6069852", "0.6068173", "0.6066841", "0.60654694", "0.6064655", "0.6062788", "0.6061468", "0.6060667" ]
0.0
-1
POST /daftar_pustaka POST /daftar_pustaka.json
def create @daftar_pustaka = DaftarPustaka.new(daftar_pustaka_params) respond_to do |format| if @daftar_pustaka.save format.html { redirect_to @daftar_pustaka, notice: 'Daftar pustaka was successfully created.' } format.json { render :show, status: :created, location: @daftar_pustaka } else format.html { render :new } format.json { render json: @daftar_pustaka.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @pendaftaran_kela = PendaftaranKela.new(pendaftaran_kela_params)\n\n respond_to do |format|\n if @pendaftaran_kela.save\n format.html { redirect_to @pendaftaran_kela, notice: 'Pendaftaran kela was successfully created.' }\n format.json { render :show, status: :created, location: @pendaftaran_kela }\n else\n format.html { render :new }\n format.json { render json: @pendaftaran_kela.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pendaftaran = Pendaftaran.new(pendaftaran_params)\n\n respond_to do |format|\n if @pendaftaran.save\n format.html { redirect_to @pendaftaran, notice: \"Pendaftaran was successfully created.\" }\n format.json { render :show, status: :created, location: @pendaftaran }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @pendaftaran.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @data_ukt = DataUkt.new(data_ukt_params)\n\n respond_to do |format|\n if @data_ukt.save\n format.html { redirect_to @data_ukt, notice: 'Data ukt was successfully created.' }\n format.json { render :show, status: :created, location: @data_ukt }\n else\n format.html { render :new }\n format.json { render json: @data_ukt.errors, status: :unprocessable_entity }\n end\n end\n end", "def daftar_pustaka_params\n params.require(:daftar_pustaka).permit(:judul, :keterangan, :lampiran)\n end", "def create\n @postavka = Postavka.new(postavka_params)\n\n respond_to do |format|\n if @postavka.save\n format.html { redirect_to @postavka, notice: 'Postavka was successfully created.' }\n format.json { render action: 'show', status: :created, location: @postavka }\n else\n format.html { render action: 'new' }\n format.json { render json: @postavka.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @penyata_kehadiran = PenyataKehadiran.new(penyata_kehadiran_params)\n\n respond_to do |format|\n if @penyata_kehadiran.save\n format.html { redirect_to @penyata_kehadiran, notice: 'Penyata kehadiran was successfully created.' }\n format.json { render :show, status: :created, location: @penyata_kehadiran }\n else\n format.html { render :new }\n format.json { render json: @penyata_kehadiran.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @daw_alianza = DawAlianza.new(daw_alianza_params)\n\n respond_to do |format|\n if @daw_alianza.save\n format.html { redirect_to @daw_alianza, notice: 'Daw alianza was successfully created.' }\n format.json { render :show, status: :created, location: @daw_alianza }\n else\n format.html { render :new }\n format.json { render json: @daw_alianza.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end", "def create\n @perdida = Perdida.new(perdida_params)\n\n respond_to do |format|\n if @perdida.save\n format.html { redirect_to perdidaa_path, notice: 'Se ha Creado un Registro.' }\n format.json { render :show, status: :created, location: @perdida }\n else\n format.html { render :new }\n format.json { render json: @perdida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @peralatan = Peralatan.new(peralatan_params)\n\n respond_to do |format|\n if @peralatan.save\n format.html { redirect_to @peralatan, notice: 'Peralatan was successfully created.' }\n format.json { render :show, status: :created, location: @peralatan }\n else\n format.html { render :new }\n format.json { render json: @peralatan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prueba_json = PruebaJson.new(prueba_json_params)\n\n respond_to do |format|\n if @prueba_json.save\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prueba_json }\n else\n format.html { render action: 'new' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tiponovedad = Tiponovedad.new(tiponovedad_params)\n\n respond_to do |format|\n if @tiponovedad.save\n format.html { redirect_to @tiponovedad, notice: 'Tiponovedad was successfully created.' }\n format.json { render :show, status: :created, location: @tiponovedad }\n else\n format.html { render :new }\n format.json { render json: @tiponovedad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @padrao = Padrao.new(padrao_params)\n\n respond_to do |format|\n if @padrao.save\n format.html { redirect_to @padrao, notice: 'Padrao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @padrao }\n else\n format.html { render action: 'new' }\n format.json { render json: @padrao.errors, status: :unprocessable_entity }\n end\n end\n end", "def postavka_params\n params.require(:postavka).permit(:zaporednaSt, :kolicina, :popust, :racun_id, :storitev_id)\n end", "def set_daftar_pustaka\n @daftar_pustaka = DaftarPustaka.find(params[:id])\n end", "def create\n @panneau = Panneau.new(panneau_params)\n\n respond_to do |format|\n if @panneau.save\n format.html { redirect_to @panneau, notice: 'Panneau was successfully created.' }\n format.json { render :show, status: :created, location: @panneau }\n else\n format.html { render :new }\n format.json { render json: @panneau.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @daw_trabajo = DawTrabajo.new(daw_trabajo_params)\n\n respond_to do |format|\n if @daw_trabajo.save\n format.html { redirect_to @daw_trabajo, notice: 'Daw trabajo was successfully created.' }\n format.json { render :show, status: :created, location: @daw_trabajo }\n else\n format.html { render :new }\n format.json { render json: @daw_trabajo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @zabydovnuk = Zabydovnuk.new(zabydovnuk_params)\n\n respond_to do |format|\n if @zabydovnuk.save\n format.html { redirect_to @zabydovnuk, notice: 'Zabydovnuk was successfully created.' }\n format.json { render :show, status: :created, location: @zabydovnuk }\n else\n format.html { render :new }\n format.json { render json: @zabydovnuk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pergunta = @topico.perguntas.new(pergunta_params)\n\n respond_to do |format|\n if @pergunta.save\n format.html { redirect_to set_path, notice: 'Pergunta criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @pergunta }\n else\n format.html { render action: 'new' }\n format.json { render json: @pergunta.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ra_khoi_dang = RaKhoiDang.new(ra_khoi_dang_params)\n\n respond_to do |format|\n if @ra_khoi_dang.save\n format.html { redirect_to @ra_khoi_dang, notice: 'Ra khoi dang was successfully created.' }\n format.json { render :show, status: :created, location: @ra_khoi_dang }\n else\n format.html { render :new }\n format.json { render json: @ra_khoi_dang.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dia_hora = DiaHora.new(dia_hora_params)\n\n respond_to do |format|\n if @dia_hora.save\n format.html { redirect_to @dia_hora, notice: 'Dia hora was successfully created.' }\n format.json { render :show, status: :created, location: @dia_hora }\n else\n format.html { render :new }\n format.json { render json: @dia_hora.errors, status: :unprocessable_entity }\n end\n end\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 @post = Post.create(post_params)\n puts \"LLLLLOOOOOOOLLLLLL\"\n puts current_usuario.to_json\n @post = current_usuario.posts.create(post_params)\n \n @post.sangre = current_usuario.tipoDeSangre\n\n\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @f_dzakir = FDzakir.new(f_dzakir_params)\n\n respond_to do |format|\n if @f_dzakir.save\n format.html { redirect_to @f_dzakir, notice: 'F dzakir was successfully created.' }\n format.json { render :show, status: :created, location: @f_dzakir }\n else\n format.html { render :new }\n format.json { render json: @f_dzakir.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @zakaz = Zakaz.new(params[:zakaz])\n\n respond_to do |format|\n if @zakaz.save\n format.html { redirect_to @zakaz, notice: 'Zakaz was successfully created.' }\n format.json { render json: @zakaz, status: :created, location: @zakaz }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zakaz.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @puntaje = Puntaje.new(params[:puntaje])\n\n respond_to do |format|\n if @puntaje.save\n format.html { redirect_to @puntaje, notice: 'Puntaje was successfully created.' }\n format.json { render json: @puntaje, status: :created, location: @puntaje }\n else\n atributos\n format.html { render action: \"new\" }\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #raise penduduk_params.to_yaml\n @penduduk = Penduduk.new(penduduk_params)\n @golongan_darahs = GolonganDarah.all\n @agamas = Agama.all\n @pekerjaans= Pekerjaan.all\n @status_keluargas = StatusKeluarga.all\n @pendidikans = Pendidikan.all\n @kelurahans = Kelurahan.all\n @kecamatans = Kecamatan.all\n @kabupatens = Kabupaten.all\n @penghasilans = Penghasilan.all \n respond_to do |format|\n if @penduduk.save\n format.html { redirect_to @penduduk, notice: 'Penduduk was successfully created.' }\n format.json { render :show, status: :created, location: @penduduk }\n else\n format.html { render :new }\n format.json { render json: @penduduk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @f_dpetra = FDpetra.new(f_dpetra_params)\n\n respond_to do |format|\n if @f_dpetra.save\n format.html { redirect_to @f_dpetra, notice: 'F dpetra was successfully created.' }\n format.json { render :show, status: :created, location: @f_dpetra }\n else\n format.html { render :new }\n format.json { render json: @f_dpetra.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 @zaduzenja = Zaduzenja.new(zaduzenja_params)\n\n respond_to do |format|\n if @zaduzenja.save\n format.html { redirect_to @zaduzenja, notice: 'Zaduzenja was successfully created.' }\n format.json { render :show, status: :created, location: @zaduzenja }\n else\n format.html { render :new }\n format.json { render json: @zaduzenja.errors, status: :unprocessable_entity }\n end\n end\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 create\n @tangazo = Tangazo.new(tangazo_params)\n\n respond_to do |format|\n if @tangazo.save\n format.html { redirect_to @tangazo, notice: 'Tangazo was successfully created.' }\n format.json { render :show, status: :created, location: @tangazo }\n else\n format.html { render :new }\n format.json { render json: @tangazo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post_prod_dpt = PostProdDpt.new(post_prod_dpt_params)\n\n if @post_prod_dpt.save\n render json: @post_prod_dpt, status: :created, location: @post_prod_dpt\n else\n render json: @post_prod_dpt.errors, status: :unprocessable_entity\n end\n end", "def create\n @departamento = Departamento.new(departamento_params)\n\n if @departamento.save\n render json: @departamento, status: :created, location: @departamento\n else\n render json: @departamento.errors, status: :unprocessable_entity\n end\n end", "def create\n @ponderacion = Ponderacion.new(ponderacion_params)\n\n respond_to do |format|\n if @ponderacion.save\n format.html { redirect_to @ponderacion, notice: 'Ponderacion was successfully created.' }\n format.json { render :show, status: :created, location: @ponderacion }\n else\n format.html { render :new }\n format.json { render json: @ponderacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @metar_raport = MetarRaport.new(metar_raport_params)\n\n respond_to do |format|\n if @metar_raport.save\n format.html { redirect_to @metar_raport, notice: 'Metar raport was successfully created.' }\n format.json { render :show, status: :created, location: @metar_raport }\n else\n format.html { render :new }\n format.json { render json: @metar_raport.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dia_evento = DiaEvento.new(dia_evento_params)\n\n if @dia_evento.save\n render json: @dia_evento, status: :created, location: @dia_evento\n else\n render json: @dia_evento.errors, status: :unprocessable_entity\n end\n end", "def create\n @posto = Posto.new(params[:posto])\n\n respond_to do |format|\n if @posto.save\n format.html { redirect_to @posto, notice: 'Posto de Saude cadastrado com sucesso' }\n format.json { render json: @posto, status: :created, location: @posto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @posto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @paradigm_praat = ParadigmPraat.new(paradigm_praat_params[:paradigm_praat])\n\n respond_to do |format|\n if @paradigm_praat.save\n format.html { redirect_to @paradigm_praat, notice: 'Paradigm praat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @paradigm_praat }\n else\n format.html { render action: 'new' }\n format.json { render json: @paradigm_praat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @daw_retiro = DawRetiro.new(daw_retiro_params)\n\n respond_to do |format|\n if @daw_retiro.save\n format.html { redirect_to @daw_retiro, notice: 'Daw retiro was successfully created.' }\n format.json { render :show, status: :created, location: @daw_retiro }\n else\n format.html { render :new }\n format.json { render json: @daw_retiro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kehadiran = Kehadiran.new(kehadiran_params)\n\n respond_to do |format|\n if @kehadiran.save\n format.html { redirect_to @kehadiran, notice: 'Kehadiran was successfully created.' }\n format.json { render :show, status: :created, location: @kehadiran }\n else\n format.html { render :new }\n format.json { render json: @kehadiran.errors, status: :unprocessable_entity }\n end\n end\n end", "def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end", "def 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 @vongdau = Vongdau.new(vongdau_params)\n\n respond_to do |format|\n if @vongdau.save\n format.html { redirect_to @vongdau, notice: 'Vongdau was successfully created.' }\n format.json { render :show, status: :created, location: @vongdau }\n else\n format.html { render :new }\n format.json { render json: @vongdau.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prenda = Prenda.new(prenda_params)\n\n respond_to do |format|\n if @prenda.save\n format.html { redirect_to @prenda, notice: 'Prenda was successfully created.' }\n format.json { render :show, status: :created, location: @prenda }\n else\n format.html { render :new }\n format.json { render json: @prenda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @onda = Onda.new(onda_params)\n\n respond_to do |format|\n if @onda.save\n format.html { redirect_to ondas_path, notice: 'Onda was successfully created.' }\n format.json { render :show, status: :created, location: @onda }\n else\n format.html { render :new }\n format.json { render json: @onda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ponto_parada = PontoParada.new(ponto_parada_params)\n\n respond_to do |format|\n if @ponto_parada.save\n format.html { redirect_to @ponto_parada, notice: 'Ponto parada was successfully created.' }\n format.json { render :show, status: :created, location: @ponto_parada }\n else\n format.html { render :new }\n format.json { render json: @ponto_parada.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pautum = Pautum.new(pautum_params)\n\n respond_to do |format|\n if @pautum.save\n format.html { redirect_to @pautum, notice: 'Pautum was successfully created.' }\n format.json { render :show, status: :created, location: @pautum }\n else\n format.html { render :new }\n format.json { render json: @pautum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pengeluaran_bulanan = PengeluaranBulanan.new(params[:pengeluaran_bulanan])\n\n respond_to do |format|\n if @pengeluaran_bulanan.save\n format.html { redirect_to @pengeluaran_bulanan, notice: 'Pengeluaran bulanan was successfully created.' }\n format.json { render json: @pengeluaran_bulanan, status: :created, location: @pengeluaran_bulanan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pengeluaran_bulanan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dias_semanas_vaga = DiasSemanasVaga.new(dias_semanas_vaga_params)\n\n respond_to do |format|\n if @dias_semanas_vaga.save\n format.html { redirect_to @dias_semanas_vaga, notice: 'Dias semanas vaga was successfully created.' }\n format.json { render :show, status: :created, location: @dias_semanas_vaga }\n else\n format.html { render :new }\n format.json { render json: @dias_semanas_vaga.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @palabra = Palabra.new(params[:palabra])\n @palabra.significados = params[:significados] \n respond_to do |format|\n if @palabra.save\n format.html { redirect_to @palabra, notice: 'La palabra fue guardada correctamente.' }\n format.json { render json: @palabra, status: :created, location: @palabra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @palabra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vodka = Vodka.new(params[:vodka])\n\n respond_to do |format|\n if @vodka.save\n format.html { redirect_to @vodka, notice: 'Vodka was successfully created.' }\n format.json { render json: @vodka, status: :created, location: @vodka }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vodka.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_digersayfa = Admin::Digersayfa.new(admin_digersayfa_params)\n @turad = { 0 => \"Bilim İnsanları\", 1 => \"Resmi Evraklar\", 2 => \"İlginç Bilgiler\", 3 => \"Motivasyon\", 4 => \"Sınav Sistemi\"}\n @tur = { 0 => \"biliminsanlari\", 1 => \"resmievraklar\", 2 => \"ilgincbilgiler\", 3 => \"motivasyon\", 4 => \"sinavsistemi\"}\n\n respond_to do |format|\n if @admin_digersayfa.save\n Admin::Duyuru.create(aciklama: @admin_digersayfa.created_at.to_s.split(\" \")[0] + \" \" + @turad[@admin_digersayfa.tur] + \" \" + @admin_digersayfa.baslik + \" yazısı eklenmiştir.<a href=/\" + @tur[@admin_digersayfa.tur] + \"> Yazıya ulaşmak için tıklayınız. </a>\", tur: 0)\n format.html { redirect_to @admin_digersayfa, notice: 'Yazı başarılı bir şekilde oluşturuldu.' }\n format.json { render :show, status: :created, location: @admin_digersayfa }\n else\n format.html { render :new }\n format.json { render json: @admin_digersayfa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @faktury = Faktury.new(faktury_params)\n\n respond_to do |format|\n if @faktury.save\n format.html { redirect_to @faktury, notice: 'Faktury was successfully created.' }\n format.json { render :show, status: :created, location: @faktury }\n else\n format.html { render :new }\n format.json { render json: @faktury.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transakcje_jaskula = TransakcjeJaskula.new(transakcje_jaskula_params)\n\n respond_to do |format|\n if @transakcje_jaskula.save\n format.html { redirect_to @transakcje_jaskula, notice: 'Transakcje jaskula was successfully created.' }\n format.json { render :show, status: :created, location: @transakcje_jaskula }\n else\n format.html { render :new }\n format.json { render json: @transakcje_jaskula.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kontoumsatz = Kontoumsatz.new(kontoumsatz_params)\n\n respond_to do |format|\n if @kontoumsatz.save\n format.html { redirect_to @kontoumsatz, notice: 'Kontoumsatz was successfully created.' }\n format.json { render :show, status: :created, location: @kontoumsatz }\n else\n format.html { render :new }\n format.json { render json: @kontoumsatz.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_aposta = TipoAposta.new(tipo_aposta_params)\n\n respond_to do |format|\n if @tipo_aposta.save\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_aposta }\n else\n format.html { render :new }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_despesa = TipoDespesa.new(tipo_despesa_params)\n\n respond_to do |format|\n if @tipo_despesa.save\n format.html { redirect_to tenant_tipo_despesas_path(tenant_id: @tenant.id), notice: 'Tipo despesa was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_despesa }\n else\n format.html { render :new }\n format.json { render json: @tipo_despesa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @db_pekerjaan = DbPekerjaan.new(params[:db_pekerjaan])\n\n respond_to do |format|\n if @db_pekerjaan.save\n format.html { redirect_to @db_pekerjaan, notice: 'Db jmlh pddk was successfully created.' }\n format.json { render json: @db_pekerjaan, status: :created, location: @db_pekerjaan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @db_pekerjaan.errors, status: :unprocessable_entity }\n end\n end\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 @torneo_apartura = TorneoApartura.new(torneo_apartura_params)\n\n respond_to do |format|\n if @torneo_apartura.save\n format.html { redirect_to @torneo_apartura, notice: 'Torneo apartura was successfully created.' }\n format.json { render :show, status: :created, location: @torneo_apartura }\n else\n format.html { render :new }\n format.json { render json: @torneo_apartura.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @daw_representante = DawRepresentante.new(daw_representante_params)\n\n respond_to do |format|\n if @daw_representante.save\n format.html { redirect_to @daw_representante, notice: 'Daw representante was successfully created.' }\n format.json { render :show, status: :created, location: @daw_representante }\n else\n format.html { render :new }\n format.json { render json: @daw_representante.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rodzaj_pracownika = RodzajPracownika.new(rodzaj_pracownika_params)\n\n respond_to do |format|\n if @rodzaj_pracownika.save\n format.html { redirect_to @rodzaj_pracownika, notice: 'Rodzaj pracownika was successfully created.' }\n format.json { render :show, status: :created, location: @rodzaj_pracownika }\n else\n format.html { render :new }\n format.json { render json: @rodzaj_pracownika.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @enfermeras_paciente = EnfermerasPaciente.new(enfermeras_paciente_params)\n\n respond_to do |format|\n if @enfermeras_paciente.save\n format.html { redirect_to @enfermeras_paciente, notice: 'Enfermeras paciente was successfully created.' }\n format.json { render :show, status: :created, location: @enfermeras_paciente }\n else\n format.html { render :new }\n format.json { render json: @enfermeras_paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @asos_datum = AsosDatum.new(asos_datum_params(asos_station))\n\n respond_to do |format|\n if @asos_datum.save\n format.html { redirect_to @asos_datum, notice: 'Asos datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @asos_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @asos_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n \n respond_to do |format|\n if @paciente.save\n format.html { redirect_to @paciente, notice: 'Paciente creado exitosamente.' }\n format.json { render :show, status: :created, location: @paciente }\n else \n format.html { render :new}\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end", "def create\n @prestador = Prestador.new(params[:prestador])\n\n respond_to do |format|\n if @prestador.save\n format.html { redirect_to @prestador, notice: 'Prestador fue guardado correctamente.' }\n format.json { render json: @prestador, status: :created, location: @prestador }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prestador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diarista = Diarista.new(diarista_params)\n\n respond_to do |format|\n if @diarista.save\n format.html { redirect_to @diarista, notice: 'Diarista was successfully created.' }\n format.json { render :show, status: :created, location: @diarista }\n else\n format.html { render :new }\n format.json { render json: @diarista.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transportadora = Transportadora.new(transportadora_params)\n\n respond_to do |format|\n if @transportadora.save\n format.html { redirect_to @transportadora, notice: 'Transportadora was successfully created.' }\n format.json { render :show, status: :created, location: @transportadora }\n else\n format.html { render :new }\n format.json { render json: @transportadora.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @derp = Derp.new(derp_params)\n\n respond_to do |format|\n if @derp.save\n format.html { redirect_to @derp, notice: 'Derp was successfully created.' }\n format.json { render :show, status: :created, location: @derp }\n else\n format.html { render :new }\n format.json { render json: @derp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kanri_daicho = KanriDaicho.new(kanri_daicho_params)\n\n respond_to do |format|\n if @kanri_daicho.save\n format.html { redirect_to @kanri_daicho, notice: 'Kanri daicho was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kanri_daicho }\n else\n format.html { render action: 'new' }\n format.json { render json: @kanri_daicho.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @data_pendidikan_agama_katolik = DataPendidikanAgamaKatolik.new(data_pendidikan_agama_katolik_params)\n @data_pendidikan_agama_katolik.pengguna_id = current_pengguna.id\n \n respond_to do |format|\n if @data_pendidikan_agama_katolik.save\n format.html { redirect_to @data_pendidikan_agama_katolik, notice: 'Data pendidikan agama katolik was successfully created.' }\n format.json { render :show, status: :created, location: @data_pendidikan_agama_katolik }\n else\n format.html { render :new }\n format.json { render json: @data_pendidikan_agama_katolik.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dato = Dato.new(params[:dato])\n\n respond_to do |format|\n if @dato.save\n format.html { redirect_to @dato, notice: 'Dato was successfully created.' }\n format.json { render json: @dato, status: :created, location: @dato }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dato.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hystory_zakaz = HystoryZakaz.new(hystory_zakaz_params)\n\n respond_to do |format|\n if @hystory_zakaz.save\n format.html { redirect_to @hystory_zakaz, notice: 'Hystory zakaz was successfully created.' }\n format.json { render :show, status: :created, location: @hystory_zakaz }\n else\n format.html { render :new }\n format.json { render json: @hystory_zakaz.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @paciente = Paciente.new(params[:paciente])\n \n respond_to do |format|\n if @paciente.save\n format.html { redirect_to pacientes_path, notice: 'Paciente criado com sucesso.' }\n format.json { render json: @paciente, status: :created, location: @paciente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @archdiocese = Archdiocese.new(archdiocese_params)\n\n if @archdiocese.save\n render json: @archdiocese, status: :created, location: @archdiocese\n else\n render json: @archdiocese.errors, status: :unprocessable_entity\n end\n end", "def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end", "def create\n @armazena = Armazena.new(armazena_params)\n\n respond_to do |format|\n if @armazena.save\n format.html { redirect_to @armazena, notice: 'Armazena was successfully created.' }\n format.json { render :show, status: :created, location: @armazena }\n else\n format.html { render :new }\n format.json { render json: @armazena.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipovestuario = Tipovestuario.new(tipovestuario_params)\n\n respond_to do |format|\n if @tipovestuario.save\n format.html { redirect_to @tipovestuario, notice: 'Tipovestuario was successfully created.' }\n format.json { render :show, status: :created, location: @tipovestuario }\n else\n format.html { render :new }\n format.json { render json: @tipovestuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @data_kejuaraan = DataKejuaraan.new(data_kejuaraan_params)\n @kegiatan = Kegiatan.select(@data_kejuaraan.kegiatan_id)\n \n respond_to do |format|\n if @data_kejuaraan.save\n format.html { redirect_to @data_kejuaraan, notice: 'Data kejuaraan was successfully created.' }\n format.json { render :show, status: :created, location: @data_kejuaraan }\n else\n format.html { render :new }\n format.json { render json: @data_kejuaraan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pdk = Pdk.new(pdk_params)\n\n respond_to do |format|\n if @pdk.save\n format.html { redirect_to @pdk, notice: 'Pdk was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pdk }\n else\n format.html { render action: 'new' }\n format.json { render json: @pdk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dm_planosaude = DmPlanosaude.new(dm_planosaude_params)\n\n respond_to do |format|\n if @dm_planosaude.save\n format.html { redirect_to @dm_planosaude, notice: 'Dm planosaude was successfully created.' }\n format.json { render :show, status: :created, location: @dm_planosaude }\n else\n format.html { render :new }\n format.json { render json: @dm_planosaude.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @koran = Koran.new(koran_params)\n\n respond_to do |format|\n if @koran.save\n format.html { redirect_to @koran, notice: 'Koran was successfully created.' }\n format.json { render :show, status: :created, location: @koran }\n else\n format.html { render :new }\n format.json { render json: @koran.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 @pingguodingshirenwu = Pingguodingshirenwu.new(pingguodingshirenwu_params)\n\n respond_to do |format|\n if @pingguodingshirenwu.save\n format.html { redirect_to @pingguodingshirenwu, notice: 'Pingguodingshirenwu was successfully created.' }\n format.json { render :show, status: :created, location: @pingguodingshirenwu }\n else\n format.html { render :new }\n format.json { render json: @pingguodingshirenwu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @apertura_moneda = AperturaMoneda.new(apertura_moneda_params)\n\n respond_to do |format|\n if @apertura_moneda.save\n format.html { redirect_to @apertura_moneda, notice: 'Apertura moneda was successfully created.' }\n format.json { render :show, status: :created, location: @apertura_moneda }\n else\n format.html { render :new }\n format.json { render json: @apertura_moneda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @natulang = Natulang.new(params[:natulang])\n\n respond_to do |format|\n if @natulang.save\n format.html { redirect_to @natulang, notice: 'Natulang was successfully created.' }\n format.json { render json: @natulang, status: :created, location: @natulang }\n else\n format.html { render action: \"new\" }\n format.json { render json: @natulang.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipoenfermedad = Tipoenfermedad.new(tipoenfermedad_params)\n\n respond_to do |format|\n if @tipoenfermedad.save\n format.html { redirect_to @tipoenfermedad, notice: 'Tipoenfermedad was successfully created.' }\n format.json { render :show, status: :created, location: @tipoenfermedad }\n else\n format.html { render :new }\n format.json { render json: @tipoenfermedad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pegawai = Pegawai.new(pegawai_params)\n\n respond_to do |format|\n if @pegawai.save\n format.html { redirect_to @pegawai, notice: 'Pegawai berhasil tersimpan.' }\n format.json { render :show, status: :created, location: @pegawai }\n else\n format.html { render :new }\n format.json { render json: @pegawai.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @soda = Soda.new(soda_params)\n\n respond_to do |format|\n if @soda.save\n format.html { redirect_to @soda, notice: 'Soda was successfully created.' }\n format.json { render :show, status: :created, location: @soda }\n else\n format.html { render :new }\n format.json { render json: @soda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pizza_oder = PizzaOder.new(pizza_oder_params)\n\n respond_to do |format|\n if @pizza_oder.save\n format.html { redirect_to @pizza_oder, notice: 'Pizza oder was successfully created.' }\n format.json { render :show, status: :created, location: @pizza_oder }\n else\n format.html { render :new }\n format.json { render json: @pizza_oder.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aadt = Aadt.new(params[:aadt])\n\n respond_to do |format|\n if @aadt.save\n format.html { redirect_to @aadt, notice: 'Aadt was successfully created.' }\n format.json { render json: @aadt, status: :created, location: @aadt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aadt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @paciente = Paciente.new(paciente_params)\n\n respond_to do |format|\n if @paciente.save\n format.html { redirect_to @paciente, notice: 'Paciente was successfully created.' }\n format.json { render :show, status: :created, location: @paciente }\n else\n format.html { render :new }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turma = Turma.new(turma_params)\n @turma.usuario = current_usuario\n @turma.turma_ativa = true\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to turmas_path, notice: 'Turma salva com sucesso.' }\n format.json { render :show, status: :created, location: @turma }\n else\n format.html { render :new }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pakettipi = Pakettipi.new(pakettipi_params)\n\n \n if Pakettipi.exists?(paket_tipi: @pakettipi.paket_tipi, urunadi_id: @pakettipi.urunadi_id)\n flash[:notice] = \"Bu paket tipi zaten KAYITLI !!\"\n redirect_to new_pakettipi_path\n else\n respond_to do |format|\n if @pakettipi.save\n format.html { redirect_to pakettipis_path, notice:'Kayıt başarıyla oluşturuldu.' }\n format.json { render :show, status: :created, location: @pakettipi }\n else\n format.html { render :new }\n format.json { render json: @pakettipi.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @pkhd = Pkhd.new(pkhd_params)\n\n respond_to do |format|\n if @pkhd.save\n format.html { redirect_to edit_pkhd_path(@pkhd), notice: 'Pemakaian Berhasil di Buat.' }\n #format.json { render :show, status: :created, location: @pkhd }\n else\n format.html { render :new }\n format.json { render json: @pkhd.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @valet_datum = ValetDatum.new(valet_datum_params)\n\n respond_to do |format|\n if @valet_datum.save\n format.html { redirect_to @valet_datum, notice: 'Valet datum was successfully created.' }\n format.json { render :show, status: :created, location: @valet_datum }\n else\n format.html { render :new }\n format.json { render json: @valet_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @presenza = Presenza.new(params[:presenza])\n\n respond_to do |format|\n if @presenza.save\n format.html { redirect_to @presenza, notice: 'Presenza was successfully created.' }\n format.json { render json: @presenza, status: :created, location: @presenza }\n else\n format.html { render action: \"new\" }\n format.json { render json: @presenza.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turma = @disciplina.turmas.new(turma_params)\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'A Turma foi criada com sucesso.' }\n format.json { render action: 'show', 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" ]
[ "0.65138674", "0.64529973", "0.6334612", "0.6326551", "0.63072807", "0.62934387", "0.6178204", "0.6172406", "0.6167182", "0.61153257", "0.60744447", "0.60525304", "0.60468113", "0.6038483", "0.6029605", "0.60258555", "0.5994244", "0.59879124", "0.5983816", "0.59740674", "0.5955533", "0.5949961", "0.5947835", "0.5934075", "0.59212244", "0.59143424", "0.58953696", "0.5878538", "0.58783835", "0.5876374", "0.58707356", "0.5869606", "0.58684164", "0.585687", "0.5852618", "0.58495724", "0.5849492", "0.58490103", "0.5841807", "0.5836388", "0.58359367", "0.5835466", "0.58309424", "0.5818236", "0.5810903", "0.58102363", "0.58091956", "0.58001095", "0.5795248", "0.579368", "0.57900757", "0.5784225", "0.57823557", "0.57799923", "0.57753754", "0.5774338", "0.5773516", "0.5766373", "0.5763182", "0.576121", "0.57528615", "0.5752861", "0.57444024", "0.5743852", "0.57431525", "0.5739486", "0.57394415", "0.57385457", "0.57374597", "0.57367516", "0.57367164", "0.5736003", "0.57345456", "0.5733549", "0.5730417", "0.57279414", "0.5725873", "0.572584", "0.5720231", "0.5717733", "0.57160896", "0.5713063", "0.5711244", "0.57106316", "0.57097024", "0.5709319", "0.5707433", "0.5700601", "0.56999487", "0.5699768", "0.56995934", "0.56991804", "0.5698403", "0.5695547", "0.56944984", "0.5690456", "0.56882125", "0.5686203", "0.56856966", "0.56852293" ]
0.7356641
0
PATCH/PUT /daftar_pustaka/1 PATCH/PUT /daftar_pustaka/1.json
def update respond_to do |format| if @daftar_pustaka.update(daftar_pustaka_params) format.html { redirect_to @daftar_pustaka, notice: 'Daftar pustaka was successfully updated.' } format.json { render :show, status: :ok, location: @daftar_pustaka } else format.html { render :edit } format.json { render json: @daftar_pustaka.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def 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 @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.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.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n @futbolada = Futbolada.find(params[:id])\n\n respond_to do |format|\n if @futbolada.update_attributes(params[:futbolada])\n format.html { redirect_to gestion_url, notice: 'Futbolada was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @futbolada.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_plant\n @plant.deleted = false\n\n respond_to do |format|\n if set_attributes_from_filemaker(@plant)\n format.json do\n render status: :created,\n json: {\n id: @plant.id,\n botanical_name: @plant.botanical_name,\n alternative_names: @plant.alternative_names,\n updated_at: @plant.updated_at,\n visible: ([email protected]).to_s\n }\n end\n else\n format.json do\n render json: @plant.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @klasa.update(klasa_params)\n format.html { redirect_to @klasa, notice: 'Klasa was successfully updated.' }\n format.json { render :show, status: :ok, location: @klasa }\n else\n format.html { render :edit }\n format.json { render json: @klasa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n if @tipo_pregunta.update(params[:tipo_pregunta])\n head :no_content\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redirect_to @platoon, notice: 'Platoon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @platoon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dato = Dato.find(params[:id])\n\n respond_to do |format|\n if @dato.update_attributes(params[:dato])\n format.html { redirect_to @dato, notice: 'Dato was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dato.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\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 @demanda.update(demanda_params)\n format.html { redirect_to @demanda, notice: 'Demanda was successfully updated.' }\n format.json { render :show, status: :ok, location: @demanda }\n else\n format.html { render :edit }\n format.json { render json: @demanda.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pendaftaran_kela.update(pendaftaran_kela_params)\n format.html { redirect_to @pendaftaran_kela, notice: 'Pendaftaran kela was successfully updated.' }\n format.json { render :show, status: :ok, location: @pendaftaran_kela }\n else\n format.html { render :edit }\n format.json { render json: @pendaftaran_kela.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n respond_to do |format|\n if @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 @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 @padrao.update(padrao_params)\n format.html { redirect_to @padrao, notice: 'Padrao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @padrao.errors, status: :unprocessable_entity }\n end\n end\n end", "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 @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 @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n if @paciente.update_attributes(params[:paciente])\n format.html { redirect_to \"/administrador/pacientes\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update(data = :object || :json)\n end", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def update\n respond_to do |format|\n if @penyata_kehadiran.update(penyata_kehadiran_params)\n format.html { redirect_to @penyata_kehadiran, notice: 'Penyata kehadiran was successfully updated.' }\n format.json { render :show, status: :ok, location: @penyata_kehadiran }\n else\n format.html { render :edit }\n format.json { render json: @penyata_kehadiran.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end", "def update\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n if @paciente.update_attributes(params[:paciente])\n format.html { redirect_to @paciente, notice: 'Paciente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.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 respond_to do |format|\n if @soda.update(soda_params)\n format.html { redirect_to @soda, notice: 'Soda was successfully updated.' }\n format.json { render :show, status: :ok, location: @soda }\n else\n format.html { render :edit }\n format.json { render json: @soda.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tap.update(tap_params)\n format.html { redirect_to taps_path, notice: 'Tap was successfully updated.' }\n format.json { head :no_content }\n else\n format.json { render json: @tap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @todoa.update(todoa_params)\n format.html { redirect_to todoas_url }\n format.json { render :show, status: :ok, location: @todoa }\n else\n format.html { render :edit }\n format.json { render json: @todoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @postavka.update(postavka_params)\n format.html { redirect_to @postavka, notice: 'Postavka was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @postavka.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def update\n @vodka = Vodka.find(params[:id])\n\n respond_to do |format|\n if @vodka.update_attributes(params[:vodka])\n format.html { redirect_to @vodka, notice: 'Vodka was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vodka.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n redirect_to_path = @pergunta\n if @pergunta.update(pergunta_params)\n format.html { redirect_to set_path, notice: \"Pergunta atualizada com sucesso.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pergunta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @patrimony.update(patrimony_params)\n format.html { redirect_to @patrimony, notice: 'Patrimony was successfully updated.' }\n format.json { render :show, status: :ok, location: @patrimony }\n else\n format.html { render :edit }\n format.json { render json: @patrimony.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @patrimony.update(patrimony_params)\n format.html { redirect_to @patrimony, notice: 'Patrimony was successfully updated.' }\n format.json { render :show, status: :ok, location: @patrimony }\n else\n format.html { render :edit }\n format.json { render json: @patrimony.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prace_polozka.update(prace_polozka_params)\n format.html { redirect_to @prace_polozka, notice: 'Zaznam byl zmenen.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prace_polozka.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @data_ukt.update(data_ukt_params)\n format.html { redirect_to @data_ukt, notice: 'Data ukt was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_ukt }\n else\n format.html { render :edit }\n format.json { render json: @data_ukt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n respond_to do |format|\n if @paradigm_praat.update(paradigm_praat_params)\n format.html { redirect_to @paradigm_praat, notice: 'Paradigm praat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @paradigm_praat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pacient.update(pacient_params)\n format.html { redirect_to @pacient, notice: 'Pacient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pacient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @docs_ponto.update(docs_ponto_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @docs_ponto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @falta.update(falta_params)\n format.html { redirect_to @falta, notice: \"Falta was successfully updated.\" }\n format.json { render :show, status: :ok, location: @falta }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\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 @sklad = Sklad.find(params[:id])\n\n respond_to do |format|\n if @sklad.update_attributes(params[:sklad])\n format.html { redirect_to @sklad, notice: 'Sklad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sklad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n if @puntaje.update_attributes(params[:puntaje])\n format.html { redirect_to @puntaje, notice: 'Puntaje was successfully updated.' }\n format.json { head :no_content }\n else\n atributos\n format.html { render action: \"edit\" }\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(dato_params)\n format.html { redirect_to @objeto, notice: 'Dato was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sala = Sala.find(params[:id])\n\n respond_to do |format|\n if @sala.update_attributes(params[:sala])\n format.html { redirect_to @sala, notice: 'Sala was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sala.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 @prospecto_meta_largo_plazo.update(prospecto_meta_largo_plazo_params)\n format.html { redirect_to @prospecto_meta_largo_plazo, notice: 'Prospecto meta largo plazo was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospecto_meta_largo_plazo }\n else\n format.html { render :edit }\n format.json { render json: @prospecto_meta_largo_plazo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @etapa.update(etapa_params)\n format.html { redirect_to @etapa, notice: 'Etapa fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @etapa }\n else\n format.html { render :edit }\n format.json { render json: @etapa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n @datoscontacto = Datoscontacto.find(params[:id])\n\n respond_to do |format|\n if @datoscontacto.update_attributes(params[:datoscontacto])\n format.html { redirect_to @datoscontacto, notice: 'Datoscontacto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @datoscontacto.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 @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @f_dpetra.update(f_dpetra_params)\n format.html { redirect_to @f_dpetra, notice: 'F dpetra was successfully updated.' }\n format.json { render :show, status: :ok, location: @f_dpetra }\n else\n format.html { render :edit }\n format.json { render json: @f_dpetra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tangazo.update(tangazo_params)\n format.html { redirect_to @tangazo, notice: 'Tangazo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tangazo }\n else\n format.html { render :edit }\n format.json { render json: @tangazo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @posto = Posto.find(params[:id])\n\n respond_to do |format|\n if @posto.update_attributes(params[:posto])\n format.html { redirect_to @posto, notice: 'Posto de Saude alterado com sucesso' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @posto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pendaftaran.update(pendaftaran_params)\n format.html { redirect_to @pendaftaran, notice: \"Pendaftaran was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pendaftaran }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pendaftaran.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fortune = Fortune.find(params[:id])\n\n respond_to do |format|\n if @fortune.update_attributes(params[:fortune])\n format.html { redirect_to @fortune, notice: 'Piosenka pozytywnie zaktualizowana.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fortune.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bubble_tea = BubbleTea.find(params[:id])\n\n if @bubble_tea.update(bubble_tea_params)\n render json: @bubble_tea\n else\n render plain: \"Failed to update drink information\"\n end\n end", "def update\n respond_to do |format|\n if @antropo.update(antropo_params)\n format.html { redirect_to @antropo, notice: 'Antropo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @antropo.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 @dart = Dart.find(params[:id])\n\n respond_to do |format|\n if @dart.update_attributes(params[:dart])\n format.html { redirect_to @dart, notice: 'Dart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pet_true.update(pet_true_params)\n format.html { redirect_to @pet_true, notice: 'Pet true was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pet_true.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to do |format|\n # if @kitchen.update_attributes(post_params)\n # format.html { redirect_to @kitchen, notice: 'Kitchen was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @kitchen.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 options={}\n client.put(\"/#{id}\", options)\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 @demanda = Demanda.find(params[:id])\n\n respond_to do |format|\n if @demanda.update_attributes(params[:demanda])\n if @demanda.tipo_demanda == '1' || @demanda.tipo_demanda == 1\n format.html { redirect_to \"/consultas/list/1\", :notice => 'Consulta atualizada com sucesso.'}\n format.json { head :no_content }\n elsif @demanda.tipo_demanda == '2' || @demanda.tipo_demanda == 2\n format.html { redirect_to \"/consultas/list/2\", :notice => 'Levantamento atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { redirect_to \"/consultas/list/3\", :notice => 'Flagrante atualizado com sucesso.' }\n format.json { head :no_content }\n end\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @demanda.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sanchaypatra.update(sanchaypatra_params)\n format.html { redirect_to sanchaypatras_url, notice: 'Sanchaypatra was successfully updated.' }\n format.json { render :show, status: :ok, location: @sanchaypatra }\n else\n format.html { render :edit }\n format.json { render json: @sanchaypatra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @przedmiot = Przedmiot.find(params[:id])\n\n respond_to do |format|\n if @przedmiot.update_attributes(params[:przedmiot])\n format.html { redirect_to @przedmiot, notice: 'Przedmiot został zaktualizowany.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @przedmiot.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 @consulta = Consulta.find(params[:id])\n\n if @consulta.update(params[:consulta])\n head :no_content\n else\n render json: @consulta.errors, status: :unprocessable_entity\n end\n end", "def update\n @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @paciente.update(paciente_params)\n format.html { redirect_to @paciente, notice: 'Paciente was successfully updated.' }\n format.json { render :show, status: :ok, location: @paciente }\n else\n format.html { render :edit }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @paciente.update(paciente_params)\n format.html { redirect_to @paciente, notice: 'Paciente was successfully updated.' }\n format.json { render :show, status: :ok, location: @paciente }\n else\n format.html { render :edit }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @karteikarte = Karteikarte.find(params[:id])\n\n respond_to do |format|\n if @karteikarte.update_attributes(params[:karteikarte])\n format.html { redirect_to @karteikarte, notice: 'Karteikarte was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @karteikarte.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kalo.update(kalo_params)\n format.html { redirect_to @kalo, notice: 'Kalo was successfully updated.' }\n format.json { render :show, status: :ok, location: @kalo }\n else\n format.html { render :edit }\n format.json { render json: @kalo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @data_kejuaraan.update(data_kejuaraan_params)\n format.html { redirect_to @data_kejuaraan, notice: 'Data kejuaraan was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_kejuaraan }\n else\n format.html { render :edit }\n format.json { render json: @data_kejuaraan.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6638611", "0.6603569", "0.65865296", "0.64734924", "0.6443528", "0.6413243", "0.6400266", "0.6313068", "0.62998617", "0.6287508", "0.6282582", "0.6281036", "0.6269964", "0.625709", "0.6254592", "0.62453187", "0.62443733", "0.62443125", "0.62412333", "0.6233259", "0.62316936", "0.6219644", "0.62170017", "0.621521", "0.6214453", "0.62125367", "0.62099814", "0.6204446", "0.6199772", "0.6183479", "0.61831105", "0.6180147", "0.61676973", "0.61632186", "0.6162306", "0.6158246", "0.61576325", "0.61576325", "0.61575335", "0.61538285", "0.6148819", "0.614191", "0.6133563", "0.61322016", "0.6126682", "0.6126331", "0.61249477", "0.6124505", "0.6124505", "0.6117486", "0.6116544", "0.611235", "0.6111523", "0.6105577", "0.610324", "0.61020786", "0.60968655", "0.60968214", "0.6094438", "0.60916394", "0.60900295", "0.60894626", "0.6087035", "0.60847104", "0.60838133", "0.6083064", "0.6083044", "0.60803753", "0.6077081", "0.6077081", "0.6075989", "0.6072468", "0.6070356", "0.60694087", "0.6069232", "0.606676", "0.60650164", "0.60647744", "0.6063376", "0.60630566", "0.6056922", "0.6051792", "0.6051612", "0.6047497", "0.6045727", "0.60450065", "0.6043489", "0.60430026", "0.60418797", "0.6039017", "0.6038658", "0.6037408", "0.6036809", "0.6036008", "0.6035882", "0.60356176", "0.60356176", "0.6035005", "0.6032338", "0.603219" ]
0.6606028
1
DELETE /daftar_pustaka/1 DELETE /daftar_pustaka/1.json
def destroy @daftar_pustaka.destroy respond_to do |format| format.html { redirect_to daftar_pustaka_index_url, notice: 'Daftar pustaka was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete\n request(:delete)\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_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 deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\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.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @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 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 @duda.destroy\n respond_to do |format|\n format.html { redirect_to dudas_url }\n format.json { head :no_content }\n end\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 delete\n api(\"Delete\")\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete!\n request! :delete\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @dinosaur = Dinosaur.find(params[:id])\n @dinosaur.destroy\n\n respond_to do |format|\n format.html { redirect_to dinosaurs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @zakaz = Zakaz.find(params[:id])\n @zakaz.destroy\n\n respond_to do |format|\n format.html { redirect_to zakazs_url }\n format.json { head :ok }\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 delete(*rest) end", "def destroy\n @kanri_daicho.destroy\n respond_to do |format|\n format.html { redirect_to kanri_daichos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @diemtrentuyen = Diemtrentuyen.find(params[:id])\n @diemtrentuyen.destroy\n\n respond_to do |format|\n format.html { redirect_to diemtrentuyens_url }\n format.json { head :no_content }\n end\n end", "def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\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 delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\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 delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @daw_alianza.destroy\n respond_to do |format|\n format.html { redirect_to daw_alianzas_url, notice: 'Daw alianza was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n\n end", "def destroy\n @tantosha.destroy\n # @tantosha.delete\n respond_to do |format|\n format.html { redirect_to tantoshas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datum.destroy\n respond_to do |format|\n format.html { redirect_to data_url }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n @asos_datum.destroy\n respond_to do |format|\n format.html { redirect_to asos_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dosha_action.destroy\n respond_to do |format|\n format.html { redirect_to dosha_actions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dataload_ga = DataloadGa.find(params[:id])\n @dataload_ga.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_gas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dhokebaaz.destroy\n respond_to do |format|\n format.html { redirect_to dhokebaazs_url, notice: 'Dhokebaaz was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "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 cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @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 @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 @vodka = Vodka.find(params[:id])\n @vodka.destroy\n\n respond_to do |format|\n format.html { redirect_to vodkas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_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 delete\n \n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def destroy\n @detalle = Detalle.find(params[:id])\n @detalle.destroy\n\n respond_to do |format|\n format.html { redirect_to detalles_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 @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end", "def destroy\n @postavka.destroy\n respond_to do |format|\n format.html { redirect_to postavkas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @zayavka = Zayavka.find(params[:id])\n @zayavka.destroy\n\n respond_to do |format|\n format.html { redirect_to zayavkas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @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 @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 @adres_kontr.destroy\n respond_to do |format|\n format.html { redirect_to adres_kontr_index_url, notice: 'Adres kontr was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @db_pekerjaan = DbPekerjaan.find(params[:id])\n @db_pekerjaan.destroy\n\n respond_to do |format|\n format.html { redirect_to db_pekerjaans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prestador = Prestador.find(params[:id])\n @prestador.destroy\n\n respond_to do |format|\n format.html { redirect_to prestadores_url }\n format.json { head :no_content }\n end\n end", "def delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @direcciont.destroy\n respond_to do |format|\n format.html { redirect_to direccionts_url, notice: 'Direcciont was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end", "def destroy\n @paciente = Paciente.find(params[:id])\n @paciente.destroy\n\n respond_to do |format|\n format.html { redirect_to paciente_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @apuesta_detail = ApuestaDetail.find(params[:id])\n @apuesta_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to apuesta_details_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" ]
[ "0.7377338", "0.7170511", "0.7088328", "0.7088328", "0.7065751", "0.7039237", "0.70054245", "0.69947666", "0.69709456", "0.6968309", "0.696827", "0.69667447", "0.6957981", "0.6956779", "0.695293", "0.69516134", "0.69466037", "0.6941161", "0.69376105", "0.69376105", "0.69376105", "0.69376105", "0.6930615", "0.69280297", "0.6917086", "0.6912584", "0.689898", "0.687798", "0.68755585", "0.6873386", "0.6869695", "0.6869695", "0.68667483", "0.6848051", "0.6844172", "0.68362075", "0.6826708", "0.68180823", "0.6812903", "0.68122506", "0.68083453", "0.6807956", "0.6804232", "0.6801357", "0.67973286", "0.6794346", "0.6794346", "0.6791255", "0.678374", "0.67730284", "0.677119", "0.67694724", "0.6766281", "0.6753317", "0.6752501", "0.6752495", "0.67514235", "0.6750372", "0.6747907", "0.6747907", "0.67418706", "0.67409366", "0.673841", "0.6732613", "0.67317194", "0.6729952", "0.6726592", "0.6719723", "0.6719723", "0.6719195", "0.6717623", "0.6716733", "0.67163956", "0.67149144", "0.67149144", "0.67149144", "0.67149144", "0.67149144", "0.67149144", "0.67149144", "0.671302", "0.6711035", "0.6710985", "0.6710246", "0.67100173", "0.67071664", "0.67067873", "0.67037064", "0.67016286", "0.66991127", "0.66972893", "0.6696827", "0.6695357", "0.6695114", "0.66942936", "0.6691763", "0.6691068", "0.6690806", "0.6690239", "0.66896975" ]
0.70608634
5
Use callbacks to share common setup or constraints between actions.
def set_daftar_pustaka @daftar_pustaka = DaftarPustaka.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 daftar_pustaka_params params.require(:daftar_pustaka).permit(:judul, :keterangan, :lampiran) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
GET /nvs_mig_statuses GET /nvs_mig_statuses.json
def index @nvs_mig_statuses = NvsMigStatus.all respond_to do |format| format.html # index.html.erb format.json { render json: @nvs_mig_statuses } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @mstatuses = Mstatus.all\n end", "def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end", "def statuses; end", "def show\n @nvs_mig_status = NvsMigStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nvs_mig_status }\n end\n end", "def statuses\n api.get('status')\n end", "def index\n @member_statuses = MemberStatus.all\n end", "def index\n @statuses = Status.all\n end", "def index\n @statuses = Status.all\n end", "def index\n @statuses = Status.search.page params[:page]\n end", "def statuses( params={} )\n statuses = get_connections(\"statuses\", params)\n return map_connections statuses, :to => Facebook::Graph::Statuse\n end", "def statuses\n request(:get, \"applicant_tracking/statuses\")\n end", "def statuses( params={} )\n statuses = get_connections(\"statuses\", params)\n return map_connections statuses, :to => Facebook::Graph::Generic\n end", "def index\n @request_statuses = RequestStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @request_statuses }\n end\n end", "def index\n @entity_statuses = EntityStatus.all\n end", "def index\n @barrel_statuses = BarrelStatus.all\n end", "def index\n @reqstatuses = Reqstatus.all\n end", "def statuses\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Available\", \"2\" => \"On Hold\", \"3\" => \"Borrowed\", \"4\" => \"Unavailable\"}}, :status => 200\n\t\treturn\n\tend", "def index\n @married_statuses = MarriedStatus.all\n end", "def index\n @project_statuses = Project::Status.all\n end", "def statuses_911_list\n payload[:statuses].nil? ? nil : payload[:statuses]\n end", "def status\n get_json('status.json')\n end", "def index\n @project_statuses = ProjectStatus.all\n end", "def index\n @invstatuses = Invstatus.all\n end", "def statuses\n aux = WorkOrderStatus.all\n render json: serialized_work_order_statuses(aux)\n end", "def index\n @mission_statuses = MissionStatus.all\n end", "def get_statuses\n\t\t# scrape the statuses web page (more convenient than looking up an API)\n\t\t\n\t\turl = CONFIG[\"statuses URL\"]\n\t\tdoc = Nokogiri::HTML( open(url) )\n\t\tprojects = doc.css('.project')\n\t\t\n\t\tproject_statuses = projects.map do |project|\n\t\t\t{\n\t\t\t\tid_num: begin\n\t\t\t\t\tid = project.attr('id') #=> \"project_6\"\n\t\t\t\t\tid.match(/\\d+/).to_s.to_i\n\t\t\t\tend,\n\t\t\t\tname: begin\n\t\t\t\t\tproject.at_css('h3 a').content.strip\n\t\t\t\tend,\n\t\t\t\tbuild_status: begin\n\t\t\t\t\tclasses = project.attr('class').split #=> \"status_build_failed project\"\n\t\t\t\t\tbuild_status_class_common_prefix = 'status_'\n\t\t\t\t\tbuild_status_class = classes.find { |klass| klass.start_with?(build_status_class_common_prefix) }\n\t\t\t\t\tbuild_status_class.sub(build_status_class_common_prefix, '').to_sym\n\t\t\t\tend,\n\t\t\t}\n\t\tend\n\t\t\n\t\treturn project_statuses.sort_by { |status| status[:id_num] }\n\tend", "def new\n @nvs_mig_status = NvsMigStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nvs_mig_status }\n end\n end", "def statuses\n statuses = {\n \"Not started\" => 1,\n \"In Progress\" => 2,\n \"Finished\" => 3\n }\n return statuses\n end", "def index\n @application_statuses = ApplicationStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @application_statuses }\n end\n end", "def index\n @search = MaritalStatus.search(params[:search])\n @marital_statuses = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erbb\n format.xml { render :xml => @marital_statuses }\n end\n end", "def get_redemption_request_statuses\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/utilities/redemption-request-statuses'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'Content-Type' => Configuration.content_type\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.get _query_url, headers: _headers\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) if not (_context.response.raw_body.nil? or _context.response.raw_body.to_s.strip.empty?)\r\n return decoded\r\n end", "def index\n @posts_statuses = Posts::Status.all\n end", "def current_statuses_three\n @current_statuses = CurrentStatus.where(status:true, id: [1,2,3]).order('name ASC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @current_statuses}\n end\n end", "def index\n authenticate_user! if params[:page]\n @statuses = Status.all.paginate(:page => params[:page], :per_page => 10).order(\"created_at DESC\")\n end", "def index\n @sa_request_statuses = SaRequestStatus.all\n end", "def index\n @client_statuses = ClientStatus.all\n end", "def index\n @statuses = Status.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @statuses }\n end\n end", "def index\n @master_user_statuses = MasterUserStatus.all\n end", "def index\n @inventory_statuses = InventoryStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventory_statuses }\n end\n end", "def status_enum\n status_list\n end", "def status\n request :get, \"_status\"\n end", "def index\n @relationship_statuses = RelationshipStatus.all\n end", "def index\n params[:per_page] = perpage if params[:per_page].nil?\n params[:page] = 1 if params[:page].blank?\n conditions = {:status_type => 0 ,:relation_id => 0 ,:count_type => 0 }\n conditions[:status_type] = params[:status_type] unless params[:status_type].blank?\n conditions[:relation_id] = params[:relation_id] unless params[:relation_id].blank?\n conditions[:count_type] = params[:count_type] unless params[:count_type].blank?\n @kf_statuses = Kf::Status.order(\"date DESC\").where(conditions).paginate(:page => params[:page], :per_page => params[:per_page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kf_statuses }\n end\n end", "def all_status\n\t status = Status.all\n\t return render_json_response(status, :ok)\n end", "def managed_app_statuses()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def index\n @swit_statuses = SwitStatus.all\n end", "def mentions(params = {})\n get \"statuses/mentions\", params\n end", "def statuses_911\n statuses_911_list ? statuses_911_list.collection : []\n end", "def index\n @antrag_statuses = AntragStatus.all\n end", "def managed_app_statuses\n return @managed_app_statuses\n end", "def index\n @search = Status.search(params[:search], :order => \"id DESC\")\n @statuses = @search.paginate(:page => params[:page], :order => \"id DESC\")\n\n @statuses = @statuses.where(:uid => params[:uid]) unless params[:uid].nil?\n @statuses = @statuses.where(:screen_name => params[:screen_name]) unless params[:screen_name].nil?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @statuses }\n end\n end", "def index\n @asset_statuses = AssetStatus.all\n end", "def list_possible_status_ids\n\tstatustypes = @client.Status.all\n\tstatustypes.each do |status|\n\t\tputs \"#{status.id}\\t#{status.name}\"\n\tend\nend", "def index\n @rh21_statuses = Rh21Status.all\n end", "def index\n @status_requests = StatusRequest.all\n end", "def index\n @lesson_statuses = LessonStatus.all\n end", "def managed_app_statuses=(value)\n @managed_app_statuses = value\n end", "def status\n get('/api/status')\n end", "def index\n @idea_statuses = IdeaStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @idea_statuses }\n end\n end", "def index\n @service_statuses = ServiceStatus.all\n end", "def collect_statuses\n ret = []\n versions.each do |v|\n s = v.statuses\n if s.exist?\n v.statuses.each do |status|\n ret << [status[\"key\"], status[\"value\"]]\n end\n end\n end\n ret\n end", "def index\n @player_statuses = PlayerStatus.all\n end", "def marketing_statuses\n sources = []\n changed_sources = []\n\n \n # collect l2l source source\n @resident.sources.where(:property_id => params[:prop_id]).each_with_index do |s, i|\n pp \"#{s.status}, #{s.status_date}, #{s.created_at}\"\n if s.status\n sources << {\n :status => s.status,\n :status_date => s.created_at,\n :move_in => s.move_in,\n :move_out => s.move_out\n }\n end\n end\n\n #collect only changed source (status & status_date changed)\n # must order by status_date asc, status_date always exists\n sorted_sources = sources.sort{|a, b| a[:status_date] <=> b[:status_date] }\n sorted_sources.each_with_index do |s, i|\n if i == 0\n changed_sources << s\n\n elsif s[:status] != sorted_sources[i-1][:status]\n changed_sources << s\n\n end\n end\n\n\n @statuses = changed_sources.sort{|a, b| b[:status_date] <=> a[:status_date] }\n \n render :json => @statuses.collect{|n| \n {\n :status => n[:status],\n :status_date => n[:status_date].to_s(:utc_date),\n :move_in => pretty_move_in(n[:move_in]),\n :move_out => pretty_move_in(n[:move_out])\n }\n }\n end", "def list_timeline(list_owner_username, slug, query = {})\n perform_get(\"/#{list_owner_username}/lists/#{slug}/statuses.json\", :query => query)\nend", "def index\n @contract_statuses = ContractStatus.all\n end", "def index\n @vacancy_request_statuses = VacancyRequestStatus.all\n end", "def index\n statuses_dashboard\n end", "def milestones\n process_list_response( send(:get , \"/api/v1/milestones.json\")[:body] , Unfuddled::Milestone)\n end", "def index\n page = params[:page] || 1\n @tasks = Task.order(created_at: :desc).page(page).per(10)\n @status_arr = Task.statuses.keys.each_with_object({}) { |status, arr| arr[status] = Task.try(status).count; arr }\n @users = User.all\n @statuses = Task.statuses.keys.to_a\n end", "def create_statuses\n end", "def create_statuses\n end", "def parseResults( resp )\n data = JSON.parse(resp.body)\n\treturn data['statuses']\nend", "def index\n @organization_statuses = @organization.organization_statuses # .paginate(:page => params[:page]).per_page(10)\n end", "def index\n \n @page = params[:page].to_i\n if @page == 0\n @page = 1\n end\n @page = @page + 1 \n \n # @statuses = Status.find(:all, :order => \"created_at DESC\")\n @statuses = Status.paginate :page => params[:page], :order => 'created_at DESC' #, :per_page => 3\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @statuses }\n format.js\n end\n end", "def index\n @event_user_statuses = EventUserStatus.all\n end", "def destroy\n @nvs_mig_status = NvsMigStatus.find(params[:id])\n @nvs_mig_status.destroy\n\n respond_to do |format|\n format.html { redirect_to nvs_mig_statuses_url }\n format.json { head :no_content }\n end\n end", "def get_statuses_with_http_info(tid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DevicesManagementApi.get_statuses ...\"\n end\n # verify the required parameter 'tid' is set\n fail ArgumentError, \"Missing the required parameter 'tid' when calling DevicesManagementApi.get_statuses\" if tid.nil?\n # resource path\n local_var_path = \"/devicemgmt/tasks/{tid}/statuses\".sub('{format}','json').sub('{' + 'tid' + '}', tid.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'dids'] = opts[:'dids'] if !opts[:'dids'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['artikcloud_oauth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TaskStatusesEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DevicesManagementApi#get_statuses\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @learning_statuses = LearningStatus.all\n end", "def index\n @mtypes = Mtype.order(:code)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mtypes }\n end\n end", "def marital_status\n fetch('demographic.marital_status')\n end", "def list_statuses(user, list)\n get(\"/#{user}/lists/#{list}/statuses.json\")\n end", "def index\n @typeofstatuses = Typeofstatus.all.page params[:page]\n end", "def getStatus\n @@statuses[@status]\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 @deployment_statuses = DeploymentStatus.all\n end", "def get_status(m, params)\n friends = params[:friends]\n show_reply = @bot.config['twitter.status_show_replies']\n if m.message.match(/^twitter status reply/)\n show_reply = true\n elsif m.message.match(/^twitter status noreply/)\n show_reply = false\n end\n\n if @registry.has_key?(m.sourcenick + \"_access_token\")\n @access_token = YAML::load(@registry[m.sourcenick + \"_access_token\"])\n nick = params[:nick] || @access_token.params[:screen_name]\n else\n if friends\n if @has_oauth\n m.reply \"You are not authorized with Twitter. Please use 'twitter authorize' first to use this feature.\"\n else\n report_oauth_missing(m, \"I cannot retrieve your friends status\")\n end\n return false\n end\n nick = params[:nick]\n end\n\n if not nick\n m.reply \"you should specify the username of the twitter to use, or identify using 'twitter authorize'\"\n return false\n end\n\n count = friends ? @bot.config['twitter.friends_status_count'] : @bot.config['twitter.status_count']\n if show_reply\n request_count = count\n else \n request_count = [ count*5,50 ].max\n end\n user = URI.escape(nick)\n # receive the public timeline per default (this works even without an access_token)\n uri = \"https://api.twitter.com/1/statuses/user_timeline.xml?screen_name=#{user}&count=#{request_count}&include_rts=true\"\n if @has_oauth and @registry.has_key?(m.sourcenick + \"_access_token\")\n if friends\n #no change to count variable\n uri = \"https://api.twitter.com/1/statuses/friends_timeline.xml?count=#{request_count}&include_rts=true\"\n end\n response = @access_token.get(uri).body\n else\n response = @bot.httputil.get(uri, :cache => false)\n end\n debug response\n\n texts = []\n\n if response\n begin\n rex = REXML::Document.new(response)\n rex.root.elements.each(\"status\") { |st|\n # month, day, hour, min, sec, year = st.elements['created_at'].text.match(/\\w+ (\\w+) (\\d+) (\\d+):(\\d+):(\\d+) \\S+ (\\d+)/)[1..6]\n # debug [year, month, day, hour, min, sec].inspect\n # time = Time.local(year.to_i, month, day.to_i, hour.to_i, min.to_i, sec.to_i)\n time = Time.parse(st.elements['created_at'].text)\n now = Time.now\n # Sometimes, time can be in the future; invert the relation in this case\n delta = ((time > now) ? time - now : now - time)\n msg = st.elements['text'].to_s + \" (#{Utils.secs_to_string(delta.to_i)} ago via #{st.elements['source'].to_s})\"\n author = \"\"\n if friends\n author = Utils.decode_html_entities(st.elements['user'].elements['name'].text) + \": \" rescue \"\"\n end\n texts << author+Utils.decode_html_entities(msg).ircify_html\n }\n if friends\n # friends always return the latest 20 updates, so we clip the count\n texts[count..-1]=nil\n end\n rescue\n error $!\n if friends\n m.reply \"could not parse status for #{nick}'s friends\"\n else\n m.reply \"could not parse status for #{nick}\"\n end\n return false\n end\n if !show_reply\n nonreplytexts = texts.grep(/^[^@]/)\n if nonreplytexts.length > 0\n texts = nonreplytexts\n end\n end\n # Make sure we have the right number\n texts[count..-1]=nil\n if texts.empty?\n m.reply \"No status updates!\"\n else\n m.reply texts.reverse.join(\"\\n\")\n end\n return true\n else\n if friends\n rep = \"could not get status for #{nick}'s friends\"\n rep << \", try asking in private\" unless m.private?\n else\n rep = \"could not get status for #{nick}\"\n end\n m.reply rep\n return false\n end\n end", "def status_translations\n @status_translations ||= Assembla.statuses['ticket_statuses']\nend", "def status_info\n current_path = '/api/v1/status'\n @conn.get(current_path)\n end", "def index\n @call_statuses = CallStatus.all\n end", "def index\n @api_v1_mentorings = Api::V1::Mentoring.all\n end", "def index\n @status_akun = StatusAkun.all\n end", "def index\n @status_activities = StatusActivity.all\n end", "def create\n @nvs_mig_status = NvsMigStatus.new(params[:nvs_mig_status])\n @nvs_mig_status.project_id = @project.id\n\n respond_to do |format|\n if @nvs_mig_status.save\n format.html { redirect_to @nvs_mig_status, notice: 'Nvs mig status was successfully created.' }\n format.json { render json: @nvs_mig_status, status: :created, location: @nvs_mig_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nvs_mig_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def status\n result = {\n 'uid' => Time.now.to_i,\n 'links' => [\n {\n 'rel' => 'self',\n 'href' => uri_to(status_site_cluster_path(params[:site_id], params[:id])),\n 'type' => api_media_type(:g5kitemjson)\n },\n {\n 'rel' => 'parent',\n 'href' => uri_to(site_cluster_path(params[:site_id], params[:id])),\n 'type' => api_media_type(:g5kitemjson)\n }\n ]\n }\n\n expected_rtypes = ['node']\n expected_rtypes.push('disk') if params[:disks] != 'no'\n result.merge!(OAR::Resource.status(clusters: params[:id], network_address: params[:network_address], job_details: params[:job_details], waiting: params[:waiting], types: expected_rtypes))\n\n render_result(result)\n end", "def index\n @health_statuses = HealthStatus.all\n end", "def cmd_list_by_status argv\n setup argv\n status = @hash['status']\n response = @api.list_by_status(status)\n if response.is_a?(Array)\n response.each do | r |\n msg r\n end\n else\n msg response\n end\n end", "def set_mstatus\n @mstatus = Mstatus.find(params[:id])\n end", "def getStatuses(response)\r\n\t\t\t\tstatuses_all_json = JSON.parse response\r\n\t\t\t\tstatuses_all_array = statuses_all_json[\"statuses\"]\r\n\t\t\t\tstatuses_class_array = Array.new\r\n\t\t\t\tfor i in 0...statuses_all_array.length\r\n\t\t\t\t\tstatuses_class_array.push(jsonToStatus(statuses_all_array[i]))\r\n\t\t\t\tend\r\n\t\t\t\treturn statuses_class_array\r\n\t\t\tend", "def update!\n response = Tessellator::Fetcher.new.call('get', 'https://howamidoing-duckinator.herokuapp.com/status.json')\n @@statuses = JSON.parse(response.body)['statuses']\n end", "def index\n @catalogs_statuses = Catalogs::Status.search(params[:search]).order(\"#{sort_column}\").paginate(per_page: 15, page: params[:page])\n end" ]
[ "0.71034646", "0.6481675", "0.6381433", "0.6374229", "0.6349098", "0.6274565", "0.619839", "0.619839", "0.61975145", "0.6116875", "0.6069184", "0.6049143", "0.6027578", "0.5956398", "0.5915856", "0.590662", "0.5885558", "0.58767056", "0.5872109", "0.58536625", "0.58460623", "0.5828561", "0.5820744", "0.5802836", "0.57952976", "0.57863265", "0.5782837", "0.57680297", "0.5740916", "0.5717382", "0.56995106", "0.5692428", "0.56912005", "0.566328", "0.56608325", "0.5657132", "0.56562835", "0.5651057", "0.56483907", "0.5627286", "0.56030065", "0.5592009", "0.5577719", "0.5575514", "0.55754685", "0.55719715", "0.5569745", "0.55647707", "0.5556793", "0.55508727", "0.5539022", "0.5538422", "0.55371386", "0.553464", "0.55309886", "0.5530504", "0.55288637", "0.5527736", "0.5523497", "0.55177677", "0.5516143", "0.5502234", "0.5490737", "0.5488169", "0.548245", "0.5475789", "0.5465678", "0.54614455", "0.54608226", "0.54604787", "0.54604787", "0.54597175", "0.5456825", "0.5442826", "0.5434587", "0.54253846", "0.54237145", "0.54058725", "0.5403904", "0.54024106", "0.5384007", "0.5382323", "0.5377015", "0.53727067", "0.53680754", "0.53660214", "0.5350983", "0.534707", "0.53430015", "0.53403306", "0.5339938", "0.5338669", "0.53315824", "0.53133446", "0.5312826", "0.5304978", "0.53028667", "0.529524", "0.52927166", "0.52879375" ]
0.7528968
0
GET /nvs_mig_statuses/1 GET /nvs_mig_statuses/1.json
def show @nvs_mig_status = NvsMigStatus.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @nvs_mig_status } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @nvs_mig_statuses = NvsMigStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nvs_mig_statuses }\n end\n end", "def index\n @mstatuses = Mstatus.all\n end", "def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end", "def new\n @nvs_mig_status = NvsMigStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nvs_mig_status }\n end\n end", "def status\n get_json('status.json')\n end", "def statuses; end", "def index\n @statuses = Status.all\n end", "def index\n @statuses = Status.all\n end", "def statuses\n api.get('status')\n end", "def index\n @request_statuses = RequestStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @request_statuses }\n end\n end", "def index\n @statuses = Status.search.page params[:page]\n end", "def index\n @member_statuses = MemberStatus.all\n end", "def current_statuses_three\n @current_statuses = CurrentStatus.where(status:true, id: [1,2,3]).order('name ASC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @current_statuses}\n end\n end", "def index\n @reqstatuses = Reqstatus.all\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 status\n request :get, \"_status\"\n end", "def statuses\n request(:get, \"applicant_tracking/statuses\")\n end", "def status\n get('/api/status')\n end", "def index\n @barrel_statuses = BarrelStatus.all\n end", "def index\n @married_statuses = MarriedStatus.all\n end", "def statuses( params={} )\n statuses = get_connections(\"statuses\", params)\n return map_connections statuses, :to => Facebook::Graph::Statuse\n end", "def index\n @application_statuses = ApplicationStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @application_statuses }\n end\n end", "def statuses\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Available\", \"2\" => \"On Hold\", \"3\" => \"Borrowed\", \"4\" => \"Unavailable\"}}, :status => 200\n\t\treturn\n\tend", "def index\n @statuses = Status.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @statuses }\n end\n end", "def statuses_911_list\n payload[:statuses].nil? ? nil : payload[:statuses]\n end", "def statuses( params={} )\n statuses = get_connections(\"statuses\", params)\n return map_connections statuses, :to => Facebook::Graph::Generic\n end", "def index\n @project_statuses = Project::Status.all\n end", "def index\n @inventory_statuses = InventoryStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventory_statuses }\n end\n end", "def index\n @search = MaritalStatus.search(params[:search])\n @marital_statuses = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erbb\n format.xml { render :xml => @marital_statuses }\n end\n end", "def mentions(params = {})\n get \"statuses/mentions\", params\n end", "def show\n @page_title = t(\"status.titles.show\", runid: @status.runid)\n respond_to do |format|\n format.html\n format.json {\n options = {}\n options[:except] = []\n if !logged_in? || !current_user.is_admin?\n options[:except] |= [:ipaddr]\n end\n render json: @status.to_json(options)\n }\n end\n end", "def get_redemption_request_statuses\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/utilities/redemption-request-statuses'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'Content-Type' => Configuration.content_type\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.get _query_url, headers: _headers\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) if not (_context.response.raw_body.nil? or _context.response.raw_body.to_s.strip.empty?)\r\n return decoded\r\n end", "def index\n @search = Status.search(params[:search], :order => \"id DESC\")\n @statuses = @search.paginate(:page => params[:page], :order => \"id DESC\")\n\n @statuses = @statuses.where(:uid => params[:uid]) unless params[:uid].nil?\n @statuses = @statuses.where(:screen_name => params[:screen_name]) unless params[:screen_name].nil?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @statuses }\n end\n end", "def index\n @invstatuses = Invstatus.all\n end", "def index\n @mission_statuses = MissionStatus.all\n end", "def index\n @status_requests = StatusRequest.all\n end", "def index\n @project_statuses = ProjectStatus.all\n end", "def destroy\n @nvs_mig_status = NvsMigStatus.find(params[:id])\n @nvs_mig_status.destroy\n\n respond_to do |format|\n format.html { redirect_to nvs_mig_statuses_url }\n format.json { head :no_content }\n end\n end", "def show_status(status_id)\n get \"statuses/show/#{status_id}\"\n end", "def parseResults( resp )\n data = JSON.parse(resp.body)\n\treturn data['statuses']\nend", "def index\n @entity_statuses = EntityStatus.all\n end", "def index\n @idea_statuses = IdeaStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @idea_statuses }\n end\n end", "def index\n @master_user_statuses = MasterUserStatus.all\n end", "def getStatus\n @@statuses[@status]\n end", "def status\n statuses.find(:first, :order => \"updated_at DESC\")\n end", "def index\n @client_statuses = ClientStatus.all\n end", "def index\n @sa_request_statuses = SaRequestStatus.all\n end", "def get_status(m, params)\n friends = params[:friends]\n show_reply = @bot.config['twitter.status_show_replies']\n if m.message.match(/^twitter status reply/)\n show_reply = true\n elsif m.message.match(/^twitter status noreply/)\n show_reply = false\n end\n\n if @registry.has_key?(m.sourcenick + \"_access_token\")\n @access_token = YAML::load(@registry[m.sourcenick + \"_access_token\"])\n nick = params[:nick] || @access_token.params[:screen_name]\n else\n if friends\n if @has_oauth\n m.reply \"You are not authorized with Twitter. Please use 'twitter authorize' first to use this feature.\"\n else\n report_oauth_missing(m, \"I cannot retrieve your friends status\")\n end\n return false\n end\n nick = params[:nick]\n end\n\n if not nick\n m.reply \"you should specify the username of the twitter to use, or identify using 'twitter authorize'\"\n return false\n end\n\n count = friends ? @bot.config['twitter.friends_status_count'] : @bot.config['twitter.status_count']\n if show_reply\n request_count = count\n else \n request_count = [ count*5,50 ].max\n end\n user = URI.escape(nick)\n # receive the public timeline per default (this works even without an access_token)\n uri = \"https://api.twitter.com/1/statuses/user_timeline.xml?screen_name=#{user}&count=#{request_count}&include_rts=true\"\n if @has_oauth and @registry.has_key?(m.sourcenick + \"_access_token\")\n if friends\n #no change to count variable\n uri = \"https://api.twitter.com/1/statuses/friends_timeline.xml?count=#{request_count}&include_rts=true\"\n end\n response = @access_token.get(uri).body\n else\n response = @bot.httputil.get(uri, :cache => false)\n end\n debug response\n\n texts = []\n\n if response\n begin\n rex = REXML::Document.new(response)\n rex.root.elements.each(\"status\") { |st|\n # month, day, hour, min, sec, year = st.elements['created_at'].text.match(/\\w+ (\\w+) (\\d+) (\\d+):(\\d+):(\\d+) \\S+ (\\d+)/)[1..6]\n # debug [year, month, day, hour, min, sec].inspect\n # time = Time.local(year.to_i, month, day.to_i, hour.to_i, min.to_i, sec.to_i)\n time = Time.parse(st.elements['created_at'].text)\n now = Time.now\n # Sometimes, time can be in the future; invert the relation in this case\n delta = ((time > now) ? time - now : now - time)\n msg = st.elements['text'].to_s + \" (#{Utils.secs_to_string(delta.to_i)} ago via #{st.elements['source'].to_s})\"\n author = \"\"\n if friends\n author = Utils.decode_html_entities(st.elements['user'].elements['name'].text) + \": \" rescue \"\"\n end\n texts << author+Utils.decode_html_entities(msg).ircify_html\n }\n if friends\n # friends always return the latest 20 updates, so we clip the count\n texts[count..-1]=nil\n end\n rescue\n error $!\n if friends\n m.reply \"could not parse status for #{nick}'s friends\"\n else\n m.reply \"could not parse status for #{nick}\"\n end\n return false\n end\n if !show_reply\n nonreplytexts = texts.grep(/^[^@]/)\n if nonreplytexts.length > 0\n texts = nonreplytexts\n end\n end\n # Make sure we have the right number\n texts[count..-1]=nil\n if texts.empty?\n m.reply \"No status updates!\"\n else\n m.reply texts.reverse.join(\"\\n\")\n end\n return true\n else\n if friends\n rep = \"could not get status for #{nick}'s friends\"\n rep << \", try asking in private\" unless m.private?\n else\n rep = \"could not get status for #{nick}\"\n end\n m.reply rep\n return false\n end\n end", "def index\n @posts_statuses = Posts::Status.all\n end", "def create\n @nvs_mig_status = NvsMigStatus.new(params[:nvs_mig_status])\n @nvs_mig_status.project_id = @project.id\n\n respond_to do |format|\n if @nvs_mig_status.save\n format.html { redirect_to @nvs_mig_status, notice: 'Nvs mig status was successfully created.' }\n format.json { render json: @nvs_mig_status, status: :created, location: @nvs_mig_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nvs_mig_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @new_status = NewStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @new_status }\n end\n end", "def set_mstatus\n @mstatus = Mstatus.find(params[:id])\n end", "def all_status\n\t status = Status.all\n\t return render_json_response(status, :ok)\n end", "def status_info\n current_path = '/api/v1/status'\n @conn.get(current_path)\n end", "def index\n \n @page = params[:page].to_i\n if @page == 0\n @page = 1\n end\n @page = @page + 1 \n \n # @statuses = Status.find(:all, :order => \"created_at DESC\")\n @statuses = Status.paginate :page => params[:page], :order => 'created_at DESC' #, :per_page => 3\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @statuses }\n format.js\n end\n end", "def list_timeline(list_owner_username, slug, query = {})\n perform_get(\"/#{list_owner_username}/lists/#{slug}/statuses.json\", :query => query)\nend", "def fetch_status\n connection = @client.connection\n response = connection.get do |req|\n req.url STATUS_BASE\n req.params['f'] = :json\n req.params['test'] = test_id\n end\n response_body = Hashie::Mash.new(JSON.parse(response.body))\n\n set_status(response_body.data.statusCode.to_s, true)\n end", "def update!\n response = Tessellator::Fetcher.new.call('get', 'https://howamidoing-duckinator.herokuapp.com/status.json')\n @@statuses = JSON.parse(response.body)['statuses']\n end", "def index\n params[:per_page] = perpage if params[:per_page].nil?\n params[:page] = 1 if params[:page].blank?\n conditions = {:status_type => 0 ,:relation_id => 0 ,:count_type => 0 }\n conditions[:status_type] = params[:status_type] unless params[:status_type].blank?\n conditions[:relation_id] = params[:relation_id] unless params[:relation_id].blank?\n conditions[:count_type] = params[:count_type] unless params[:count_type].blank?\n @kf_statuses = Kf::Status.order(\"date DESC\").where(conditions).paginate(:page => params[:page], :per_page => params[:per_page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kf_statuses }\n end\n end", "def get_statuses\n\t\t# scrape the statuses web page (more convenient than looking up an API)\n\t\t\n\t\turl = CONFIG[\"statuses URL\"]\n\t\tdoc = Nokogiri::HTML( open(url) )\n\t\tprojects = doc.css('.project')\n\t\t\n\t\tproject_statuses = projects.map do |project|\n\t\t\t{\n\t\t\t\tid_num: begin\n\t\t\t\t\tid = project.attr('id') #=> \"project_6\"\n\t\t\t\t\tid.match(/\\d+/).to_s.to_i\n\t\t\t\tend,\n\t\t\t\tname: begin\n\t\t\t\t\tproject.at_css('h3 a').content.strip\n\t\t\t\tend,\n\t\t\t\tbuild_status: begin\n\t\t\t\t\tclasses = project.attr('class').split #=> \"status_build_failed project\"\n\t\t\t\t\tbuild_status_class_common_prefix = 'status_'\n\t\t\t\t\tbuild_status_class = classes.find { |klass| klass.start_with?(build_status_class_common_prefix) }\n\t\t\t\t\tbuild_status_class.sub(build_status_class_common_prefix, '').to_sym\n\t\t\t\tend,\n\t\t\t}\n\t\tend\n\t\t\n\t\treturn project_statuses.sort_by { |status| status[:id_num] }\n\tend", "def index\n @api_v1_mentorings = Api::V1::Mentoring.all\n end", "def index\n @rh21_statuses = Rh21Status.all\n end", "def milestones\n process_list_response( send(:get , \"/api/v1/milestones.json\")[:body] , Unfuddled::Milestone)\n end", "def index\n authenticate_user! if params[:page]\n @statuses = Status.all.paginate(:page => params[:page], :per_page => 10).order(\"created_at DESC\")\n end", "def index\n @mtypes = Mtype.order(:code)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mtypes }\n end\n end", "def status\n sanitized = whitelist(params, :status)\n\n @travel = Travels::Travel.find(sanitized[:id])\n\n respond_to do |format|\n format.html # status.html.erb\n format.json { render json: { status: @travel.state.to_s } }\n end\n end", "def index\n @swit_statuses = SwitStatus.all\n end", "def show(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"statuses/#{id}\", :get) do |req|\n req.params = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end", "def get_status\n @reply['status']\n end", "def update\n @nvs_mig_status = NvsMigStatus.find(params[:id])\n\n respond_to do |format|\n if @nvs_mig_status.update_attributes(params[:nvs_mig_status])\n format.html { redirect_to @nvs_mig_status, notice: 'Nvs mig status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nvs_mig_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_statuses_with_http_info(tid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DevicesManagementApi.get_statuses ...\"\n end\n # verify the required parameter 'tid' is set\n fail ArgumentError, \"Missing the required parameter 'tid' when calling DevicesManagementApi.get_statuses\" if tid.nil?\n # resource path\n local_var_path = \"/devicemgmt/tasks/{tid}/statuses\".sub('{format}','json').sub('{' + 'tid' + '}', tid.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'dids'] = opts[:'dids'] if !opts[:'dids'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['artikcloud_oauth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TaskStatusesEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DevicesManagementApi#get_statuses\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def statuses_911\n statuses_911_list ? statuses_911_list.collection : []\n end", "def index\n statuses_dashboard\n end", "def index\n @lesson_statuses = LessonStatus.all\n end", "def index\n @relationship_statuses = RelationshipStatus.all\n end", "def status(id)\n http.get(\"/nfse/#{id}/status\") do |response|\n respond_with_entity(response, Entities::NfseStatus)\n end\n end", "def index\n @registration_statuses = RegistrationStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @registration_statuses }\n end\n end", "def index\n @player_statuses = PlayerStatus.all\n end", "def index\n @verbs = Verb.all\n\n render json: @verbs\n end", "def statuses\n aux = WorkOrderStatus.all\n render json: serialized_work_order_statuses(aux)\n end", "def statuses\n statuses = {\n \"Not started\" => 1,\n \"In Progress\" => 2,\n \"Finished\" => 3\n }\n return statuses\n end", "def index\n @status_ref_pago_inscs = StatusRefPagoInsc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_ref_pago_inscs }\n end\n end", "def show\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status }\n end\n end", "def retrieve_status\n \n end", "def getStatus(response)\r\n\t\t\t\tstatus_json = JSON.parse response\r\n\t\t\t\tstatus_array = status_json[\"statuses\"]\r\n\t\t\t\treturn jsonToStatus(status_array[0])\r\n\t\t\tend", "def show\n @status = Status.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status }\n end\n end", "def show\n @status = Status.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status }\n end\n end", "def cmd_list_by_status argv\n setup argv\n status = @hash['status']\n response = @api.list_by_status(status)\n if response.is_a?(Array)\n response.each do | r |\n msg r\n end\n else\n msg response\n end\n end", "def show\n @task = Task.find(params[:id])\n @subtasks = @task.statuses.order(:created_at).reverse\n @subtask = Status.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end", "def index\n @service_statuses = ServiceStatus.all\n end", "def status(id)\n get(\"mailers/status/#{id.to_i}\")\n end", "def index\n @requests = Request.where(status: -1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def marital_status\n fetch('demographic.marital_status')\n end", "def getStatus()\n params = Hash.new\n return doCurl(\"get\",\"/status\",params)\n end", "def index\n @status_activities = StatusActivity.all\n end", "def index\n @antrag_statuses = AntragStatus.all\n end", "def status(access_token:)\n client.execute(method: :get, path: \"/#{path}/info\", params: { access_token: access_token })\n end", "def status_enum\n status_list\n end", "def index\n @status2s = Status2.all\n end", "def index\n @episode_statuses = EpisodeStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @episode_statuses }\n end\n end" ]
[ "0.74588054", "0.6977914", "0.62716216", "0.6211762", "0.617108", "0.6168839", "0.61321396", "0.61321396", "0.61110187", "0.61087644", "0.6075625", "0.6030972", "0.5855255", "0.5826434", "0.5814863", "0.58050567", "0.57935035", "0.57774115", "0.5757139", "0.57382226", "0.5728601", "0.57073426", "0.56854606", "0.5684801", "0.5669324", "0.5668082", "0.5663774", "0.56544363", "0.5648268", "0.5647892", "0.5628535", "0.561859", "0.5616014", "0.5614847", "0.5612288", "0.55975085", "0.5594639", "0.5589743", "0.5585112", "0.5567434", "0.55627775", "0.5553247", "0.55474037", "0.55403405", "0.55331635", "0.5524784", "0.55223364", "0.5519307", "0.5515671", "0.55096203", "0.55024374", "0.54998875", "0.5495151", "0.5493974", "0.5493596", "0.5485285", "0.5484128", "0.54815006", "0.54780287", "0.5469396", "0.54629993", "0.5459186", "0.5453967", "0.54539394", "0.54419345", "0.54333246", "0.5432551", "0.54251856", "0.542389", "0.5411209", "0.5410658", "0.5407245", "0.5402924", "0.5399064", "0.5396921", "0.53905654", "0.53850114", "0.5378441", "0.5377008", "0.53751534", "0.5374247", "0.5356844", "0.5355466", "0.535516", "0.5354026", "0.53513736", "0.53513736", "0.5347447", "0.53390205", "0.5326178", "0.5323708", "0.5322363", "0.5321701", "0.5318895", "0.5315958", "0.53111523", "0.5308928", "0.53059846", "0.53036004", "0.53012705" ]
0.67431724
2
GET /nvs_mig_statuses/new GET /nvs_mig_statuses/new.json
def new @nvs_mig_status = NvsMigStatus.new respond_to do |format| format.html # new.html.erb format.json { render json: @nvs_mig_status } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def create\n @nvs_mig_status = NvsMigStatus.new(params[:nvs_mig_status])\n @nvs_mig_status.project_id = @project.id\n\n respond_to do |format|\n if @nvs_mig_status.save\n format.html { redirect_to @nvs_mig_status, notice: 'Nvs mig status was successfully created.' }\n format.json { render json: @nvs_mig_status, status: :created, location: @nvs_mig_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nvs_mig_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end", "def create\n @new_status = NewStatus.new(params[:new_status])\n\n respond_to do |format|\n if @new_status.save\n format.html { redirect_to @new_status, notice: 'New status was successfully created.' }\n format.json { render json: @new_status, status: :created, location: @new_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @new_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @request_status = RequestStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request_status }\n end\n end", "def create\n @current_statuses = CurrentStatus.new(current_statuses_params)\n\n respond_to do |format|\n if @current_statuses.save\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully created.' }\n format.json { render :show, status: :created, location: @current_statuses }\n else\n format.html { render :new }\n format.json { render json: @current_statuses.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @status_record = StatusRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_record }\n end\n end", "def new\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end", "def new\r\n @status_task = StatusTask.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @status_task }\r\n end\r\n end", "def new\n @story_status = StoryStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story_status }\n end\n end", "def create_statuses\n end", "def create_statuses\n end", "def new\n @record_status = RecordStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @record_status }\n end\n end", "def new\n @status_ativ = StatusAtiv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_ativ }\n end\n end", "def create\n @mstatus = Mstatus.new(mstatus_params)\n @mstatus.user_id = current_user.id\n\n respond_to do |format|\n if @mstatus.save\n format.html { redirect_to @mstatus, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @mstatus }\n else\n format.html { render :new }\n format.json { render json: @mstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end", "def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end", "def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end", "def new\n @itemstatus = Itemstatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemstatus }\n end\n end", "def new\n get_status\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tag }\n end\n end", "def new\n @mtype = Mtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mtype }\n end\n end", "def new\n @status = Status.new\n @status.build_document\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end", "def new\n @searchstatus = Searchstatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @searchstatus }\n end\n end", "def new\n @invite_status = InviteStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_status }\n end\n end", "def create\n @status = current_user.statuses.new(params[:status])\n\n respond_to do |format|\n if @status.save\n current_user.create_activity(@status, 'created')\n format.html { redirect_to profile_path(current_user), notice: 'Status was successfully created.' }\n format.json { render json: @status, status: :created, location: @status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @breadcrumb = 'create'\n @order_status = OrderStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_status }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat }\n end\n end", "def new\n @task_stat = TaskStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_stat }\n end\n end", "def new\n @assignment_status = AssignmentStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment_status }\n end\n end", "def new\n @agent_status = AgentStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agent_status }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stat }\n end\n end", "def new\n @project_status = ProjectStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_status }\n end\n end", "def new\n @package_status = PackageStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @package_status }\n end\n end", "def new\n @medium_status_mod = MediumStatusMod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medium_status_mod }\n end\n end", "def new\n @application_status = ApplicationStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application_status }\n end\n end", "def new\n @civil_status = CivilStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @civil_status }\n end\n end", "def new\n @inventory_status = InventoryStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_status }\n end\n end", "def new\n @evaluationstatus = Evaluationstatus.new\n @title = 'New Evaluation Status'\n @description = 'Add a new evaluation status to the system'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @evaluationstatus }\n end\n end", "def new\n @zone_status = ZoneStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zone_status }\n end\n end", "def create\n @status = Status.new(status_params)\n\n if @status.save\n render json: @status\n else\n render json: @status.errors, status: :unprocessable_entity\n end\n end", "def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end", "def create\n @status = Status.new(status_params)\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render action: 'show', status: :created, location: @status }\n else\n format.html { render action: 'new' }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @channel_status = ChannelStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @channel_status }\n end\n end", "def new\n @stat_misc = StatMisc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat_misc }\n end\n end", "def create\n @user = current_user\n @status = @user.statuses.build(status_params)\n\n #@status = Status.new(status_params)\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @status_de_la_notificacion = StatusDeLaNotificacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_de_la_notificacion }\n end\n end", "def new\n @kf_status = Kf::Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kf_status }\n end\n end", "def create\n @new_ = New.new(new__params)\n\n respond_to do |format|\n if @new_.save\n format.html { redirect_to @new_, notice: \"New was successfully created.\" }\n format.json { render :show, status: :created, location: @new_ }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @new_.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @status = Status.new(status_params)\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @statusreport = Statusreport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @statusreport }\n end\n end", "def new\n @level = Level.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level }\n end\n end", "def new\n @level = Level.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level }\n end\n end", "def new\n @level = Level.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level }\n end\n end", "def new\n @tweet = Tweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tweet }\n end\n end", "def new\n @tweet = Tweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tweet }\n end\n end", "def new\n @marital_status = MaritalStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @marital_status }\n end\n end", "def new\n @match_stat = MatchStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match_stat }\n end\n end", "def new\n @level = Level.new\n @level.set_defaults\n bingo!(\"create_level_button\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @level }\n end\n end", "def new\n @invoice_status = InvoiceStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_status }\n end\n end", "def new\n options = {} \n options[:status_id] = Status.find_by_title(params[:page]).id if params[:page]\n @task = Task.new(options)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n format.js { render :layout => false }\n end\n end", "def new\n\n\n @goal_id = params[:id]\n @milestone = Milestone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @milestone }\n end\n end", "def new\n @status_de_la_inscripcion = StatusDeLaInscripcion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_de_la_inscripcion }\n end\n end", "def new\n @presence = Presence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presence }\n end\n end", "def new\n @state = State.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @state }\n end\n end", "def new\n @state = State.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @state }\n end\n end", "def new\n @class_mstr = ClassMstr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_mstr }\n end\n end", "def new\n @pinglun = Pinglun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinglun }\n end\n end", "def new\n @breadcrumb = 'create'\n @work_order_status = WorkOrderStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_order_status }\n end\n end", "def new\n @active_stat = ActiveStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @active_stat }\n end\n end", "def new\n @course_status = CourseStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course_status }\n end\n end", "def new\n @machine_status = MachineStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @machine_status }\n end\n end", "def create\n @request_status = RequestStatus.new(params[:request_status])\n\n respond_to do |format|\n if @request_status.save\n format.html { redirect_to @request_status, notice: 'Request status was successfully created.' }\n format.json { render json: @request_status, status: :created, location: @request_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @health_level }\n end\n end", "def new\n @mib = Mib.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mib }\n end\n end", "def new\n @place = Place.new( :status => Status.active )\n @locals = Local.all\n @ticket_type_groups = TicketTypeGroup.order(:value)\n @statuses = Status.order(:value)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @place }\n end\n end", "def new\n @tasktype = Tasktype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tasktype }\n end\n end", "def new\n @recent_activity = RecentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recent_activity }\n end\n end", "def new\n @registration_status = RegistrationStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @registration_status }\n end\n end", "def new\n @status_ref_pago_insc = StatusRefPagoInsc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_ref_pago_insc }\n end\n end", "def new\n @assignmentstatus = Assignmentstatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @assignmentstatus }\n end\n end", "def new\n @breadcrumb = 'create'\n @inventory_count_type = InventoryCountType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_count_type }\n end\n end", "def new\n @retweet = Retweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @retweet }\n end\n end", "def create\n @story_status = StoryStatus.new(params[:story_status])\n\n respond_to do |format|\n if @story_status.save\n format.html { redirect_to @story_status, :notice => 'Story status was successfully created.' }\n format.json { render :json => @story_status, :status => :created, :location => @story_status }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @story_status.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n params[:kf_status][:status_type] = params[:status_type] unless params[:status_type].blank?\n params[:kf_status][:relation_id] = params[:relation_id] unless params[:relation_id].blank?\n params[:kf_status][:count_type] = params[:count_type] unless params[:count_type].blank?\n @kf_status = Kf::Status.new(params[:kf_status])\n\n respond_to do |format|\n if @kf_status.save\n format.html { redirect_to \"/kf/statuses?page=#{params[:page]}&relation_id=#{params[:relation_id]}&status_type=#{params[:status_type]}&count_type=#{params[:count_type]}\",notice: 'Status was successfully created.' }\n format.json { render json: @kf_status, status: :created, location: @kf_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kf_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @goal_state = GoalState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal_state }\n end\n end", "def new\n @annual_stat = AnnualStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @annual_stat }\n end\n end", "def new\n @release_status = ReleaseStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @release_status }\n end\n end", "def new\n @status_animal = StatusAnimal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_animal }\n end\n end", "def create\n @project_status = Project::Status.new(project_status_params)\n\n respond_to do |format|\n if @project_status.save\n format.html { redirect_to @project_status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @project_status }\n else\n format.html { render :new }\n format.json { render json: @project_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @task = Task.new\n # tasks_counts\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def create\n @member_status = MemberStatus.new(member_status_params)\n\n respond_to do |format|\n if @member_status.save\n format.html { redirect_to @member_status, notice: 'Member status was successfully created.' }\n format.json { render :show, status: :created, location: @member_status }\n else\n format.html { render :new }\n format.json { render json: @member_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @status = Status.new(params[:status])\n @status.user = current_user\n \n respond_to do |format|\n if @status.save\n flash[:notice] = 'Status was successfully created.'\n format.html { redirect_to(statuses_path) }\n format.xml { render :xml => @status, :status => :created, :location => @status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @status.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @idea_status = IdeaStatus.new\n # create the translation object for however many locales there are\n # so the form will properly create all of the nested form fields\n I18n.available_locales.each do |locale|\n\t\t\t@idea_status.idea_status_translations.build(:locale => locale)\n\t\tend\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idea_status }\n end\n end", "def new\n @term_count = TermCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @term_count }\n end\n end", "def new\n @listing_status = ListingStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @listing_status }\n end\n end", "def new\n @episode_status = EpisodeStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @episode_status }\n end\n end", "def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end", "def new\n @outgoing = Outgoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outgoing }\n end\n end", "def create\r\n @status_task = StatusTask.new(params[:status_task])\r\n\r\n respond_to do |format|\r\n if @status_task.save\r\n format.html { redirect_to @status_task, notice: 'Status task was successfully created.' }\r\n format.json { render json: @status_task, status: :created, location: @status_task }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @status_task.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end" ]
[ "0.75146556", "0.7132476", "0.71241945", "0.70829153", "0.68519", "0.67919815", "0.67425627", "0.6682156", "0.66818756", "0.662713", "0.65712076", "0.65712076", "0.65410477", "0.6536709", "0.6524999", "0.6507983", "0.6507983", "0.6507983", "0.6496631", "0.64817965", "0.647103", "0.645651", "0.6437633", "0.6429455", "0.6410154", "0.64044255", "0.6396524", "0.6393435", "0.63710564", "0.6358213", "0.6342458", "0.6322014", "0.6316165", "0.6306684", "0.6294728", "0.62847865", "0.6260853", "0.6239544", "0.6235335", "0.623022", "0.6217485", "0.6208067", "0.62047166", "0.6197703", "0.6165002", "0.6160334", "0.6158668", "0.61525226", "0.6125173", "0.6122033", "0.6118572", "0.6117384", "0.61168367", "0.61073816", "0.61073816", "0.60971427", "0.6094594", "0.6094266", "0.6093691", "0.60816824", "0.607075", "0.60602295", "0.6059742", "0.60562015", "0.60562015", "0.6055561", "0.60489976", "0.60467714", "0.60407674", "0.6035855", "0.6029462", "0.6027615", "0.6011846", "0.6011409", "0.60054815", "0.6005268", "0.60032487", "0.600323", "0.5992187", "0.5986858", "0.5985704", "0.5984723", "0.5978976", "0.5978847", "0.59768975", "0.5967922", "0.595863", "0.595842", "0.59583145", "0.59522784", "0.5951723", "0.594787", "0.59403586", "0.5934378", "0.5927262", "0.5927067", "0.59255356", "0.59246635", "0.59240663", "0.59224117" ]
0.7507979
1
POST /nvs_mig_statuses POST /nvs_mig_statuses.json
def create @nvs_mig_status = NvsMigStatus.new(params[:nvs_mig_status]) @nvs_mig_status.project_id = @project.id respond_to do |format| if @nvs_mig_status.save format.html { redirect_to @nvs_mig_status, notice: 'Nvs mig status was successfully created.' } format.json { render json: @nvs_mig_status, status: :created, location: @nvs_mig_status } else format.html { render action: "new" } format.json { render json: @nvs_mig_status.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_statuses\n end", "def create_statuses\n end", "def index\n @nvs_mig_statuses = NvsMigStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nvs_mig_statuses }\n end\n end", "def index\n @mstatuses = Mstatus.all\n end", "def create\n @mstatus = Mstatus.new(mstatus_params)\n @mstatus.user_id = current_user.id\n\n respond_to do |format|\n if @mstatus.save\n format.html { redirect_to @mstatus, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @mstatus }\n else\n format.html { render :new }\n format.json { render json: @mstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_status(name, description, level, image)\n response = @client.post(\"/api/v1/statuses\", { \"name\" => name, \"description\" => description, \"level\" => level, \"image\" => image })\n return JSON.parse(response.body)\n end", "def create\n @current_statuses = CurrentStatus.new(current_statuses_params)\n\n respond_to do |format|\n if @current_statuses.save\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully created.' }\n format.json { render :show, status: :created, location: @current_statuses }\n else\n format.html { render :new }\n format.json { render json: @current_statuses.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @nvs_mig_status = NvsMigStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nvs_mig_status }\n end\n end", "def statuses; end", "def create(attrs, user = @@default_user)\n attrs = { project_token: @project_token }.merge(attrs)\n @attributes = send_request('statuses', :post) do |req|\n req.body = {\n status_object: attrs.slice(:name),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end", "def create_starting_statuses\n new_status_attributes = { :public_title => \"New\",\n :application_status_type => ApplicationStatusType.find_or_create_by_name(\"new\"),\n :disallow_user_edits => 0,\n :disallow_all_edits => 0,\n :allow_application_edits => 1 }\n statuses.create(new_status_attributes)\n in_progress_status_attributes = { :public_title => \"In Progress\",\n :application_status_type => ApplicationStatusType.find_or_create_by_name(\"in_progress\"),\n :disallow_user_edits => 0,\n :disallow_all_edits => 0,\n :allow_application_edits => 1 }\n statuses.create(in_progress_status_attributes)\n submitted_status_attributes = { :public_title => \"Submitted\",\n :application_status_type => ApplicationStatusType.find_or_create_by_name(\"submitted\"),\n :disallow_user_edits => 1,\n :disallow_all_edits => 0,\n :allow_application_edits => 0 }\n statuses.create(submitted_status_attributes)\n end", "def create_status(*args)\n arguments(args, required: [:user, :repo, :id]) do\n assert_required %w[ state ]\n end\n params = arguments.params\n params['accept'] ||= PREVIEW_MEDIA\n\n post_request(\"repos/#{arguments.user}/#{arguments.repo}/deployments/#{arguments.id}/statuses\", params)\n end", "def create\n params[:kf_status][:status_type] = params[:status_type] unless params[:status_type].blank?\n params[:kf_status][:relation_id] = params[:relation_id] unless params[:relation_id].blank?\n params[:kf_status][:count_type] = params[:count_type] unless params[:count_type].blank?\n @kf_status = Kf::Status.new(params[:kf_status])\n\n respond_to do |format|\n if @kf_status.save\n format.html { redirect_to \"/kf/statuses?page=#{params[:page]}&relation_id=#{params[:relation_id]}&status_type=#{params[:status_type]}&count_type=#{params[:count_type]}\",notice: 'Status was successfully created.' }\n format.json { render json: @kf_status, status: :created, location: @kf_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kf_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def mstatus_params\n params.require(:mstatus).permit(:name, :user_id)\n end", "def create\n @status = current_user.statuses.new(status_params)\n\n if current_user.state_facebook? && @status.content?\n current_user.facebook(current_user).put_wall_post(@status.content)\n end\n\n if current_user.state_twitter? && @status.content?\n current_user.twitter(current_user).update(@status.content)\n end\n \n respond_to do |format|\n if @status.save\n format.html { redirect_to statuses_url, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { redirect_to statuses_url }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def statuses_911_list\n payload[:statuses].nil? ? nil : payload[:statuses]\n end", "def postTweet(status)\n\t\t\[email protected](status)\n\t\tend", "def create\n @status = Status.new(status_params)\n\n if @status.save\n render json: @status\n else\n render json: @status.errors, status: :unprocessable_entity\n end\n end", "def create_status(*args)\n arguments(args, required: [:user, :repo, :id]) do\n assert_required %w[ state ]\n permit VALID_STATUS_OPTIONS\n end\n params = arguments.params\n params['accept'] ||= PREVIEW_MEDIA\n\n post_request(\"repos/#{arguments.user}/#{arguments.repo}/deployments/#{arguments.id}/statuses\", params)\n end", "def create\n @status = current_user.statuses.new(params[:status])\n\n respond_to do |format|\n if @status.save\n current_user.create_activity(@status, 'created')\n format.html { redirect_to profile_path(current_user), notice: 'Status was successfully created.' }\n format.json { render json: @status, status: :created, location: @status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user\n @status = @user.statuses.build(status_params)\n\n #@status = Status.new(status_params)\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def build_statuses(options = {})\n build_statuses_resource(options)\n end", "def index\n @statuses = Status.all\n end", "def index\n @statuses = Status.all\n end", "def managed_app_statuses=(value)\n @managed_app_statuses = value\n end", "def statuses=(statuses)\n assert_unloaded\n @statuses = Array(statuses)\n end", "def index\n @member_statuses = MemberStatus.all\n end", "def destroy\n @nvs_mig_status = NvsMigStatus.find(params[:id])\n @nvs_mig_status.destroy\n\n respond_to do |format|\n format.html { redirect_to nvs_mig_statuses_url }\n format.json { head :no_content }\n end\n end", "def create\n @posts_status = Posts::Status.new(posts_status_params)\n\n respond_to do |format|\n if @posts_status.save\n format.html { redirect_to @posts_status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @posts_status }\n else\n format.html { render :new }\n format.json { render json: @posts_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end", "def create\n @member_status = MemberStatus.new(member_status_params)\n\n respond_to do |format|\n if @member_status.save\n format.html { redirect_to @member_status, notice: 'Member status was successfully created.' }\n format.json { render :show, status: :created, location: @member_status }\n else\n format.html { render :new }\n format.json { render json: @member_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @request_statuses = RequestStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @request_statuses }\n end\n end", "def update\n @nvs_mig_status = NvsMigStatus.find(params[:id])\n\n respond_to do |format|\n if @nvs_mig_status.update_attributes(params[:nvs_mig_status])\n format.html { redirect_to @nvs_mig_status, notice: 'Nvs mig status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nvs_mig_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @statuses = Status.search.page params[:page]\n end", "def create\n @status = Status.new(params[:status])\n\n respond_to do |format|\n if @status.save \n @user = @status.user\n @user.view_status = @status.view_status\n @user.save\n \n if @user.view_status == 'live' && @user.teacher?\n Innsights.report(\"Maestro aceptado\", :user => current_user, :group => current_network).run\n elsif @user.teacher?\n Innsights.report(\"Maestro suspendido\", :user => current_user, :group => current_network).run\n end\n\n format.html { redirect_to :back, notice: 'El status ha sido agregado correctamente al usuario' }\n format.json { render json: :back , status: :created, location: @status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @married_statuses = MarriedStatus.all\n end", "def status_params\n end", "def set_mstatus\n @mstatus = Mstatus.find(params[:id])\n end", "def create\n @new_status = NewStatus.new(params[:new_status])\n\n respond_to do |format|\n if @new_status.save\n format.html { redirect_to @new_status, notice: 'New status was successfully created.' }\n format.json { render json: @new_status, status: :created, location: @new_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @new_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @reqstatuses = Reqstatus.all\n end", "def add_status( thing, statusArray )\n data = {\n token: @applicationToken,\n thing_id: thing.id,\n id: 'null',\n status_array: statusArray\n }\n @httpHelper.post_data( 'status', data )\n end", "def update_status(status)\n post \"statuses/update\", :post => {:status => status}\n end", "def transform_status(status); end", "def create\n @counter = 0\n @teamstat = Teamstat.new(teamstat_params)\n\n @teamstat.toon_db = @teamstat.input.strip.split(/[\\r\\n ,]+/)\n @teamstat.toon_db.pop if @teamstat.toon_db[-1]==\"\\r\\n\"\n \n @teamstat.toon_db.each { |toonrealm| add_toon(toonrealm)}\n\n respond_to do |format|\n if @teamstat.save\n format.html { redirect_to @teamstat, notice: 'Teamstat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @teamstat }\n else\n format.html { render action: 'new' }\n format.json { render json: @teamstat.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @entity_statuses = EntityStatus.all\n end", "def create\n ActiveRecord::Base.transaction do\n @status = Status.new(status_params)\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'El Estado se cre&oacute; exitosamente.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @task = @project.tasks.new(task_params)\n @task.user = current_user if current_user.developer?\n @statuses = Task.statuses.keys\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to edit_project_task_path(@project, @task.id), notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n puts @task.errors.as_json\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def status\n @node.status = request.raw_post\n @node.save!\n render :text => @node.status\n end", "def statuses\n request(:get, \"applicant_tracking/statuses\")\n end", "def statusesReceived_forRequest(statuses,identifier)\n\t\tputs \"statusesReceived_forRequest\"\n\t\tself.statuses = statuses\n\tend", "def statuses\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Available\", \"2\" => \"On Hold\", \"3\" => \"Borrowed\", \"4\" => \"Unavailable\"}}, :status => 200\n\t\treturn\n\tend", "def update_status(payload, status)\n sha = payload.after\n repo = payload.repository.full_name\n state, description = status.first\n\n # setup http post\n uri = URI.parse(\"#{GITHUB_ROOT}/repos/#{repo}/statuses/#{sha}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n # post to GitHub\n params = {:state => state, :description => description, :context => CONTEXT}\n http.post(uri.path, params.to_json, HEADERS)\nend", "def statuses\n statuses = {\n \"Not started\" => 1,\n \"In Progress\" => 2,\n \"Finished\" => 3\n }\n return statuses\n end", "def index\n @posts_statuses = Posts::Status.all\n end", "def update!\n response = Tessellator::Fetcher.new.call('get', 'https://howamidoing-duckinator.herokuapp.com/status.json')\n @@statuses = JSON.parse(response.body)['statuses']\n end", "def status_params\n params.require(:status).permit(:status_id, :status_cluster_id, :status_description)\n end", "def index\n @invstatuses = Invstatus.all\n end", "def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end", "def index\n @mission_statuses = MissionStatus.all\n end", "def to_usmf status\n\n\t\tusmf = USMF.new\n\t\tuser = User.new\n\n\t\tstatus = JSON.parse(status)\n\t\tif status.has_key? 'Error'\n\t\t\tlogger.error(\"tweet malformed\")\n\t\t\traise \"status malformed\"\n\t\tend\n\n\t\t#Retrieving a status from Twitter\n\t\tusmf.service = \"Twitter\"\n\t\tusmf.id = status[\"id_str\"]\n\t\t\n\n\t\tx = status[\"coordinates\"]\n\t\tunless x==nil\n\t\t\tusmf.geo = x[\"coordinates\"]\n\t\tend\n\t\t\n\t\tusmf.application = status[\"source\"]\n\t\t\n\n\t\tx = status[\"place\"]\n\t\tunless x == nil\n\t\t\tusmf.location = x[\"full_name\"] + \" , \" + x[\"country\"]\n\t\tend\n\n\t\tusmf.date = status[\"created_at\"]\n\t\tusmf.text = status[\"text\"]\n\t\tusmf.description = status[\"in_reply_to_status_id_str\"]\n\t\tusmf.likes = status[\"retweet_count\"]\n\n\t\t#Retrieving user\n\t\tx = status[\"user\"]\n\t\tunless x == nil\n\t\t\tuser.name = x[\"screen_name\"]\n\t\t\tuser.real_name = x[\"name\"]\n\t\t\tuser.id = x[\"id_str\"]\n\t\t\tuser.language = x[\"lang\"]\n\n\t\t\tunless x[\"time_zone\"] == nil and x[\"utc_offset\"] == nil\n\t\t\t\tuser.utc = x[\"time_zone\"].to_s + \" + \" + x[\"utc_offset\"].to_s\n\t\t\tend\n\n\t\t\tuser.description = x[\"description\"]\n\t\t\tuser.avatar = x[\"profile_image_url_https\"]\n\t\t\tuser.location = x[\"location\"]\n\t\t\tuser.subscribers = x[\"followers_count\"]\n\t\t\tuser.subscriptions = x[\"friends_count\"]\n\t\t\tuser.postings = x[\"statuses_count\"]\n\t\t\tuser.profile = \"https://twitter.com/#!/#{user.name}\"\n\t\t\tuser.website = x[\"url\"]\n\n\t\t\tusmf.user = user\n\t\t\tusmf.source = \"https://twitter.com/#{usmf.user.name}/status/#{usmf.id}\"\n\t\tend\n\t\t\n\n\t\tusmf.to_users = []\n\t\tusmf.links = []\n\n\t\t#Retrieving entities\n\n\t\tentities = status[\"entities\"]\n\t\tunless entities == nil\n\t\t\n\t\t#Retrieving URLs\n\n\t\t\tx = entities[\"urls\"]\n\t\t\tunless x == nil\n\t\t\t\tx.each do |item|\n\t\t\t\t\tl = Link.new\n\t\t\t\t\tl.href = item[\"url\"]\n\t\t\t\t\t\n\t\t\t\t\tusmf.links << l\n\t\t\t\tend\n\t\t\tend\n\n\t\t#Retrieving all media content\n\n\t\t\tx = entities[\"media\"]\n\t\t\tunless x == nil\n\t\t\t\tx.each do |item|\n\t\t\t\t\tl = Link.new\n\t\t\t\t\tl.title = item[\"type\"]\n\t\t\t\t\tl.thumbnail = item[\"media_url\"]\n\t\t\t\t\tl.href = item[\"url\"]\n\t\t\t\t\t\n\t\t\t\t\tusmf.links << l\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t#Retrieving hashtags\n\n\t\t\tx = entities[\"hashtags\"]\n\t\t\tunless x == nil\n\n\t\t\t\tusmf.keywords = \"\"\n\t\t\t\tx.each do |h| \n\n\t\t\t\t\tusmf.keywords += h[\"text\"] + \", \"\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\t#Retrieving mentions\n\n\t\t\tx = entities[\"user_mentions\"]\n\t\t\tunless x == nil\n\t\t\t\tx.each do |item|\n\t\t\t\t\ttu = ToUser.new\n\n\t\t\t\t\ttu.name = item[\"screen_name\"]\n\t\t\t\t\ttu.id = item[\"id_str\"]\n\n\t\t\t\t\tif item[\"id_str\"] == status[\"in_reply_to_user_id_str\"]\n\t\t\t\t\t\ttu.service = \"reply\"\n\t\t\t\t\telse\n\t\t\t\t\t\ttu.service = \"mention\"\n\t\t\t\t\tend\n\t\t\t\t\tunless status[\"in_reply_to_status_id_str\"] == nil\n\t\t\t\t\t\ttu.title = status[\"in_reply_to_status_id_str\"]\n\t\t\t\t\t\ttu.href = \"https://twitter.com/#{tu.name}/status/#{tu.title}\"\n\t\t\t\t\tend\n\n\t\t\t\t\tusmf.to_users << tu\n\t\t\t\tend\n\t\t\tend\n\n\t\tend\n\n\t\tusmf\n\n\tend", "def create\n @status = Status.new(status_params)\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def statuses( params={} )\n statuses = get_connections(\"statuses\", params)\n return map_connections statuses, :to => Facebook::Graph::Generic\n end", "def statuses\n aux = WorkOrderStatus.all\n render json: serialized_work_order_statuses(aux)\n end", "def create\n @release_status = ReleaseStatus.new(release_status_params)\n\n respond_to do |format|\n if @release_status.save\n tflash('create', :success, {:model=>@@model, :count=>1})\n format.html { redirect_to( release_statuses_path)} #(@release_status #, :notice => 'version status was successfully created.') }\n format.xml { render :xml => @release_status, :status => :created, :location => @release_status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @release_status.errors, :status => :unprocessable_entity }\n end\n end\n end", "def postEntityStatus( entity_id, status, inactive_reason, inactive_description)\n params = Hash.new\n params['entity_id'] = entity_id\n params['status'] = status\n params['inactive_reason'] = inactive_reason\n params['inactive_description'] = inactive_description\n return doCurl(\"post\",\"/entity/status\",params)\n end", "def create_deployment_status(repo, deployment_id, state, options = {})\n opts = options.dup\n opts[:state] = state.to_s.downcase\n post \"#{Repository.path repo}/deployments/#{deployment_id}/statuses\", opts\n end", "def status_params\n params.require(:status).permit(:e_no, :str, :vit, :sense, :agi, :mag, :int, :will, :charm, :line, :role_id, :used_ap, :used_stp, :goodness)\n end", "def create\n @project_status = Project::Status.new(project_status_params)\n\n respond_to do |format|\n if @project_status.save\n format.html { redirect_to @project_status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @project_status }\n else\n format.html { render :new }\n format.json { render json: @project_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def statuses( params={} )\n statuses = get_connections(\"statuses\", params)\n return map_connections statuses, :to => Facebook::Graph::Statuse\n end", "def create\n @status = Status.new(status_params)\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render action: 'show', status: :created, location: @status }\n else\n format.html { render action: 'new' }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @sa_request_statuses = SaRequestStatus.all\n end", "def add_retweet(status)\n\t@tweet_db[status.retweeted_status.id] ||= {\n\t\t:original => status.retweeted_status,\n\t\t:retweets => {}\n\t}\n\t@tweet_db[status.retweeted_status.id][:retweets][status.id] = status\nend", "def map_status\n end", "def index\n @project_statuses = ProjectStatus.all\n end", "def create\n @barrel = Barrel.find(params[:barrel_id])\n if @barrel\n @barrel_status = @barrel.barrel_statuses.build(barrel_status_params)\n if @barrel_status.save\n render :show, :status => :created\n else\n render :json => { :errors => @barrel_status.errors }, :status => :unprocessable_entity\n end\n else\n render :json => { :message => \"No barrel found\" }, :status => :not_found\n end\n\n end", "def update_status(m, params)\n unless @has_oauth\n report_oauth_missing(m, \"I cannot update your status\")\n return false\n end\n\n unless @registry.has_key?(m.sourcenick + \"_access_token\")\n m.reply \"You must first authorize your Twitter account before tweeting.\"\n return false;\n end\n @access_token = YAML::load(@registry[m.sourcenick + \"_access_token\"])\n\n uri = \"https://api.twitter.com/statuses/update.json\"\n msg = params[:status].to_s\n\n if msg.length > 140\n m.reply \"your status message update is too long, please keep it under 140 characters\"\n return\n end\n\n response = @access_token.post(uri, { :status => msg })\n debug response\n\n reply_method = params[:notify] ? :notify : :reply\n if response.class == Net::HTTPOK\n m.__send__(reply_method, \"status updated\")\n else\n m.__send__(reply_method, \"could not update status\")\n end\n end", "def index\n @barrel_statuses = BarrelStatus.all\n end", "def create\n @request_status = RequestStatus.new(params[:request_status])\n\n respond_to do |format|\n if @request_status.save\n format.html { redirect_to @request_status, notice: 'Request status was successfully created.' }\n format.json { render json: @request_status, status: :created, location: @request_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_translation_status(project_id, params)\n c_r Lokalise::Resources::CustomTranslationStatus, :create, project_id, params\n end", "def update_statuses(opts = {})\n response = Crocodoc.connection.get 'document/status',\n :uuids => @documents.values.map{|doc| doc.uuid }.join(',')\n response.body.each do |resp|\n @documents[resp['uuid']].status = resp\n end\n end", "def create\n @entity_status = EntityStatus.new(entity_status_params)\n\n respond_to do |format|\n if @entity_status.save\n format.html { redirect_to entity_statuses_path, notice: 'Entity status was successfully created.' }\n format.json { render :show, status: :created, location: @entity_status }\n else\n format.html { render :new }\n format.js { render :new }\n format.json { render json: @entity_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def status(params)\n http_helper.send_post_request(\"#{@url_prefix}/status\", params)\n end", "def status\n @way.status = request.raw_post\n @way.save!\n render :text => @way.status\n end", "def create\n @marital_status = MaritalStatus.new(params[:marital_status])\n\n respond_to do |format|\n if @marital_status.save\n format.html { redirect_to(@marital_status, :notice => 'Marital status was successfully created.') }\n format.xml { render :xml => @marital_status, :status => :created, :location => @marital_status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @marital_status.errors, :status => :unprocessable_entity }\n end\n end\n end", "def managed_app_statuses()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def create\n @project_status = ProjectStatus.new(project_status_params)\n\n respond_to do |format|\n if @project_status.save\n format.html { redirect_to project_statuses_url, notice: 'Project status was successfully created.' }\n format.json { render :show, status: :created, location: @project_status }\n else\n format.html { render :new }\n format.json { render json: @project_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def marketing_statuses\n sources = []\n changed_sources = []\n\n \n # collect l2l source source\n @resident.sources.where(:property_id => params[:prop_id]).each_with_index do |s, i|\n pp \"#{s.status}, #{s.status_date}, #{s.created_at}\"\n if s.status\n sources << {\n :status => s.status,\n :status_date => s.created_at,\n :move_in => s.move_in,\n :move_out => s.move_out\n }\n end\n end\n\n #collect only changed source (status & status_date changed)\n # must order by status_date asc, status_date always exists\n sorted_sources = sources.sort{|a, b| a[:status_date] <=> b[:status_date] }\n sorted_sources.each_with_index do |s, i|\n if i == 0\n changed_sources << s\n\n elsif s[:status] != sorted_sources[i-1][:status]\n changed_sources << s\n\n end\n end\n\n\n @statuses = changed_sources.sort{|a, b| b[:status_date] <=> a[:status_date] }\n \n render :json => @statuses.collect{|n| \n {\n :status => n[:status],\n :status_date => n[:status_date].to_s(:utc_date),\n :move_in => pretty_move_in(n[:move_in]),\n :move_out => pretty_move_in(n[:move_out])\n }\n }\n end", "def update_batch_statuses\n current_batches = decode(batch_statuses)\n \n if current_batches.keys.count > 20\n current_batches.keys[0..15].each do |batch_id|\n current_batches.delete(batch_id)\n end\n end\n\n current_batches.each do |id, status|\n case batch_status(id)\n when \"finished\"\n current_batches.delete(id)\n else\n current_batches[id] = batch_status(id)\n end\n end\n update_attribute(:batch_statuses, encode(current_batches))\n end", "def index\n @master_user_statuses = MasterUserStatus.all\n end", "def show\n @nvs_mig_status = NvsMigStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nvs_mig_status }\n end\n end", "def create\n @mission_status = MissionStatus.new(mission_status_params)\n\n respond_to do |format|\n if @mission_status.save\n format.html { redirect_to [:admin, @mission_status], notice: 'Mission status was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mission_status }\n else\n format.html { render action: 'new' }\n format.json { render json: @mission_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n params[:per_page] = perpage if params[:per_page].nil?\n params[:page] = 1 if params[:page].blank?\n conditions = {:status_type => 0 ,:relation_id => 0 ,:count_type => 0 }\n conditions[:status_type] = params[:status_type] unless params[:status_type].blank?\n conditions[:relation_id] = params[:relation_id] unless params[:relation_id].blank?\n conditions[:count_type] = params[:count_type] unless params[:count_type].blank?\n @kf_statuses = Kf::Status.order(\"date DESC\").where(conditions).paginate(:page => params[:page], :per_page => params[:per_page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kf_statuses }\n end\n end", "def create_status(Status status)\n Status.create(group_id: @group_id, status: status)\n end", "def create\n @story_status = StoryStatus.new(params[:story_status])\n\n respond_to do |format|\n if @story_status.save\n format.html { redirect_to @story_status, :notice => 'Story status was successfully created.' }\n format.json { render :json => @story_status, :status => :created, :location => @story_status }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @story_status.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @project_statuses = Project::Status.all\n end", "def create\n @status = Status.new(params[:status])\n @status.user = current_user\n \n respond_to do |format|\n if @status.save\n flash[:notice] = 'Status was successfully created.'\n format.html { redirect_to(statuses_path) }\n format.xml { render :xml => @status, :status => :created, :location => @status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @status.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @status_requests = StatusRequest.all\n end", "def create\n @status_ativ = StatusAtiv.new(params[:status_ativ])\n\n respond_to do |format|\n if @status_ativ.save\n format.html { redirect_to @status_ativ, notice: 'Status ativ was successfully created.' }\n format.json { render json: @status_ativ, status: :created, location: @status_ativ }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_ativ.errors, status: :unprocessable_entity }\n end\n end\n end", "def status_translations\n @status_translations ||= Assembla.statuses['ticket_statuses']\nend", "def add_to_database(t, i)\n created_at = DateTime.strptime(t['created_at'], '%a %b %d %H:%M:%S %z %Y')\n # get rid of annoying Asian characters\n location = t['user']['location']#.gsub(/[^\\p{Latin}\\/ \\-,]/, '')\n\n begin\n # if the object contains latitude and longitude and retweeted status\n if t['coordinates'] != nil and t['retweeted_status'] != nil\n status = Status.create(:id => t['id_str'], :text => t['text'],\n :created_at => created_at,\n :longitude => t['coordinates']['coordinates'][0],\n :latitude => t['coordinates']['coordinates'][1],\n :favorite_count => t['favorite_count'],\n :retweet_count => t['retweet_count'],\n :original_status_id => t['retweeted_status']['id_str'],\n :user_id => t['user']['id_str'],\n :user_followers_count => t['user']['followers_count'],\n :user_friends_count => t['user']['friends_count'],\n :user_location => location,\n :user_screen_name => t['user']['screen_name'])\n elsif t['coordinates'] == nil and t['retweeted_status'] != nil\n # else if no longitude and latitude but does have retweeted status\n status = Status.create(:id => t['id_str'], :text => t['text'],\n :created_at => created_at,\n :favorite_count => t['favorite_count'],\n :retweet_count => t['retweet_count'],\n :original_status_id => t['retweeted_status']['id_str'],\n :user_id => t['user']['id_str'],\n :user_followers_count => t['user']['followers_count'],\n :user_friends_count => t['user']['friends_count'],\n :user_location => location,\n :user_screen_name => t['user']['screen_name'])\n # else if the object contains latitude and longitude but not retweeted status\n elsif t['coordinates'] != nil and t['retweeted_status'] == nil\n status = Status.create(:id => t['id_str'], :text => t['text'],\n :created_at => created_at,\n :longitude => t['coordinates']['coordinates'][0],\n :latitude => t['coordinates']['coordinates'][1],\n :favorite_count => t['favorite_count'],\n :retweet_count => t['retweet_count'],\n :user_id => t['user']['id_str'],\n :user_followers_count => t['user']['followers_count'],\n :user_friends_count => t['user']['friends_count'],\n :user_location => location,\n :user_screen_name => t['user']['screen_name'])\n elsif t['coordinates'] == nil and t['retweeted_status'] == nil\n # else if no longitude, no latitude, and no retweeted status\n status = Status.create(:id => t['id_str'], :text => t['text'],\n :created_at => created_at,\n :favorite_count => t['favorite_count'],\n :retweet_count => t['retweet_count'],\n :user_id => t['user']['id_str'],\n :user_followers_count => t['user']['followers_count'],\n :user_friends_count => t['user']['friends_count'],\n :user_location => location,\n :user_screen_name => t['user']['screen_name'])\n end \n rescue StandardError => e\n # if the new row doesn't get created in the database, print out\n # some helpful info so we can look to see what's going on\n if e.class.to_s == 'ActiveRecord::RecordNotUnique'\n return 1\n else\n puts i.to_s\n puts $!\n return 0\n end\n end\n\n # add URLs, if there are any. I set the urls table to hold 1024\n # characters, so limit the url characters to that many\n if t[\"entities\"].keys.include? \"urls\"\n t[\"entities\"][\"urls\"].each do |url|\n status.urls.create(:url => url['expanded_url'][0..1023])\n end\n end\n\n return 0\nend" ]
[ "0.68328726", "0.68328726", "0.6366447", "0.6148457", "0.5890538", "0.5773629", "0.5696787", "0.5686594", "0.5681192", "0.564406", "0.554794", "0.5481174", "0.54770535", "0.54740757", "0.54636455", "0.5444942", "0.54257244", "0.54051775", "0.53952366", "0.5367676", "0.53453064", "0.531275", "0.5303378", "0.5303378", "0.52874637", "0.5265046", "0.5264726", "0.52199775", "0.5211317", "0.52008873", "0.51573586", "0.5156676", "0.5156411", "0.5154947", "0.5144808", "0.5138849", "0.5113662", "0.5111852", "0.5108039", "0.5107909", "0.50847554", "0.5070151", "0.50691605", "0.50579137", "0.50566715", "0.5041006", "0.50337297", "0.50200415", "0.5004155", "0.499716", "0.4993647", "0.49931452", "0.49895918", "0.49872488", "0.4983469", "0.49711633", "0.49702188", "0.49680477", "0.4960027", "0.49555007", "0.49554127", "0.49533015", "0.49507487", "0.49505278", "0.4949725", "0.49473646", "0.49338433", "0.4931571", "0.49283332", "0.49251837", "0.4919337", "0.49128652", "0.49103194", "0.4907803", "0.490367", "0.48810115", "0.4879481", "0.4875345", "0.4869877", "0.48697415", "0.4867857", "0.48643884", "0.4855354", "0.48545554", "0.4854115", "0.48524135", "0.484661", "0.48465985", "0.48460883", "0.48440626", "0.48349237", "0.4834803", "0.4830716", "0.4827955", "0.4826742", "0.48099643", "0.47971523", "0.4795122", "0.4788387", "0.478822" ]
0.6518876
2
PUT /nvs_mig_statuses/1 PUT /nvs_mig_statuses/1.json
def update @nvs_mig_status = NvsMigStatus.find(params[:id]) respond_to do |format| if @nvs_mig_status.update_attributes(params[:nvs_mig_status]) format.html { redirect_to @nvs_mig_status, notice: 'Nvs mig status was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @nvs_mig_status.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @current_statuses.update(current_statuses_params)\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_statuses }\n else\n format.html { render :edit }\n format.json { render json: @current_statuses.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_statuses\n end", "def create_statuses\n end", "def create\n @nvs_mig_status = NvsMigStatus.new(params[:nvs_mig_status])\n @nvs_mig_status.project_id = @project.id\n\n respond_to do |format|\n if @nvs_mig_status.save\n format.html { redirect_to @nvs_mig_status, notice: 'Nvs mig status was successfully created.' }\n format.json { render json: @nvs_mig_status, status: :created, location: @nvs_mig_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nvs_mig_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mstatus.update(mstatus_params)\n format.html { redirect_to @mstatus, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @mstatus }\n else\n format.html { render :edit }\n format.json { render json: @mstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!\n response = Tessellator::Fetcher.new.call('get', 'https://howamidoing-duckinator.herokuapp.com/status.json')\n @@statuses = JSON.parse(response.body)['statuses']\n end", "def set_mstatus\n @mstatus = Mstatus.find(params[:id])\n end", "def update_status status\n @job.set({\n custom_status: status,\n pinged_at: Time.now\n })\n end", "def update(attrs, user = @@default_user)\n attrs = { id: @id, project_token: @project_token }.merge(attrs)\n @attributes = send_request(\"statuses/#{attrs[:id]}\", :put) do |req|\n req.body = {\n status_object: attrs.slice(:name),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end", "def index\n @nvs_mig_statuses = NvsMigStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nvs_mig_statuses }\n end\n end", "def update_status(new_stat)\n\n attrs = ActionController::Parameters.new({status: new_stat, req_to_del_at: nil})\n self.update_attributes(attrs.permit(Team::PERMIT_BASE))\n end", "def update_status(payload, status)\n sha = payload.after\n repo = payload.repository.full_name\n state, description = status.first\n\n # setup http post\n uri = URI.parse(\"#{GITHUB_ROOT}/repos/#{repo}/statuses/#{sha}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n # post to GitHub\n params = {:state => state, :description => description, :context => CONTEXT}\n http.post(uri.path, params.to_json, HEADERS)\nend", "def index\n @mstatuses = Mstatus.all\n end", "def update_status(status)\n post \"statuses/update\", :post => {:status => status}\n end", "def update\n params[:kf_status][:status_type] = params[:status_type] unless params[:status_type].blank?\n params[:kf_status][:relation_id] = params[:relation_id] unless params[:relation_id].blank?\n params[:kf_status][:count_type] = params[:count_type] unless params[:count_type].blank?\n @kf_status = Kf::Status.find(params[:id])\n\n respond_to do |format|\n if @kf_status.update_attributes(params[:kf_status])\n format.html { redirect_to \"/kf/statuses?page=#{params[:page]}&relation_id=#{params[:relation_id]}&status_type=#{params[:status_type]}&count_type=#{params[:count_type]}\", notice: 'Status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kf_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @nvs_mig_status = NvsMigStatus.find(params[:id])\n @nvs_mig_status.destroy\n\n respond_to do |format|\n format.html { redirect_to nvs_mig_statuses_url }\n format.json { head :no_content }\n end\n end", "def update_statuses(opts = {})\n response = Crocodoc.connection.get 'document/status',\n :uuids => @documents.values.map{|doc| doc.uuid }.join(',')\n response.body.each do |resp|\n @documents[resp['uuid']].status = resp\n end\n end", "def update_vpn_status\n # Request parameters\n mac = params[:mac]\n vpn_status_name = params[:vpn_status]\n vpn_sw = params[:vpn_sw]\n ip = params[:ip]\n viewpoint = params[:viewpoint] || \"Unknown\"\n vpn_status = VpnStatus.find_by_name vpn_status_name\n node = Node.find_or_create_by_id mac.to_i(16)\n node.update_vpn_status vpn_status,ip,vpn_sw,viewpoint\n render status: :created, :text => \"\"\n end", "def test_change_status\n expected = 200\n post_id = 1\n data = {\n status: 1\n }\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s+'/status')\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def postTweet(status)\n\t\t\[email protected](status)\n\t\tend", "def updateStatus\n\n storyURI = @details['Assets']['Asset']['href']\n\n statusXml = '<Asset>\n <Attribute name=\"Custom_JIRAIntStatus\" act=\"set\">' + @mapping.SendToJiraMap['Resolved in JIRA'] + '</Attribute>\n </Asset>'\n\n r_status = self.class.post(\"#{storyURI}\", :body => statusXml,\n :headers => {\"content_type\" => \"application/xml\"}, :verify => false)\n\n if r_status['Error']\n p r_status['Error']\n else\n @persist.updateDefectStatus(@story)\n return 1\n end\n return 0\n end", "def update\n status_key = STATUS[rand(STATUS.length)]\n\n n = Spooge.update_all_on_redis(:touch_date, DateTime.now)\n n = Spooge.update_all_on_redis(:status, status_key)\n resp = {:updated => n, :status_key => status_key}\n render :json => resp\n end", "def update_status(m, params)\n unless @has_oauth\n report_oauth_missing(m, \"I cannot update your status\")\n return false\n end\n\n unless @registry.has_key?(m.sourcenick + \"_access_token\")\n m.reply \"You must first authorize your Twitter account before tweeting.\"\n return false;\n end\n @access_token = YAML::load(@registry[m.sourcenick + \"_access_token\"])\n\n uri = \"https://api.twitter.com/statuses/update.json\"\n msg = params[:status].to_s\n\n if msg.length > 140\n m.reply \"your status message update is too long, please keep it under 140 characters\"\n return\n end\n\n response = @access_token.post(uri, { :status => msg })\n debug response\n\n reply_method = params[:notify] ? :notify : :reply\n if response.class == Net::HTTPOK\n m.__send__(reply_method, \"status updated\")\n else\n m.__send__(reply_method, \"could not update status\")\n end\n end", "def status=(new_status)\n update_values([:status] => new_status)\n end", "def update\n @new_status = NewStatus.find(params[:id])\n\n respond_to do |format|\n if @new_status.update_attributes(params[:new_status])\n format.html { redirect_to @new_status, notice: 'New status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @new_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_status(status)\n self.status = status\n self.save! validate: false\n end", "def update\n ticket = Ticket.find(params[:id])\n status = params[:status]\n\n if status and ticket.update_attributes(status: status)\n render json: {\"notice\"=>\"status updated successfully to '#{status}'\"}\n else\n render json: {\"alert\"=>\"status not updated. check params.\"}\n end\n end", "def create\n @mstatus = Mstatus.new(mstatus_params)\n @mstatus.user_id = current_user.id\n\n respond_to do |format|\n if @mstatus.save\n format.html { redirect_to @mstatus, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @mstatus }\n else\n format.html { render :new }\n format.json { render json: @mstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @status.update(isshared: params[:isshared])\n format.json { head :no_content }\n else\n format.json {\n render json: @status.errors,\n status: :unprocessable_entity\n }\n end\n end\n end", "def set_status(status, status_message = '')\n return if status == Algorithm.statuses[self.status]\n self.update_attributes(status: status)\n self.update_attributes(status_message: status_message)\n self.update_attribute(:diva_id, nil) if self.status == 'review' || self.status == 'unpublished_changes'\n self.update_version if self.status == 'published'\n end", "def set_status(user_id, status)\n user_id = user_id.to_s\n validate_identifier(:user_id, user_id)\n call_myspace_api(:status_put, :user_id => user_id, :body => {:status => status})\n end", "def update!(**args)\n @venom_status = args[:venom_status] if args.key?(:venom_status)\n end", "def update\n respond_to do |format|\n if @release_status.update_attributes(release_status_params)\n tflash('update', :success, {:model=>@@model, :count=>1})\n format.html { redirect_to( release_statuses_path)} #(@release_status, :notice => 'version status was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @release_status.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_status!(user, status, in_reply_to_status_id = nil)\n self.twitagent(user.token, user.secret).update_status!(status, in_reply_to_status_id)\n\tend", "def update\n @concept_map = ConceptMap.find(params[:id])\n if current_user.role.id == 7\n params[:concept_map][:status] = 6\n end\n respond_to do |format|\n if @concept_map.update_attributes(params[:concept_map])\n format.html { redirect_to@concept_map, notice: 'ConceptMap was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@concept_map.errors, status: :unprocessable_entity }\n end\n end\n end", "def mstatus_params\n params.require(:mstatus).permit(:name, :user_id)\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status(user_id, status)\r\n user_id = user_id.to_s\r\n @context.validate_identifier(:user_id, user_id)\r\n @context.call_myspace_api(:status_put, :user_id => user_id, :body => {:status => status})\r\n end", "def update\n respond_to do |format|\n if @reqstatus.update(reqstatus_params)\n format.html { redirect_to @reqstatus, notice: 'Reqstatus was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reqstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def update\n\n #LA\n #@status = current_user.statuses.find(status_params)\n\n #if (status_params) && (status_params).has_key?(:user_id)\n # (status_params).delete(:user_id) \n #end\n\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to statuses_url, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render action: 'edit' }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @status_content = args[:status_content] if args.key?(:status_content)\n @status_file_name = args[:status_file_name] if args.key?(:status_file_name)\n end", "def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end", "def statuses=(statuses)\n assert_unloaded\n @statuses = Array(statuses)\n end", "def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end", "def change_status(status)\n #not implemented \n end", "def update!(**args)\n @new_status = args[:new_status] if args.key?(:new_status)\n end", "def create\n @current_statuses = CurrentStatus.new(current_statuses_params)\n\n respond_to do |format|\n if @current_statuses.save\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully created.' }\n format.json { render :show, status: :created, location: @current_statuses }\n else\n format.html { render :new }\n format.json { render json: @current_statuses.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @token_status = args[:token_status] if args.key?(:token_status)\n end", "def update\n respond_to do |format|\n if @member_status.update(member_status_params)\n format.html { redirect_to @member_status, notice: 'Member status was successfully updated.' }\n format.json { render :show, status: :ok, location: @member_status }\n else\n format.html { render :edit }\n format.json { render json: @member_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_status!( status , in_reply_to_status_id = nil )\n\t\tif in_reply_to_status_id\n\t\t\tresponse = access_token.post('/statuses/update.json', { :status => status, :in_reply_to_status_id => in_reply_to_status_id })\n\t\telse\n\t\t\tresponse = access_token.post('/statuses/update.json', { :status => status })\n\t\tend\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tmessage=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless message.is_a? Hash\n\t\t\tmessage\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in update_status!: #{err}\"\n\t\traise err\n\tend", "def set_status status\n self.update(pet_status: status)\n end", "def updateStatus id, status\n\t\[email protected] Hash['status' => status], ['id', id]\n\tend", "def update_status\n \t update_user_book = UsersBook.find(params[:id])\n \t update_user_book.status = params[:status]\n\n \t render :json => {:status => \"success\"}\n end", "def replace_namespaced_stateful_set_status_with_http_info(name, namespace, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.replace_namespaced_stateful_set_status ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling AppsV1Api.replace_namespaced_stateful_set_status\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.replace_namespaced_stateful_set_status\"\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 AppsV1Api.replace_namespaced_stateful_set_status\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/status\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'dryRun'] = opts[:'dry_run'] if !opts[:'dry_run'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['BearerToken']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'V1StatefulSet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#replace_namespaced_stateful_set_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def update\n @assignment.status = params[:status]\n @assignment.save!\n head :no_content\n end", "def statuses; end", "def update\n\n respond_to do |format|\n if @marital_status.update_attributes(params[:marital_status])\n format.html { redirect_to(@marital_status, :notice => 'Marital status was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @marital_status.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render :edit }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render :edit }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @nvs_mig_status = NvsMigStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nvs_mig_status }\n end\n end", "def update_status!( status , in_reply_to_status_id = nil )\n\t\tself.twitagent.update_status!( status , in_reply_to_status_id )\n\trescue => err\n\t\t# The user might have rejected this application. Or there was some other error during the request.\n\t\tRAILS_DEFAULT_LOGGER.error \"#{err.message} Failed update status\"\n\t\treturn\n\tend", "def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n end", "def update\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_status_request\n @status_request = StatusRequest.friendly.find(params[:id])\n end", "def update_status\n update_params = {status: params[:status]}\n update_params[:password] = \"\" if params[:object] == \"User\"\n\n model = params[:object].constantize\n object = model.find(params[:status_id])\n if object.update_attributes(update_params)\n render json: {success:{msg: \"Updated #{params[:object]}\", id: object.id.to_s}}\n else \n render json: {failure:{msg: object.errors.full_messages.first}}\n end\n end", "def change_status(object, status)\n object.update_attribute :status, status\n end", "def update\n ActiveRecord::Base.transaction do\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to @status, notice: 'El Estado se actualizo correctamente.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render :edit }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def change_status\n @user = User.find(params[:data])\n\n respond_to do |format|\n if @user.update_attributes(status: params[:status])\n format.json { render json: @user }\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n end", "def set_status_cluster\n @status_cluster = StatusCluster.find(params[:id])\n end", "def update\n @request_status = RequestStatus.find(params[:id])\n\n respond_to do |format|\n if @request_status.update_attributes(params[:request_status])\n format.html { redirect_to @request_status, notice: 'Request status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @status_task = StatusTask.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @status_task.update_attributes(params[:status_task])\r\n format.html { redirect_to @status_task, notice: 'Status task 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: @status_task.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update_batch_statuses\n current_batches = decode(batch_statuses)\n \n if current_batches.keys.count > 20\n current_batches.keys[0..15].each do |batch_id|\n current_batches.delete(batch_id)\n end\n end\n\n current_batches.each do |id, status|\n case batch_status(id)\n when \"finished\"\n current_batches.delete(id)\n else\n current_batches[id] = batch_status(id)\n end\n end\n update_attribute(:batch_statuses, encode(current_batches))\n end", "def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def meeting_update_status(*args)\n options = Zoom::Params.new(Utils.extract_options!(args))\n options.require(%i[meeting_id])\n Utils.parse_response self.class.put(\"/meetings/#{options[:meeting_id]}/status\", body: options.except(:meeting_id).to_json, headers: request_headers)\n end", "def update\n @status = Status.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:status])\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @status = Status.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:status])\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.5958617", "0.58586216", "0.58586216", "0.5837707", "0.58347857", "0.58189565", "0.5786008", "0.57777596", "0.5738836", "0.57193196", "0.57174826", "0.5681061", "0.5663469", "0.5645419", "0.56323946", "0.5621716", "0.55810857", "0.5563385", "0.5556815", "0.5552249", "0.55501384", "0.5528373", "0.54734385", "0.5446337", "0.5440863", "0.5427319", "0.54178184", "0.539463", "0.53903383", "0.5378306", "0.5369576", "0.5365742", "0.536433", "0.5358384", "0.5340033", "0.53400326", "0.5338365", "0.5338365", "0.5338365", "0.5338365", "0.5338365", "0.5338365", "0.5338365", "0.5338365", "0.5338365", "0.5338365", "0.5338365", "0.5338365", "0.5338365", "0.5338365", "0.5335046", "0.53327036", "0.53289735", "0.53289735", "0.53289735", "0.53289735", "0.5323177", "0.53134954", "0.53084654", "0.5292698", "0.5287749", "0.528312", "0.52792764", "0.5278614", "0.527396", "0.5273468", "0.52729714", "0.5272153", "0.5270818", "0.5270752", "0.52702236", "0.5265869", "0.5262389", "0.52612555", "0.5242969", "0.52354795", "0.52354795", "0.5230922", "0.5229403", "0.5222271", "0.5207135", "0.5207135", "0.5207135", "0.5207135", "0.5207135", "0.5207135", "0.5206968", "0.520352", "0.5203208", "0.5187292", "0.5186996", "0.51815027", "0.51749617", "0.5174216", "0.5173913", "0.5172944", "0.51699775", "0.51655823", "0.5162117", "0.5162117" ]
0.67268234
0
DELETE /nvs_mig_statuses/1 DELETE /nvs_mig_statuses/1.json
def destroy @nvs_mig_status = NvsMigStatus.find(params[:id]) @nvs_mig_status.destroy respond_to do |format| format.html { redirect_to nvs_mig_statuses_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @reqstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqstatuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mstatus.destroy\n respond_to do |format|\n format.html { redirect_to mstatuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_status = RequestStatus.find(params[:id])\n @request_status.destroy\n\n respond_to do |format|\n format.html { redirect_to request_statuses_url }\n format.json { head :no_content }\n end\n end", "def delete()\n\n client.delete(\"/project_statuses/#{gid}\") && true\n end", "def destroy\n @kf_status = Kf::Status.find(params[:id])\n @kf_status.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/kf/statuses?page=#{params[:page]}&relation_id=#{params[:relation_id]}&status_type=#{params[:status_type]}&count_type=#{params[:count_type]}\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @new_status = NewStatus.find(params[:id])\n @new_status.destroy\n\n respond_to do |format|\n format.html { redirect_to new_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sa_request_status.destroy\n respond_to do |format|\n format.html { redirect_to sa_request_statuses_url, notice: 'Sa request status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to(statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @master_user_status.destroy\n respond_to do |format|\n format.html { redirect_to master_user_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_ativ = StatusAtiv.find(params[:id])\n @status_ativ.destroy\n\n respond_to do |format|\n format.html { redirect_to status_ativs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @current_statuses.destroy\n respond_to do |format|\n format.html { redirect_to current_statuses_url, notice: 'Current Statuses was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_request.destroy\n respond_to do |format|\n format.html { redirect_to status_requests_url, notice: 'Status request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_status(id)\n delete(\"/statuses/#{id}\")\n end", "def destroy\n @contaminationstatus.destroy\n respond_to do |format|\n format.html { redirect_to contaminationstatuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reqdevstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqdevstatuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @member_status.destroy\n respond_to do |format|\n format.html { redirect_to member_statuses_url, notice: 'Member status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @agent_status = AgentStatus.find(params[:id])\n @agent_status.destroy\n\n respond_to do |format|\n format.html { redirect_to agent_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy_status(status_id)\n delete \"statuses/destroy/#{status_id}\"\n end", "def destroy\n @status_akun.destroy\n respond_to do |format|\n format.html { redirect_to status_akun_index_url, notice: 'Status akun was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to(statuss_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @status = Status.find(params[:id])\n @status.destroy\n flash[:notice] = 'Status deleted'\n \n respond_to do |format|\n format.html { redirect_to(statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to statuseses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story_status = StoryStatus.find(params[:id])\n @story_status.destroy\n\n respond_to do |format|\n format.html { redirect_to story_statuses_url }\n format.json { head :ok }\n end\n end", "def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n redirect_to statuses_url\n end", "def destroy\n @entity_status.destroy\n respond_to do |format|\n format.html { redirect_to entity_statuses_url, notice: 'Entity status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rh21_status.destroy\n respond_to do |format|\n format.html { redirect_to rh21_statuses_url, notice: 'Rh21 status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacancy_request_status.destroy\n respond_to do |format|\n format.html { redirect_to vacancy_request_statuses_url, notice: 'Vacancy request status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sys_msgs_timeline.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @invstatus.destroy\n respond_to do |format|\n format.html { redirect_to invstatuses_url, notice: 'Invstatus was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @relationship_status.destroy\n respond_to do |format|\n format.html { redirect_to relationship_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @status_task = StatusTask.find(params[:id])\r\n @status_task.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to status_tasks_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @barrel_status.destroy\n respond_to do |format|\n format.html { redirect_to barrel_statuses_url, notice: 'Barrel status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @machine_status = MachineStatus.find(params[:id])\n @machine_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(machine_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mission_status.destroy\n respond_to do |format|\n format.html { redirect_to admin_mission_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @medium_status_mod = MediumStatusMod.find(params[:id])\n @medium_status_mod.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_status_mods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @usage_status = UsageStatus.find(params[:id])\n @usage_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(usage_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @health_status.destroy\n respond_to do |format|\n format.html { redirect_to health_statuses_url, notice: 'Health status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_activity.destroy\n respond_to do |format|\n format.html { redirect_to status_activities_url, notice: 'Status activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contract_status.destroy\n respond_to do |format|\n format.html { redirect_to contract_statuses_url, notice: 'Contract status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if can? :delete, @status\n @status.destroy\n respond_to do |format|\n\n format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @invite_status = InviteStatus.find(params[:id])\n @invite_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invite_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @posts_status.destroy\n respond_to do |format|\n format.html { redirect_to posts_statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @store_status.destroy\n respond_to do |format|\n format.html { redirect_to store_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @itemstatus = Itemstatus.find(params[:id])\n @itemstatus.destroy\n\n respond_to do |format|\n format.html { redirect_to itemstatuses_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project_status.destroy\n respond_to do |format|\n format.html { redirect_to project_statuses_url, notice: 'Project status was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_status = InvoiceStatus.find(params[:id])\n @invoice_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @typeofstatus.destroy\n respond_to do |format|\n format.html { redirect_to typeofstatuses_url, notice: 'Typeofstatus was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_status.destroy\n respond_to do |format|\n format.html { redirect_to service_statuses_url, notice: 'Service status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_status.destroy\n respond_to do |format|\n format.html { redirect_to app_statuses_url, notice: 'App status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_record = StatusRecord.find(params[:id])\n @status_record.destroy\n\n respond_to do |format|\n format.html { redirect_to status_records_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_status.destroy\n respond_to do |format|\n format.html { redirect_to project_statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_item.destroy\n respond_to do |format|\n format.html { redirect_to status_items_url, notice: 'El estatus del articulo fue eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @married_status.destroy\n respond_to do |format|\n format.html { redirect_to married_statuses_url, notice: 'Married status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n collection = Collection.find(@mlog_entry[:collection_id])\n @mlog_entry.destroy\n respond_to do |format|\n format.html { redirect_to collection}\n format.json { head :no_content }\n end\n end", "def destroy\n @inventory_status = InventoryStatus.find(params[:id])\n @inventory_status.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @searchstatus = Searchstatus.find(params[:id])\n @searchstatus.destroy\n\n respond_to do |format|\n format.html { redirect_to searchstatuses_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 destroy\n @active_status = ActiveStatus.find(params[:id])\n @active_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(active_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project_status.destroy\n\n respond_to do |format|\n format.html { redirect_to project_statuses_url, notice: \"Project status was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete; update(:status => 'DELETED'); end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @civil_status = CivilStatus.find(params[:id])\n @civil_status.destroy\n\n respond_to do |format|\n format.html { redirect_to civil_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status2.destroy\n respond_to do |format|\n format.html { redirect_to status2s_url, notice: 'Status2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_status = ProjectStatus.find(params[:id])\n @project_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @client_status.destroy\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @swit_status.destroy\n respond_to do |format|\n format.html { redirect_to swit_statuses_url, notice: 'Swit status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Clenum.destroy params[:ids].split(',')\n\n respond_to do |format|\n format.html { redirect_to(clenums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @assetstatus.destroy\n respond_to do |format|\n format.html { redirect_to assetstatuses_url, notice: '删除成功!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_animal = StatusAnimal.find(params[:id])\n @status_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to status_animais_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @manifestation_checkout_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to(manifestation_checkout_stats_url) }\n format.json { head :no_content }\n end\n end", "def destroy\n @zone_status = ZoneStatus.find(params[:id])\n @zone_status.destroy\n\n respond_to do |format|\n format.html { redirect_to zone_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stat_misc = StatMisc.find(params[:id])\n @stat_misc.destroy\n\n respond_to do |format|\n format.html { redirect_to stat_miscs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quest_stat.destroy\n respond_to do |format|\n format.html { redirect_to quest_stats_url, notice: 'Quest stat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n# @event_indicator_relationship = EventIndicatorRelationship.find(params[:id])\n# @event_indicator_relationship.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.event_custom_view'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_event_indicator_relationships_url }\n format.json { head :ok }\n end\n end", "def destroy\n @serv = Serv.find(params[:id])\n if @serv.mngbl\n #Remueve el MR a través de una llamada al webservice del núcleo\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'ip' => @serv.conn.ip, 'port' => @serv.conn.port}\n request = Net::HTTP::Delete.new(\"/mbs/#{@serv.domain}/#{@serv.name}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n end\n @serv.destroy\n\n respond_to do |format|\n format.html { redirect_to servs_url, notice: t('servs.delete.notice') }\n format.json { head :no_content }\n end\n end", "def destroy\n @deployment_status.destroy\n respond_to do |format|\n format.html { redirect_to deployment_statuses_url, notice: 'Deployment status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @node_incident = NodeIncident.find(params[:id])\n @node_incident.destroy\n\n respond_to do |format|\n format.html { redirect_to node_incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @invoicestatus.destroy\r\n respond_to do |format|\r\n format.html { redirect_to invoicestatuses_url, notice: 'Invoicestatus was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @event_user_status.destroy\n respond_to do |format|\n format.html { redirect_to event_user_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @m1.destroy\n respond_to do |format|\n format.html { redirect_to m1s_url, notice: 'M1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @asset_status.destroy\n respond_to do |format|\n format.html { redirect_to asset_statuses_url, notice: 'Asset status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_stat = TaskStat.find(params[:id])\n @task_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to task_stats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to profile_path(current_user) }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_team_stat.destroy\n respond_to do |format|\n format.html { redirect_to test_team_stats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @appointment_status.destroy\n respond_to do |format|\n format.html { redirect_to appointment_statuses_url, notice: 'Appointment status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lesson_status.destroy\n respond_to do |format|\n format.html { redirect_to lesson_statuses_url, notice: 'Lesson status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stat.destroy\n\n head :no_content\n end", "def destroy\n @payumoney_status.destroy\n respond_to do |format|\n format.html { redirect_to payumoney_statuses_url, notice: 'Payumoney status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase_item_status = PurchaseItemStatus.find(params[:id])\n @purchase_item_status.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_item_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_catalog.destroy\n respond_to do |format|\n format.html { redirect_to status_catalogs_url, notice: 'Status catalog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @customerstatus.destroy\r\n respond_to do |format|\r\n format.html { redirect_to customerstatuses_url, notice: 'Customerstatus was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @subcontractor_status.destroy\n respond_to do |format|\n format.html { redirect_to subcontractor_statuses_url, notice: 'Subcontractor status was successfully deleted.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.70992434", "0.7002245", "0.6963927", "0.69634676", "0.69461757", "0.6926119", "0.6820154", "0.68076384", "0.6738203", "0.6724101", "0.6711532", "0.6703818", "0.6702871", "0.66834754", "0.66821355", "0.66765624", "0.6651592", "0.6651592", "0.66339177", "0.66328657", "0.6631104", "0.6625814", "0.66089135", "0.6606961", "0.65548855", "0.655152", "0.65373695", "0.6525935", "0.6522844", "0.65221226", "0.6506736", "0.65018076", "0.64991057", "0.649835", "0.64920807", "0.6488412", "0.64840573", "0.64740545", "0.64655566", "0.6464076", "0.645198", "0.6445637", "0.64383227", "0.64312655", "0.6426666", "0.64236814", "0.64232624", "0.6416228", "0.64109284", "0.64108676", "0.64005136", "0.6400294", "0.63974285", "0.63963753", "0.63947856", "0.6393601", "0.6390047", "0.6380313", "0.6375882", "0.63740987", "0.636025", "0.6352167", "0.6351726", "0.6344434", "0.6340051", "0.6338742", "0.633466", "0.63277453", "0.6327421", "0.632516", "0.6318776", "0.631729", "0.63118166", "0.631067", "0.6305976", "0.6302345", "0.6299166", "0.6298673", "0.6291606", "0.6290032", "0.6286097", "0.62789017", "0.62764955", "0.62731713", "0.62704766", "0.627005", "0.62690216", "0.626364", "0.62620467", "0.62594", "0.62586606", "0.6243738", "0.6241963", "0.62415636", "0.6237525", "0.6237193", "0.62361556", "0.6229793", "0.6228601", "0.62232655" ]
0.7784638
0
this method returns the sorted hash of webpages with no of visits based on no of visits in descending order
def calculate_most_viewed_pages pages_with_frequency = calculate_page_frequency pages_with_frequency.sort_by { |_key, value| value }.reverse.to_h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_unique_page_views\n ip_frequency_per_page = calculate_ip_frequency_per_page\n ip_frequency_per_page.transform_values { |value| value.uniq.length }.sort_by { |_key, value| value }.reverse.to_h\n end", "def unique_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.uniq.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def total_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def urlhist(path)\n\t\tu = Hash.new(0)\n\t\tcnt = 0\n\t\tf=File.open(path)\n\t\tf.readlines.each do |line|\n\t\t\tpart = line.split(' ')\n\t\t\turl = part[6]\n\t\t\tu[url] = u[url] + 1\n\t\t\tcnt +=1\t\n\t\tend\n\t\tu.sort.each do |k, v|\n\t\t\tprint \"The frequency of #{k} | \"\n\t\t\twhile v > 0\n\t\t\t\tprint \"#\"\n\t\t\t\tv-=1\n\t\t\tend\n\t\tputs \"\\n\"\n\t\tend\n\t\t\n\tend", "def sort_and_print(hash, type=\"visits\")\n new_hash = hash.sort_by { |page, visits| -visits}.to_h\n # Print into console to check\n new_hash.each do |page, number_of_visits|\n print page + \" \" + number_of_visits.to_s + \" \" + type + \" \"\n end\n # Return sorted hash\n return new_hash\nend", "def find_page_visits(visits)\n visits_hash = Hash.new(0)\n visits.each do |visit|\n visits_hash[visit.page] += 1\n end\n # Returned the hash in case it would be required to be stored rather than just printed\n return visits_hash\nend", "def find_unique_page_visits(visits)\n unique_visits_hash = Hash.new(0)\n unique_addresses_hash = Array.new\n visits.each do |visit|\n # Each time a unique visit is detected, it adds the address and page to an array, so that it can be checked against for future checks\n if !unique_addresses_hash.include? [visit.page, visit.address]\n unique_addresses_hash.push [visit.page, visit.address]\n unique_visits_hash[visit.page] +=1\n end\n end\n # Returned the hash in case it would be required to be stored rather than just printed\n return unique_visits_hash\nend", "def sorted_pages_unique_views\n sorted_array_unique_views.map { |x| x.join(' ') }.join(' unique visits ')\n end", "def webpage_views\n count_unique_views\n count_total_views\n\n @unique_views_hash.each do |webpage, unique|\n @webpage_views_hash.store(webpage, 'Unique views' => unique)\n end\n\n @total_views_hash.each do |webpage, total|\n @webpage_views_hash[webpage].store('Total views', total)\n end\n @webpage_views_hash\n end", "def sorted_pages\n sorted_array.map { |x| x.join(' ') }.join(' visits ')\n end", "def popular_links\n result = {}\n urls[0...5].each do |url|\n result[url] = url.num_clicks\n end\n result\n end", "def uniq_views\n p 'Sites with most unique views: '\n @content.sort_by { |address| address[1].uniq.count }.reverse.each do |values|\n @output << \"#{values.first} #{values.last.uniq.count} unique views\"\n end\n end", "def calculate_page_frequency\n page_frequency_hash = {}\n pages_array = []\n @data.split(\"\\n\").each do |line|\n pages_array << line.match(Regex::PAGE_URL)[0] if line =~ Regex::PAGE_URL\n end\n pages_array.each do |page|\n page_frequency_hash[page].nil? ? page_frequency_hash[page] = 1 : page_frequency_hash[page] += 1\n end\n page_frequency_hash\n end", "def k_most_visited input, k\n \n hotels_to_visits = Hash.new\n \n input.each do |user|\n user.each do |hotel_id|\n hotels_to_visits[hotel_id] = (hotels_to_visits[hotel_id] || 0) + 1\n end\n end\n \n sorted_hotels_and_visits = hotels_to_visits.to_a.sort { |a,b| a[1] < b[1] }\n \n return sorted_hotels_and_visits[0..k]\n \nend", "def hash_to_hist(hhash)\n hhash.map{ |k,v| [k, v.size] }.to_h.sort_by{|k,v| v}.reverse.to_h\n end", "def hash_hash(h)\n require 'digest/md5'\n\n ordered = h.sort.map { |i| i.class==Hash ? i.sort : i }\n return ordered.to_s\n Digest::MD5.hexdigest(Marshal::dump(ordered))\n end", "def freq_list\n freq_hash = each_with_object(Hash.new(0)) { |v, h| h[v] += 1 }\n freq_hash.sort_by { |k, v| -v }\n end", "def pages_cache_key\n [\n Page.count,\n Page.order(\"updated_at DESC\").first\n ]\n end", "def count(word_list)\n counts =Hash.new(0)\n for word in word_list\n counts[word] +=1\n end\n #counts\n sorted = counts.sort_by{|w, count| count}.reverse\n return sorted\nend", "def sort_by_occurrence_h(input)\n output = input.each_with_object(Hash.new(0)){ |tag, counts| counts[tag] += 1 }\n output = Hash[output.sort_by{ |tags, counts| counts}.reverse]\n return output\n end", "def calculate_ip_frequency_per_page\n ip_frequency_per_page_hash = {}\n @data.split(\"\\n\").each do |line|\n page_url = line.match(Regex::PAGE_URL)[0] if line =~ Regex::PAGE_URL\n ip_frequency_per_page_hash[page_url] = [] unless ip_frequency_per_page_hash[page_url]\n ip_frequency_per_page_hash[page_url] << line.match(Regex::IP_ADDRESS)[0] if line =~ Regex::IP_ADDRESS\n end\n ip_frequency_per_page_hash\n end", "def sort_counts()\n @count_array = @counts.to_a\n @count_array.sort_by! { |pair| pair[1] }\n @count_array.reverse!\n @count_array\n end", "def most_views\n @content.sort_by { |address| address[1].length }.reverse.each do |values|\n @output << \"#{values.first} #{values.last.count} visits\"\n end\n end", "def subdomain_visits(cpdomains)\n result = []\n result_hsh = Hash.new(0)\n\n cpdomains.each do |cpdomain|\n total = cpdomain.split(' ')\n visits = total[0].to_i\n domain = total[1]\n\n sub_domains = domain.split('.')\n\n i = 0\n while i < sub_domains.length\n sub_domain = sub_domains.drop(sub_domains.length - 1 - i).join('.')\n result_hsh[sub_domain] += visits\n i += 1\n end\n end\n\n result_hsh.each do |k, v|\n result << v.to_s + ' ' + k\n end\n\n result\nend", "def all_sorted\n @data[:pages].sort_by{|k, v| -v}\n end", "def sort_by_sites!\n @list = Hash[@list.sort_by {|partition_name, partition| partition.sites.size}]\n self\n end", "def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end", "def initialize(url) #pass in the url...cnn\n @url = url #saving the url in n instance variable \n #this is how you create a default value for a hash\n @histogram = Hash.new(0) #taking histogram and creating a hash but setting default values at 0. we're going to be couting words so default should be zero\n\n parse #parse is a method (def below)\n\n #this is how you sort a hash!!!!\n words.each{|w| @histogram[w.downcase] +=1 } #creating the histogram \"for each word..grab each word one at a time- take the histogram and make all the words lowercase. +=1 means add words/couting for all the words that are the same. so we'll have all the words and all the counts\"\n @histogram = @histogram.sort_by {|key, value| value}.reverse #take the histogram and sort it by value. does this in ascending order. .reverse puts it in descending order\n end", "def collect_common_urls_hash(url,domain_url,urls_hash,options,depth=0)\n #$log.info \"1. Pages crawled: #{@already_visited.size}\"\n #$log.info \"2. Depth: #{depth}\"\n #$log.info \"3. Crawling URL: #{url}\"\n if options[:crawl]\n return if depth == 2 \n else\n return if depth == 1\n end\n return if @already_visited.size == 10\n if @already_visited[url] == nil\n @already_visited[url] = true\n else\n return\n end\n page_urls = find_urls_on_page(url,domain_url,urls_hash)\n return if page_urls == nil\n if options[:crawled_urls]\n @p_obj.puts \"URL: #{url} DEPTH: #{depth}\"\n $log.info \"URLS CRAWLED: #{@already_visited.size}, CRAWLED URL: #{url}\"\n end\n page_urls.each do |page_url|\n break if @already_visited.size == 10\n collect_common_urls_hash(page_url,domain_url,urls_hash,options,depth+1) if page_url.match(/http(s)?:\\/\\/[^\\/]+/).to_s == domain_url and not page_url.include?\"Redirect\"\n end\n end", "def most_used_hashtags\n # my_tags = self.hashtags.each do |hashtag|\n # hashtag.posts.select do |post|\n # post.user_id == self \n # end\n # end \n my_tags = []\n self.posts.each do |post|\n my_tags << post.hashtags\n end\n flattened = my_tags.flatten\n tallied = Hash[flattened.group_by{|x|x}.map{|x,y|[x,y.size]}]\n # sorted.each do |hashtag|\n # # need to associate hashtag w it's count\n \n # # gives number of times hashtag appears in sorted list\n # sorted.find_all[hashtag].count \n # end\n tallies_sorted = tallied.sort_by{|x,y| y}.reverse\n my_most = tallies_sorted[0..4]\n most_used = my_most.map do |array|\n array[0]\n end\n most_used\n end", "def max_pages() Pages.keys.size end", "def hash (site)\n\t#hash_in_hash = Array.new\n\t#hash_in_hash = {\"URL\" => \"MD5_Digest\"}\n\topen (site) do |s|\n\t\tresponse = s.read\n\t\tdigest = Digest::MD5.hexdigest(response)\n\t\t#string1 = site + \" - \" + digest + \"\\n\"\n\t\t#file2 = File.open(\"/Users/ismeet/code/ruby/js_scan/hashes\", \"a\")\n\t\t#file2.write(string1)\n\t\treturn site, digest #Return site and digest. The hash has to be created in the outside function where we area calling the hash function.\n\tend\nend", "def sorted_users\n _users_hash = Hash.new( 0)\n category_users.each{|_u| _users_hash[ _u] +=1 }\n _users_hash.sort {|u1,u2| u2[1] <=> u1[1]}.collect{|k,v| k}\n end", "def dfsLink(url, count)\n begin\n if count == @level\n return \n end\n doc = Nokogiri::HTML(open(url))\n links = getLinks(doc)\n \n puts \"Current scan url is :#{url} value is #{@hash[url]}\"\n @hash[url] = 1\n if links.size == 0 \n return\n else\n links.each do |link|\n href = link['href']\n if @hash.has_key?(href)\n @hash[href] = 1\n else\n @hash[href] = 2 \n dfsLink(href, count+1)\n end\n end\n end\n rescue => exp\n @hash[url] = 0\n return \n end\n end", "def hash(object_tag)\n priority = site_tags.map do |site_tag|\n h = Digest::SHA1.hexdigest(\"#{site_tag} - #{object_tag}\")\n [h, site_tag]\n end.sort\n\n if priority.length > 0\n priority[0][1]\n end\n end", "def print_by_count(organized_data)\n\n organized_dates_only = organized_data.keys.sort\n\n puts \"***RESULTS START***\"\n puts \"\"\n\n organized_dates_only.each do |date| \n puts date\n site_to_hits = organized_data[date].sort_by {|site, hits| -hits}\n\n site_to_hits.each do |hit| \n site_name = hit[0]\n total_hits = hit[1]\n puts \"#{site_name} #{total_hits}\"\n end\n\n puts \"\"\n\n end\n\n puts \"***RESULTS END***\" \n puts \"\"\n \nend", "def count_freq\n hash = Hash.new(0)\n self.each do |element|\n hash[element] +=1\n end\n return hash\n end", "def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end", "def urls\n payloads.group(\"url\")\n .count\n .sort_by { |k,v| -v }\n end", "def users_by_amount_visited\n user_visits = self.visited_museums.count\n other_user_visits = User.where.not(id: self.id).map { |user| user.visited_museums.count }\n other_user_visits.unshift(user_visits)\n end", "def sortByCountDecreasing\r\n @counts.sort_by { |k,v| v }.reverse\r\n end", "def hash\n [concatenated_path_down_count, administratively_down_count, no_diagnostic_count, path_down_count, reverse_concatenated_path_down_count, neighbor_signaled_session_down_count, control_detection_time_expired_count, echo_function_failed_count, forwarding_plane_reset_count].hash\n end", "def sort(p)\n hashed = {}\n words = p.downcase.split(/\\/W/)\n words.each do |word|\n if hashed[word]\n hashed[word] += 1\n elsif word != ''\n hashed[word] = 1\n end\n end\n puts hashed.sort_by {|_key, value| value}.to_h\nend", "def pages\n store.values.sort_by { |page| page.title }\n end", "def hashes(to = $stdout)\n hashes = {}\n \n ObjectSpace.each_object(Hash) do |hash|\n begin\n keys_orig = hash.keys.sort\n rescue ArgumentError\n #When unable to sort regexps...\n next\n end\n \n keys = []\n keys_orig.each do |key|\n keys << key.to_s\n end\n \n if keys.empty?\n keystr = :empty\n else\n keystr = keys.join(\":\")\n end\n \n if !hashes.key?(keystr)\n hashes[keystr] = 1\n else\n hashes[keystr] += 1\n end\n end\n \n hashes.delete_if do |key, val|\n val < 100\n end\n \n hashes = Knj::ArrayExt.hash_sort(hashes) do |h1, h2|\n h2[1] <=> h1[1]\n end\n \n to.print \"<h1>Hashes</h1>\\n\"\n to.write \"<table class=\\\"hashes list\\\">\\n\"\n to.write \"\\t<thead>\\n\"\n to.write \"\\t\\t<tr>\\n\"\n to.write \"\\t\\t\\t<th>Hash keys</th>\\n\"\n to.write \"\\t\\t\\t<th>Instances</th>\\n\"\n to.write \"\\t\\t</tr>\\n\"\n to.write \"\\t</thead>\\n\"\n to.write\"\\t<tbody>\\n\"\n \n hashes.each do |key, val|\n to.write \"\\t\\t<tr>\\n\"\n to.write \"\\t\\t\\t<td>#{Knj::Web.html(key)}</td>\\n\"\n to.write \"\\t\\t\\t<td>#{Knj::Locales.number_out(val, 0)}</td>\\n\"\n to.write \"\\t\\t</tr>\\n\"\n end\n \n to.write \"\\t</tbody>\\n\"\n to.write \"</table>\\n\"\n end", "def buckets()\n @sortedBuckets = @data.keys.sort {|x,y| y <=> x}\n Utils.printMux(@log, \"buckets> sortedBuckets:\" + @sortedBuckets.pretty_inspect(), @DEBUG, @LOG_DEBUG, Utils::DEBUG_LOW, Utils::LOG_LOW)\n end", "def num_uniques\n visitors.count\n end", "def num_uniques\n visitors.count\n end", "def num_uniques\n visitors.count\n end", "def hash\n [_403, _404, _500, _504, start_timestamp, end_timestamp, start_datetime, end_datetime, total_requests, cache_hits, cache_hit_rate, total_request_time, avg_origin_response_time, response_time_ms, _100_x, _20_x, _30_x, _40_x, _50_x, _50th, _95th, _99th].hash\n end", "def display_webpage_views\n webpage_views\n puts 'Overall webpage views'\n puts \"\\n\"\n @webpage_views_hash.each do |webpage, view_hash|\n puts webpage\n puts \"#{view_hash.values[0]} unique views\"\n puts \"#{view_hash.values[1]} total views\"\n puts \"\\n\"\n end\n end", "def count_subdomain_visits(subdomains)\n vist_counts = Hash.new(0)\n subdomains.each do |sd|\n count = sd.split(' ').first.to_i\n sds = break_subdomains(sd.split(' ').last)\n sds.each do |d|\n vist_counts[d] += count\n end\n end\n vist_counts\nend", "def puppetsort(hash)\n # TODO(sissel): Implement sorting that follows the puppet style guide\n # Such as, 'ensure' goes first, etc.\n return hash.to_a\n end", "def sort_links(linksHash, textToSearch)\n\ttitle_regex = /title=\"(.*?)\"/\n\tlinksHash.each { |k,v|\n\t\ttitle = title_regex.match(k.to_s)\n\t\ttitle = $1\n\t\t\n\t\ttextToSearch.each_line { |line|\n\t\t\tif line.include?(title)\n\t\t\t\tlinksHash[k] += 1\n\t\t\tend\n\t\t}\n\t}\n\treturn Hash[linksHash.sort_by { |k,v| v }.reverse].keys\nend", "def index \n @urls = Url.all.order(hit_count: :desc)\n end", "def pages\n self.groups.map(&:most_recent_page).reject(&:nil?).sort_by {|d| -d.created_at.to_i}\n end", "def hash\n @node.sort.push(@edge).hash\n end", "def sorted_array_unique_views\n total_unique_views_per_file_path.sort { |a, b| b[1] <=> a[1] }\n end", "def analyze_data(ary)\n frequency = count_frequency(ary)\n sort_hash(frequency)\nend", "def sorted_paths\n @log_data.paths.sort_by { |_path, info| info.visits }.reverse\n end", "def generate_hash\n @groups.flatten.inject([]) {|hash, stone| hash << stone.to_s}.sort.hash\n end", "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 unique_entries\n entries = Hash[*@entries.map { |entry| [entry.ip_address, entry] }.flatten].values\n entries.sort_by { |e| [-e.priority.to_i, e.hostname.to_s] }\n end", "def sort_by_tag_count\n end", "def get_ographhash(ographobj)\n ographhash = Hash[\n 'display' => ographobj.at_xpath(\"displayprio\").text,\n 'name' => ographobj.at_xpath(\"name\").text,\n 'yaxis' => ographobj.at_xpath(\"verticallabel\").text,\n 'datapoints' => ographobj.xpath('datapoints/overviewgraphdatapoint'),\n ]\n\n return Hash[ographhash.sort]\n end", "def hash\n [apm_scanned_bytes, events_scanned_bytes, hour, logs_scanned_bytes, org_name, public_id, rum_scanned_bytes, total_scanned_bytes].hash\n end", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def index\n @visited_urls = VisitedUrl.order(:created_at).page params[:page]\n end", "def hashrate\n 7158278.826666666 * shares.fresh.count\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def sort_by_tag_count_with_random_buckets\n end", "def sort_scores_hash(unsorted_scores, highest_possible_score)\n score_counts = {}\n unsorted_scores.each do |score|\n score_counts[score] = 0 unless score_counts[score]\n score_counts[score] += 1\n end\n\n sorted_scores = []\n i = HIGHEST_POSSIBLE_SCORE\n while i >= 0\n unless score_counts[i]\n i = i - 1\n next\n end\n\n score_counts[i].times { sorted_scores << i }\n i = i - 1\n end\n\n sorted_scores\nend", "def find_relative_ranks(nums)\n hash = {}\n nums.each_with_index do |num, index|\n hash[num] = index\n end\n hash = hash.sort.to_h\n print hash\n count = 0\n hash.each do |k, v|\n if count == nums.size - 3\n nums[v] = \"Bronze Medal\"\n elsif count == nums.size - 2\n nums[v] = \"Silver Medal\"\n elsif count == nums.size - 1\n nums[v] = \"Gold Medal\"\n else\n nums[v] = (nums.size - count).to_s\n end\n count += 1\n end\n nums\nend", "def find_urls_on_page(current_url,domain_url,urls_hash)\n dom = get_dom_for_page(current_url)\n if not dom \n $log.info \"Unable to create dom\" \n return \n end\n urls_list = {}\n\t dom.xpath('//a/@href').each do |node|\n\t url = node.content\n next if not url \n create_bag_of_words_for_parent_class(node)\n create_bag_of_words_for_parent_name(node)\n if node.parent.parent.attributes['class']\n parent_parent_class = node.parent.parent.attributes['class'].to_s\n else\n parent_parent_class = \"UNKNOWN\"\n end\n parent_parent_name = node.parent.parent.name\n node_path = node.path\n url = url.chomp.strip\n url = url.gsub(\"..\",\"\") \n url = url.gsub(\"./\",\"/\")\n if relative?(url)\n url = make_absolute(domain_url,url)\n end\n if not url.match(/\\%/)\n\t url = URI.encode(url)\n\t end\n next if not url.match(/http(s)?:\\/\\/[^\\/]+/).to_s == domain_url\n urls_list[url] = true if not urls_list[url]\n url_length = get_url_length(url)\n if not urls_hash[url]\n urls_hash[url] = [1,parent_parent_class,parent_parent_name,url_length,node_path]\n else\n urls_hash[url][0] += 1\n end\n\t end\n\t return urls_list.keys\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 visits_count\n self.visits_count_cache || self.visits_count_cache = self.calculate_visits_count\n end", "def get_team_live_bts\n\n team_hash=Hash.new\n \n LabBts.where(\"bts_pass > ?\" ,0).each do |bts|\n\n \tteam_hash[bts.team] ||=[]\n \tteam_hash[bts.team] << bts.ip\n end\n\n puts team_hash.size\n\n team_hash.each do |team, site_list|\n puts \"#{team}=#{site_list.size}\"\n end\n\nreturn team_hash\nend", "def word_sizes(words)\n word_count = Hash.new(0) #this initializes default values as 0\n\n words.split.each do |word|\n word_count[word.length] += 1\n end\n\n word_count.sort.to_h\nend", "def calculate_clicks_by_domain(counts)\n all_domains_counter = {}\n\n counts.each do |csv_string|\n click_count = csv_string.split(\",\").first.to_i\n initial_domain_string = csv_string.split(\",\").last\n all_subdomains = break_domain_string_by_elements(initial_domain_string)\n all_subdomains.each do |domain|\n all_domains_counter[domain] ? all_domains_counter[domain] += click_count : all_domains_counter[domain] = click_count\n end\n end\n\n all_domains_counter.map { |domain, click| [click, domain] }.sort_by { |group| group[0] }.reverse\nend", "def pages_to_list\n # sort by fullpath first\n list = self.pages.values.sort { |a, b| a.fullpath <=> b.fullpath }\n # sort finally by depth\n list.sort { |a, b| a.depth <=> b.depth }\n end", "def pages_to_list\n # sort by fullpath first\n list = self.pages.values.sort { |a, b| a.fullpath <=> b.fullpath }\n # sort finally by depth\n list.sort { |a, b| a.depth <=> b.depth }\n end", "def to_json_sort\r\n JSON.generate({:session_id => @session_id, :max_age => @max_age, :secure_hash_key => @secure_hash_key})\r\n end", "def rev_count; @rev_map.count; end", "def hash\n [rel, href].hash\n end", "def who_often_takes\n\t \thash = Hash.new(0)\n\t\tres = @orders.each { |order| hash[order.name] += 1 } \n\t\thash.max{|a, b| a.length <=> b.length}\n\t end", "def top\n Url.order(visit_count: :desc).limit(100)\n end", "def get_redundant_urls_hash(urls_hash)\n urls_keys = urls_hash.select {|url,value| value[0] < 8}.keys\n urls_keys.each do |key|\n urls_hash.delete(key)\n end\n end", "def sort_hash(hash)\n puts hash.keys.map(&:to_s).sort_by(&:length)\n end", "def counting_sort(array, array_length, highest_value)\n equal = count_keys_equal(array, array_length, highest_value)\n less = count_keys_less(equal, highest_value)\n sorted = rearrange(array, less, array_length, highest_value)\n return sorted\nend", "def collate!\n @buckets = @buckets.sort { |a,b| b.time <=> a.time }\n @ordered = {}\n @buckets.map { |o| o.identity }.uniq.each do |identity|\n @ordered[identity] = @buckets.select { |o| o.identity == identity }\n end\n return @buckets\n end", "def fill_hash(url)\n @url = url\n countries = Array.new\n populations = Array.new\n country_hash = {}\n\n doc = Nokogiri::HTML(open(@url))\n doc.css('table.wikitable tr:nth-child(2)~tr').each do |item|\n countries << item.at_css('td:nth-child(2) a:nth-child(2)')['title']\n populations << item.at_css('td:nth-child(3)').text\n end\n\n @countries = countries\n @populations = populations\n\n ([email protected] - 1).each do |index|\n country_hash[@countries[index]] = @populations[index]\n end\n return country_hash\nend", "def hash\n 0\n end", "def num_recent_uniques\n valid_visit = []\n self.visits.each do |visit|\n valid_visit << visit if visit.updated_at > 10.minutes.ago\n end\n valid_visit.count\n end", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end" ]
[ "0.7275074", "0.69860864", "0.6939138", "0.6897497", "0.66608834", "0.65018773", "0.6475812", "0.64252084", "0.64078504", "0.6171827", "0.6138484", "0.60916656", "0.60874623", "0.5985514", "0.5985357", "0.592972", "0.5925328", "0.58569795", "0.5801313", "0.5788764", "0.5787001", "0.57636774", "0.5743065", "0.5704363", "0.57040185", "0.5670254", "0.56637806", "0.56591976", "0.56462127", "0.5627723", "0.5620099", "0.56035405", "0.5596977", "0.5596863", "0.5575616", "0.55598444", "0.55505997", "0.5546797", "0.5530051", "0.5523506", "0.55096895", "0.54977405", "0.54824144", "0.54797006", "0.5477025", "0.5455259", "0.5428447", "0.5428447", "0.5428447", "0.54134333", "0.53862303", "0.5380509", "0.5375338", "0.53699195", "0.53564274", "0.5343914", "0.5335833", "0.53308034", "0.53267837", "0.53249574", "0.53132117", "0.5311675", "0.5311087", "0.53075695", "0.5305519", "0.5301355", "0.5296191", "0.5293862", "0.52896124", "0.52836406", "0.52836406", "0.52836406", "0.52836406", "0.52836406", "0.52836406", "0.52836406", "0.52783746", "0.52750194", "0.5263423", "0.5260417", "0.52427334", "0.5237093", "0.5228694", "0.5222368", "0.52214426", "0.5219804", "0.5219804", "0.5219547", "0.5213343", "0.5212663", "0.52067286", "0.5201109", "0.52008355", "0.5199602", "0.5198157", "0.5194421", "0.5190783", "0.51871353", "0.5184699", "0.51788056" ]
0.6993947
1
this method returns the sorted hash of webpages with no of unique visits based on no of unique visits in descending order
def calculate_unique_page_views ip_frequency_per_page = calculate_ip_frequency_per_page ip_frequency_per_page.transform_values { |value| value.uniq.length }.sort_by { |_key, value| value }.reverse.to_h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.uniq.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def find_unique_page_visits(visits)\n unique_visits_hash = Hash.new(0)\n unique_addresses_hash = Array.new\n visits.each do |visit|\n # Each time a unique visit is detected, it adds the address and page to an array, so that it can be checked against for future checks\n if !unique_addresses_hash.include? [visit.page, visit.address]\n unique_addresses_hash.push [visit.page, visit.address]\n unique_visits_hash[visit.page] +=1\n end\n end\n # Returned the hash in case it would be required to be stored rather than just printed\n return unique_visits_hash\nend", "def sorted_pages_unique_views\n sorted_array_unique_views.map { |x| x.join(' ') }.join(' unique visits ')\n end", "def total_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def urlhist(path)\n\t\tu = Hash.new(0)\n\t\tcnt = 0\n\t\tf=File.open(path)\n\t\tf.readlines.each do |line|\n\t\t\tpart = line.split(' ')\n\t\t\turl = part[6]\n\t\t\tu[url] = u[url] + 1\n\t\t\tcnt +=1\t\n\t\tend\n\t\tu.sort.each do |k, v|\n\t\t\tprint \"The frequency of #{k} | \"\n\t\t\twhile v > 0\n\t\t\t\tprint \"#\"\n\t\t\t\tv-=1\n\t\t\tend\n\t\tputs \"\\n\"\n\t\tend\n\t\t\n\tend", "def calculate_most_viewed_pages\n pages_with_frequency = calculate_page_frequency\n pages_with_frequency.sort_by { |_key, value| value }.reverse.to_h\n end", "def webpage_views\n count_unique_views\n count_total_views\n\n @unique_views_hash.each do |webpage, unique|\n @webpage_views_hash.store(webpage, 'Unique views' => unique)\n end\n\n @total_views_hash.each do |webpage, total|\n @webpage_views_hash[webpage].store('Total views', total)\n end\n @webpage_views_hash\n end", "def find_page_visits(visits)\n visits_hash = Hash.new(0)\n visits.each do |visit|\n visits_hash[visit.page] += 1\n end\n # Returned the hash in case it would be required to be stored rather than just printed\n return visits_hash\nend", "def sort_and_print(hash, type=\"visits\")\n new_hash = hash.sort_by { |page, visits| -visits}.to_h\n # Print into console to check\n new_hash.each do |page, number_of_visits|\n print page + \" \" + number_of_visits.to_s + \" \" + type + \" \"\n end\n # Return sorted hash\n return new_hash\nend", "def uniq_views\n p 'Sites with most unique views: '\n @content.sort_by { |address| address[1].uniq.count }.reverse.each do |values|\n @output << \"#{values.first} #{values.last.uniq.count} unique views\"\n end\n end", "def sorted_pages\n sorted_array.map { |x| x.join(' ') }.join(' visits ')\n end", "def popular_links\n result = {}\n urls[0...5].each do |url|\n result[url] = url.num_clicks\n end\n result\n end", "def hash_hash(h)\n require 'digest/md5'\n\n ordered = h.sort.map { |i| i.class==Hash ? i.sort : i }\n return ordered.to_s\n Digest::MD5.hexdigest(Marshal::dump(ordered))\n end", "def k_most_visited input, k\n \n hotels_to_visits = Hash.new\n \n input.each do |user|\n user.each do |hotel_id|\n hotels_to_visits[hotel_id] = (hotels_to_visits[hotel_id] || 0) + 1\n end\n end\n \n sorted_hotels_and_visits = hotels_to_visits.to_a.sort { |a,b| a[1] < b[1] }\n \n return sorted_hotels_and_visits[0..k]\n \nend", "def calculate_page_frequency\n page_frequency_hash = {}\n pages_array = []\n @data.split(\"\\n\").each do |line|\n pages_array << line.match(Regex::PAGE_URL)[0] if line =~ Regex::PAGE_URL\n end\n pages_array.each do |page|\n page_frequency_hash[page].nil? ? page_frequency_hash[page] = 1 : page_frequency_hash[page] += 1\n end\n page_frequency_hash\n end", "def num_uniques\n visitors.count\n end", "def num_uniques\n visitors.count\n end", "def num_uniques\n visitors.count\n end", "def sort_by_occurrence_h(input)\n output = input.each_with_object(Hash.new(0)){ |tag, counts| counts[tag] += 1 }\n output = Hash[output.sort_by{ |tags, counts| counts}.reverse]\n return output\n end", "def freq_list\n freq_hash = each_with_object(Hash.new(0)) { |v, h| h[v] += 1 }\n freq_hash.sort_by { |k, v| -v }\n end", "def hash_to_hist(hhash)\n hhash.map{ |k,v| [k, v.size] }.to_h.sort_by{|k,v| v}.reverse.to_h\n end", "def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end", "def collect_common_urls_hash(url,domain_url,urls_hash,options,depth=0)\n #$log.info \"1. Pages crawled: #{@already_visited.size}\"\n #$log.info \"2. Depth: #{depth}\"\n #$log.info \"3. Crawling URL: #{url}\"\n if options[:crawl]\n return if depth == 2 \n else\n return if depth == 1\n end\n return if @already_visited.size == 10\n if @already_visited[url] == nil\n @already_visited[url] = true\n else\n return\n end\n page_urls = find_urls_on_page(url,domain_url,urls_hash)\n return if page_urls == nil\n if options[:crawled_urls]\n @p_obj.puts \"URL: #{url} DEPTH: #{depth}\"\n $log.info \"URLS CRAWLED: #{@already_visited.size}, CRAWLED URL: #{url}\"\n end\n page_urls.each do |page_url|\n break if @already_visited.size == 10\n collect_common_urls_hash(page_url,domain_url,urls_hash,options,depth+1) if page_url.match(/http(s)?:\\/\\/[^\\/]+/).to_s == domain_url and not page_url.include?\"Redirect\"\n end\n end", "def sorted_users\n _users_hash = Hash.new( 0)\n category_users.each{|_u| _users_hash[ _u] +=1 }\n _users_hash.sort {|u1,u2| u2[1] <=> u1[1]}.collect{|k,v| k}\n end", "def count(word_list)\n counts =Hash.new(0)\n for word in word_list\n counts[word] +=1\n end\n #counts\n sorted = counts.sort_by{|w, count| count}.reverse\n return sorted\nend", "def calculate_ip_frequency_per_page\n ip_frequency_per_page_hash = {}\n @data.split(\"\\n\").each do |line|\n page_url = line.match(Regex::PAGE_URL)[0] if line =~ Regex::PAGE_URL\n ip_frequency_per_page_hash[page_url] = [] unless ip_frequency_per_page_hash[page_url]\n ip_frequency_per_page_hash[page_url] << line.match(Regex::IP_ADDRESS)[0] if line =~ Regex::IP_ADDRESS\n end\n ip_frequency_per_page_hash\n end", "def hash(object_tag)\n priority = site_tags.map do |site_tag|\n h = Digest::SHA1.hexdigest(\"#{site_tag} - #{object_tag}\")\n [h, site_tag]\n end.sort\n\n if priority.length > 0\n priority[0][1]\n end\n end", "def unique\n return @logs_unique unless @logs_unique.nil?\n\n # Store unique IPs\n @logs_unique = {}\n @logs.each do |log|\n if @logs_unique.has_key? log.url\n @logs_unique[log.url].add(log.ip)\n else\n @logs_unique[log.url] = Set.new([log.ip])\n end\n end\n\n # Count unique IPs\n @logs_unique.each {|url, ip_set| @logs_unique[url] = ip_set.size}\n\n # Inject order method if someone wants to get ordered results\n # TODO ideally it should have the same return type as `unique`\n def @logs_unique.order(direction)\n direction = direction[:views] || :desc\n arr = sort_by {|url, views| views}\n\n direction == :asc ? arr : arr.reverse\n end\n\n @logs_unique\n end", "def subdomain_visits(cpdomains)\n result = []\n result_hsh = Hash.new(0)\n\n cpdomains.each do |cpdomain|\n total = cpdomain.split(' ')\n visits = total[0].to_i\n domain = total[1]\n\n sub_domains = domain.split('.')\n\n i = 0\n while i < sub_domains.length\n sub_domain = sub_domains.drop(sub_domains.length - 1 - i).join('.')\n result_hsh[sub_domain] += visits\n i += 1\n end\n end\n\n result_hsh.each do |k, v|\n result << v.to_s + ' ' + k\n end\n\n result\nend", "def sorted_array_unique_views\n total_unique_views_per_file_path.sort { |a, b| b[1] <=> a[1] }\n end", "def unique_entries\n entries = Hash[*@entries.map { |entry| [entry.ip_address, entry] }.flatten].values\n entries.sort_by { |e| [-e.priority.to_i, e.hostname.to_s] }\n end", "def pages_cache_key\n [\n Page.count,\n Page.order(\"updated_at DESC\").first\n ]\n end", "def count_freq\n hash = Hash.new(0)\n self.each do |element|\n hash[element] +=1\n end\n return hash\n end", "def most_used_hashtags\n # my_tags = self.hashtags.each do |hashtag|\n # hashtag.posts.select do |post|\n # post.user_id == self \n # end\n # end \n my_tags = []\n self.posts.each do |post|\n my_tags << post.hashtags\n end\n flattened = my_tags.flatten\n tallied = Hash[flattened.group_by{|x|x}.map{|x,y|[x,y.size]}]\n # sorted.each do |hashtag|\n # # need to associate hashtag w it's count\n \n # # gives number of times hashtag appears in sorted list\n # sorted.find_all[hashtag].count \n # end\n tallies_sorted = tallied.sort_by{|x,y| y}.reverse\n my_most = tallies_sorted[0..4]\n most_used = my_most.map do |array|\n array[0]\n end\n most_used\n end", "def sort_counts()\n @count_array = @counts.to_a\n @count_array.sort_by! { |pair| pair[1] }\n @count_array.reverse!\n @count_array\n end", "def hash (site)\n\t#hash_in_hash = Array.new\n\t#hash_in_hash = {\"URL\" => \"MD5_Digest\"}\n\topen (site) do |s|\n\t\tresponse = s.read\n\t\tdigest = Digest::MD5.hexdigest(response)\n\t\t#string1 = site + \" - \" + digest + \"\\n\"\n\t\t#file2 = File.open(\"/Users/ismeet/code/ruby/js_scan/hashes\", \"a\")\n\t\t#file2.write(string1)\n\t\treturn site, digest #Return site and digest. The hash has to be created in the outside function where we area calling the hash function.\n\tend\nend", "def initialize(url) #pass in the url...cnn\n @url = url #saving the url in n instance variable \n #this is how you create a default value for a hash\n @histogram = Hash.new(0) #taking histogram and creating a hash but setting default values at 0. we're going to be couting words so default should be zero\n\n parse #parse is a method (def below)\n\n #this is how you sort a hash!!!!\n words.each{|w| @histogram[w.downcase] +=1 } #creating the histogram \"for each word..grab each word one at a time- take the histogram and make all the words lowercase. +=1 means add words/couting for all the words that are the same. so we'll have all the words and all the counts\"\n @histogram = @histogram.sort_by {|key, value| value}.reverse #take the histogram and sort it by value. does this in ascending order. .reverse puts it in descending order\n end", "def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\n end", "def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end", "def users_by_amount_visited\n user_visits = self.visited_museums.count\n other_user_visits = User.where.not(id: self.id).map { |user| user.visited_museums.count }\n other_user_visits.unshift(user_visits)\n end", "def most_views\n @content.sort_by { |address| address[1].length }.reverse.each do |values|\n @output << \"#{values.first} #{values.last.count} visits\"\n end\n end", "def dfsLink(url, count)\n begin\n if count == @level\n return \n end\n doc = Nokogiri::HTML(open(url))\n links = getLinks(doc)\n \n puts \"Current scan url is :#{url} value is #{@hash[url]}\"\n @hash[url] = 1\n if links.size == 0 \n return\n else\n links.each do |link|\n href = link['href']\n if @hash.has_key?(href)\n @hash[href] = 1\n else\n @hash[href] = 2 \n dfsLink(href, count+1)\n end\n end\n end\n rescue => exp\n @hash[url] = 0\n return \n end\n end", "def numUnique list\n if list.length == 0\n return \"**0**\"\n end\n counter = Hash.new\n counter[list[0]] = 1\n\n list.each do |num|\n number_exists = false\n counter.each do |key, count|\n if num == key\n count += 1\n number_exists = true\n end\n end\n\n if !number_exists\n counter[num] = 1\n end\n\n end\n\n puts \"counter #{counter}\"\n unique_nums = []\n\n counter.each do |key, value|\n unique_nums << key\n end\n\n return \"**#{unique_nums.length}**\"\n\nend", "def sort_by_sites!\n @list = Hash[@list.sort_by {|partition_name, partition| partition.sites.size}]\n self\n end", "def urls\n payloads.group(\"url\")\n .count\n .sort_by { |k,v| -v }\n end", "def generate_hash\n @groups.flatten.inject([]) {|hash, stone| hash << stone.to_s}.sort.hash\n end", "def sort(p)\n hashed = {}\n words = p.downcase.split(/\\/W/)\n words.each do |word|\n if hashed[word]\n hashed[word] += 1\n elsif word != ''\n hashed[word] = 1\n end\n end\n puts hashed.sort_by {|_key, value| value}.to_h\nend", "def count_subdomain_visits(subdomains)\n vist_counts = Hash.new(0)\n subdomains.each do |sd|\n count = sd.split(' ').first.to_i\n sds = break_subdomains(sd.split(' ').last)\n sds.each do |d|\n vist_counts[d] += count\n end\n end\n vist_counts\nend", "def hashes(to = $stdout)\n hashes = {}\n \n ObjectSpace.each_object(Hash) do |hash|\n begin\n keys_orig = hash.keys.sort\n rescue ArgumentError\n #When unable to sort regexps...\n next\n end\n \n keys = []\n keys_orig.each do |key|\n keys << key.to_s\n end\n \n if keys.empty?\n keystr = :empty\n else\n keystr = keys.join(\":\")\n end\n \n if !hashes.key?(keystr)\n hashes[keystr] = 1\n else\n hashes[keystr] += 1\n end\n end\n \n hashes.delete_if do |key, val|\n val < 100\n end\n \n hashes = Knj::ArrayExt.hash_sort(hashes) do |h1, h2|\n h2[1] <=> h1[1]\n end\n \n to.print \"<h1>Hashes</h1>\\n\"\n to.write \"<table class=\\\"hashes list\\\">\\n\"\n to.write \"\\t<thead>\\n\"\n to.write \"\\t\\t<tr>\\n\"\n to.write \"\\t\\t\\t<th>Hash keys</th>\\n\"\n to.write \"\\t\\t\\t<th>Instances</th>\\n\"\n to.write \"\\t\\t</tr>\\n\"\n to.write \"\\t</thead>\\n\"\n to.write\"\\t<tbody>\\n\"\n \n hashes.each do |key, val|\n to.write \"\\t\\t<tr>\\n\"\n to.write \"\\t\\t\\t<td>#{Knj::Web.html(key)}</td>\\n\"\n to.write \"\\t\\t\\t<td>#{Knj::Locales.number_out(val, 0)}</td>\\n\"\n to.write \"\\t\\t</tr>\\n\"\n end\n \n to.write \"\\t</tbody>\\n\"\n to.write \"</table>\\n\"\n end", "def print_by_count(organized_data)\n\n organized_dates_only = organized_data.keys.sort\n\n puts \"***RESULTS START***\"\n puts \"\"\n\n organized_dates_only.each do |date| \n puts date\n site_to_hits = organized_data[date].sort_by {|site, hits| -hits}\n\n site_to_hits.each do |hit| \n site_name = hit[0]\n total_hits = hit[1]\n puts \"#{site_name} #{total_hits}\"\n end\n\n puts \"\"\n\n end\n\n puts \"***RESULTS END***\" \n puts \"\"\n \nend", "def unique_elements(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] += 1}\n return hash.keys\n\nend", "def get_redundant_urls_hash(urls_hash)\n urls_keys = urls_hash.select {|url,value| value[0] < 8}.keys\n urls_keys.each do |key|\n urls_hash.delete(key)\n end\n end", "def num_recent_uniques\n valid_visit = []\n self.visits.each do |visit|\n valid_visit << visit if visit.updated_at > 10.minutes.ago\n end\n valid_visit.count\n end", "def unique_elements(arr)\n\n # hash count -> duplicate removed -> return a new array\n new = []\n\n # count = Hash.new(0) # create {} with default value 0\n arr.each do |ele|\n if !new.include?(ele)\n new << ele\n end\n end\n # print count # {\"a\"=>3, \"b\"=>2, \"c\"=>1}\n\n return new \nend", "def collate!\n @buckets = @buckets.sort { |a,b| b.time <=> a.time }\n @ordered = {}\n @buckets.map { |o| o.identity }.uniq.each do |identity|\n @ordered[identity] = @buckets.select { |o| o.identity == identity }\n end\n return @buckets\n end", "def calculate_clicks_by_domain(counts)\n all_domains_counter = {}\n\n counts.each do |csv_string|\n click_count = csv_string.split(\",\").first.to_i\n initial_domain_string = csv_string.split(\",\").last\n all_subdomains = break_domain_string_by_elements(initial_domain_string)\n all_subdomains.each do |domain|\n all_domains_counter[domain] ? all_domains_counter[domain] += click_count : all_domains_counter[domain] = click_count\n end\n end\n\n all_domains_counter.map { |domain, click| [click, domain] }.sort_by { |group| group[0] }.reverse\nend", "def my_uniq(arr)\n count = Hash.new(0)\n arr.each {|ele| count[ele]+= 1}\n count.keys\nend", "def hash\n [_403, _404, _500, _504, start_timestamp, end_timestamp, start_datetime, end_datetime, total_requests, cache_hits, cache_hit_rate, total_request_time, avg_origin_response_time, response_time_ms, _100_x, _20_x, _30_x, _40_x, _50_x, _50th, _95th, _99th].hash\n end", "def max_pages() Pages.keys.size end", "def all_sorted\n @data[:pages].sort_by{|k, v| -v}\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def display_webpage_views\n webpage_views\n puts 'Overall webpage views'\n puts \"\\n\"\n @webpage_views_hash.each do |webpage, view_hash|\n puts webpage\n puts \"#{view_hash.values[0]} unique views\"\n puts \"#{view_hash.values[1]} total views\"\n puts \"\\n\"\n end\n end", "def my_uniq(arr)\n hsh = Hash.new(0)\n arr.each do |el|\n hsh[el] += 1\n end\n hsh.keys\nend", "def count_unique\n IpVisit.connection.execute(\n \"SELECT COUNT(*) FROM (SELECT DISTINCT(ip) FROM ip_visits) as dist\"\n ).to_a[0]\n end", "def calculate_visits_count\n self.visits.count(:conditions => {:unique => true}).to_i\n end", "def hash\n [concatenated_path_down_count, administratively_down_count, no_diagnostic_count, path_down_count, reverse_concatenated_path_down_count, neighbor_signaled_session_down_count, control_detection_time_expired_count, echo_function_failed_count, forwarding_plane_reset_count].hash\n end", "def total_unique_views_per_file_path\n iterate_unique_views.group_by { |x| x }.map { |k, v| [k, v.count] }\n end", "def hash\n [apm_scanned_bytes, events_scanned_bytes, hour, logs_scanned_bytes, org_name, public_id, rum_scanned_bytes, total_scanned_bytes].hash\n end", "def unique_elements(arr)\n hash = Hash.new(0)\n arr.each { |ele| hash[ele] += 1}\n hash.keys\nend", "def sort_by_occurrence(records)\n count = Hash.new(0)\n records.each {|element| count[element] += 1}\n records = records.uniq.sort {|x,y| count[y] <=> count[x]}\n return records\n end", "def unique_elements(arr)\n my_hash = Hash.new(0)\n arr.each do |element|\n my_hash[element] += 1\n end\n return my_hash.keys\nend", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def buckets()\n @sortedBuckets = @data.keys.sort {|x,y| y <=> x}\n Utils.printMux(@log, \"buckets> sortedBuckets:\" + @sortedBuckets.pretty_inspect(), @DEBUG, @LOG_DEBUG, Utils::DEBUG_LOW, Utils::LOG_LOW)\n end", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def histogram(a_string)\n an_array = Array.new(a_string.length)\n ls_compact_string = a_string.delete(' ')\n an_array = ls_compact_string.downcase\n str_hash = Hash.new(0)\n for idx in 0..an_array.length\n item = an_array[idx]\n str_hash[item] += 1\n end\n return str_hash\nend", "def analyze_data(ary)\n frequency = count_frequency(ary)\n sort_hash(frequency)\nend", "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 my_uniq(arr)\n #make hash with each item in teh array as a key, and the value will be its frequency\n new_arr = []\n freqhash = Hash.new(0)\n arr.each do |ele| \n freqhash[ele] += 1\n end\n \n freqhash.each do |k, v| \n new_arr << k\n end\n \n new_arr\nend", "def sort_by_tag_count_with_random_buckets\n end", "def puppetsort(hash)\n # TODO(sissel): Implement sorting that follows the puppet style guide\n # Such as, 'ensure' goes first, etc.\n return hash.to_a\n end", "def find_urls_on_page(current_url,domain_url,urls_hash)\n dom = get_dom_for_page(current_url)\n if not dom \n $log.info \"Unable to create dom\" \n return \n end\n urls_list = {}\n\t dom.xpath('//a/@href').each do |node|\n\t url = node.content\n next if not url \n create_bag_of_words_for_parent_class(node)\n create_bag_of_words_for_parent_name(node)\n if node.parent.parent.attributes['class']\n parent_parent_class = node.parent.parent.attributes['class'].to_s\n else\n parent_parent_class = \"UNKNOWN\"\n end\n parent_parent_name = node.parent.parent.name\n node_path = node.path\n url = url.chomp.strip\n url = url.gsub(\"..\",\"\") \n url = url.gsub(\"./\",\"/\")\n if relative?(url)\n url = make_absolute(domain_url,url)\n end\n if not url.match(/\\%/)\n\t url = URI.encode(url)\n\t end\n next if not url.match(/http(s)?:\\/\\/[^\\/]+/).to_s == domain_url\n urls_list[url] = true if not urls_list[url]\n url_length = get_url_length(url)\n if not urls_hash[url]\n urls_hash[url] = [1,parent_parent_class,parent_parent_name,url_length,node_path]\n else\n urls_hash[url][0] += 1\n end\n\t end\n\t return urls_list.keys\n end", "def get_ographhash(ographobj)\n ographhash = Hash[\n 'display' => ographobj.at_xpath(\"displayprio\").text,\n 'name' => ographobj.at_xpath(\"name\").text,\n 'yaxis' => ographobj.at_xpath(\"verticallabel\").text,\n 'datapoints' => ographobj.xpath('datapoints/overviewgraphdatapoint'),\n ]\n\n return Hash[ographhash.sort]\n end", "def hash\n @node.sort.push(@edge).hash\n end", "def sort_links(linksHash, textToSearch)\n\ttitle_regex = /title=\"(.*?)\"/\n\tlinksHash.each { |k,v|\n\t\ttitle = title_regex.match(k.to_s)\n\t\ttitle = $1\n\t\t\n\t\ttextToSearch.each_line { |line|\n\t\t\tif line.include?(title)\n\t\t\t\tlinksHash[k] += 1\n\t\t\tend\n\t\t}\n\t}\n\treturn Hash[linksHash.sort_by { |k,v| v }.reverse].keys\nend", "def fill_hash(url)\n @url = url\n countries = Array.new\n populations = Array.new\n country_hash = {}\n\n doc = Nokogiri::HTML(open(@url))\n doc.css('table.wikitable tr:nth-child(2)~tr').each do |item|\n countries << item.at_css('td:nth-child(2) a:nth-child(2)')['title']\n populations << item.at_css('td:nth-child(3)').text\n end\n\n @countries = countries\n @populations = populations\n\n ([email protected] - 1).each do |index|\n country_hash[@countries[index]] = @populations[index]\n end\n return country_hash\nend", "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 my_uniq(arr)\n counter = Hash.new(0)\n arr.each do |x|\n counter[x] += 1\n end\n counter.keys\nend", "def analysis\n hash = {}\n @array.each do |item|\n chars = item.chars.to_a - @used_chars\n\n chars.each do |char|\n if hash[char] == nil\n hash[char] = 1\n else\n hash[char] += 1\n end\n end\n end\n\n hash.sort_by { |_, v| -v }\n end", "def hashrate\n 7158278.826666666 * shares.fresh.count\n end", "def to_json_sort\r\n JSON.generate({:session_id => @session_id, :max_age => @max_age, :secure_hash_key => @secure_hash_key})\r\n end", "def sorted_affinities\n unless @sorted_affinities\n @sorted_affinities = hash_pidurl_affinity.collect { |product_idurl, affinity| affinity }\n @sorted_affinities.sort! { |a1, a2| a2.measure <=> a1.measure }\n current_ranking = 0; previous_measure = nil\n @sorted_affinities.each do |affinity|\n if affinity.measure != previous_measure\n current_ranking += 1\n previous_measure = affinity.measure\n end\n affinity.ranking = current_ranking\n end\n end\n @sorted_affinities\n end", "def sort_scores_hash(unsorted_scores, highest_possible_score)\n score_counts = {}\n unsorted_scores.each do |score|\n score_counts[score] = 0 unless score_counts[score]\n score_counts[score] += 1\n end\n\n sorted_scores = []\n i = HIGHEST_POSSIBLE_SCORE\n while i >= 0\n unless score_counts[i]\n i = i - 1\n next\n end\n\n score_counts[i].times { sorted_scores << i }\n i = i - 1\n end\n\n sorted_scores\nend", "def sortByCountDecreasing\r\n @counts.sort_by { |k,v| v }.reverse\r\n end", "def numUnique(array)\n\n uniques = {}\n counter = 0\n\n for element in array\n if uniques[element]\n uniques[element] = uniques[element] + 1\n else\n uniques[element] = 1\n end\n end\n\n count_uniques = 0\n\n for element in uniques\n count_uniques += 1\n end\n\n return count_uniques\n\nend" ]
[ "0.7481599", "0.6887685", "0.686704", "0.6817499", "0.6805365", "0.6704389", "0.6495376", "0.6410606", "0.6409974", "0.64058053", "0.60670227", "0.6037895", "0.60190415", "0.6015504", "0.59360945", "0.5905298", "0.5905298", "0.5905298", "0.5874615", "0.5871076", "0.5855887", "0.58195", "0.57672304", "0.57658386", "0.5740149", "0.57394695", "0.5736266", "0.5712012", "0.5701392", "0.5700171", "0.56923354", "0.56648487", "0.5663472", "0.5657444", "0.5646625", "0.55962443", "0.5593862", "0.55770487", "0.5558666", "0.55484706", "0.5534921", "0.55179554", "0.5512991", "0.55110323", "0.5503522", "0.54961526", "0.54730946", "0.54713297", "0.54437345", "0.5438505", "0.5423095", "0.54221225", "0.5417294", "0.5397764", "0.53854257", "0.53792614", "0.5375931", "0.53686583", "0.5365634", "0.5359019", "0.535844", "0.535844", "0.535844", "0.535844", "0.535844", "0.535844", "0.535844", "0.535064", "0.5349749", "0.5347851", "0.53460073", "0.5344404", "0.5343571", "0.53406256", "0.53209454", "0.53209454", "0.5314433", "0.5311113", "0.53069884", "0.5306521", "0.5300016", "0.52992755", "0.52958095", "0.52914345", "0.52907526", "0.5285608", "0.528433", "0.5277341", "0.52685016", "0.5264707", "0.526276", "0.52548105", "0.52533746", "0.5241895", "0.5239318", "0.5234783", "0.5232804", "0.5231853", "0.52254725", "0.5225426" ]
0.76342076
0
this is a private method for returning the hash of pages and their corresponding frequency of visits
def calculate_page_frequency page_frequency_hash = {} pages_array = [] @data.split("\n").each do |line| pages_array << line.match(Regex::PAGE_URL)[0] if line =~ Regex::PAGE_URL end pages_array.each do |page| page_frequency_hash[page].nil? ? page_frequency_hash[page] = 1 : page_frequency_hash[page] += 1 end page_frequency_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_page_visits(visits)\n visits_hash = Hash.new(0)\n visits.each do |visit|\n visits_hash[visit.page] += 1\n end\n # Returned the hash in case it would be required to be stored rather than just printed\n return visits_hash\nend", "def total_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def find_unique_page_visits(visits)\n unique_visits_hash = Hash.new(0)\n unique_addresses_hash = Array.new\n visits.each do |visit|\n # Each time a unique visit is detected, it adds the address and page to an array, so that it can be checked against for future checks\n if !unique_addresses_hash.include? [visit.page, visit.address]\n unique_addresses_hash.push [visit.page, visit.address]\n unique_visits_hash[visit.page] +=1\n end\n end\n # Returned the hash in case it would be required to be stored rather than just printed\n return unique_visits_hash\nend", "def urlhist(path)\n\t\tu = Hash.new(0)\n\t\tcnt = 0\n\t\tf=File.open(path)\n\t\tf.readlines.each do |line|\n\t\t\tpart = line.split(' ')\n\t\t\turl = part[6]\n\t\t\tu[url] = u[url] + 1\n\t\t\tcnt +=1\t\n\t\tend\n\t\tu.sort.each do |k, v|\n\t\t\tprint \"The frequency of #{k} | \"\n\t\t\twhile v > 0\n\t\t\t\tprint \"#\"\n\t\t\t\tv-=1\n\t\t\tend\n\t\tputs \"\\n\"\n\t\tend\n\t\t\n\tend", "def calculate_unique_page_views\n ip_frequency_per_page = calculate_ip_frequency_per_page\n ip_frequency_per_page.transform_values { |value| value.uniq.length }.sort_by { |_key, value| value }.reverse.to_h\n end", "def calculate_ip_frequency_per_page\n ip_frequency_per_page_hash = {}\n @data.split(\"\\n\").each do |line|\n page_url = line.match(Regex::PAGE_URL)[0] if line =~ Regex::PAGE_URL\n ip_frequency_per_page_hash[page_url] = [] unless ip_frequency_per_page_hash[page_url]\n ip_frequency_per_page_hash[page_url] << line.match(Regex::IP_ADDRESS)[0] if line =~ Regex::IP_ADDRESS\n end\n ip_frequency_per_page_hash\n end", "def calculate_most_viewed_pages\n pages_with_frequency = calculate_page_frequency\n pages_with_frequency.sort_by { |_key, value| value }.reverse.to_h\n end", "def webpage_views\n count_unique_views\n count_total_views\n\n @unique_views_hash.each do |webpage, unique|\n @webpage_views_hash.store(webpage, 'Unique views' => unique)\n end\n\n @total_views_hash.each do |webpage, total|\n @webpage_views_hash[webpage].store('Total views', total)\n end\n @webpage_views_hash\n end", "def unique_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.uniq.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def count_freq\n hash = Hash.new(0)\n self.each do |element|\n hash[element] +=1\n end\n return hash\n end", "def hash\n [_403, _404, _500, _504, start_timestamp, end_timestamp, start_datetime, end_datetime, total_requests, cache_hits, cache_hit_rate, total_request_time, avg_origin_response_time, response_time_ms, _100_x, _20_x, _30_x, _40_x, _50_x, _50th, _95th, _99th].hash\n end", "def pages_cache_key\n [\n Page.count,\n Page.order(\"updated_at DESC\").first\n ]\n end", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def popular_links\n result = {}\n urls[0...5].each do |url|\n result[url] = url.num_clicks\n end\n result\n end", "def hash (site)\n\t#hash_in_hash = Array.new\n\t#hash_in_hash = {\"URL\" => \"MD5_Digest\"}\n\topen (site) do |s|\n\t\tresponse = s.read\n\t\tdigest = Digest::MD5.hexdigest(response)\n\t\t#string1 = site + \" - \" + digest + \"\\n\"\n\t\t#file2 = File.open(\"/Users/ismeet/code/ruby/js_scan/hashes\", \"a\")\n\t\t#file2.write(string1)\n\t\treturn site, digest #Return site and digest. The hash has to be created in the outside function where we area calling the hash function.\n\tend\nend", "def analyze_session session\n visit_time = DateTime.parse(session[0][\"visit_time\"])\n mark_landing = false\n mark_conversion = false\n\n viewed_pages = Set.new\n\n unless during?(\n session[0][\"visit_time\"],\n \"2012-05-17 22:00:00 +0900\",\n \"2012-07-22 11:00:00 +0900\")\n return\n end\n\n version = \"\"\n \n analyze session do |action|\n if !mark_landing and action[\"_type\"] == \"page_load\"\n if front_porch? action\n mark_landing = true\n version = extract_version action[\"pageurl\"]\n end\n end\n \n if action[\"_type\"] == \"page_load\"\n if conversion? action\n mark_conversion = true\n break\n else\n pageurl = action[\"pageurl\"]\n pageurl = pageurl.split(\"?\")[0]\n viewed_pages.add(pageurl)\n end\n end\n end\n\n unless mark_landing\n return\n end\n\n viewed_pages.each do |viewed_page|\n @page_view[version] ||= {}\n @page_view[version][viewed_page] ||= 0\n @page_view[version][viewed_page] += 1\n end\n\n @visits[version] ||= 0 \n @visits[version] += 1\n\n end", "def sort_and_print(hash, type=\"visits\")\n new_hash = hash.sort_by { |page, visits| -visits}.to_h\n # Print into console to check\n new_hash.each do |page, number_of_visits|\n print page + \" \" + number_of_visits.to_s + \" \" + type + \" \"\n end\n # Return sorted hash\n return new_hash\nend", "def dfsLink(url, count)\n begin\n if count == @level\n return \n end\n doc = Nokogiri::HTML(open(url))\n links = getLinks(doc)\n \n puts \"Current scan url is :#{url} value is #{@hash[url]}\"\n @hash[url] = 1\n if links.size == 0 \n return\n else\n links.each do |link|\n href = link['href']\n if @hash.has_key?(href)\n @hash[href] = 1\n else\n @hash[href] = 2 \n dfsLink(href, count+1)\n end\n end\n end\n rescue => exp\n @hash[url] = 0\n return \n end\n end", "def cache_score(data)\n data['freq'] += 1\n if data['freq'] > 10\n data['freq'] = 10\n end\n freq = data['freq']\n byte_size = data['byte_size']\n byte_size /= Float($max_page_size)\n time = data['time']\n time_diff = Float(time - $start_time) / $start_time\n freq /= 10.0\n return freq * time_diff / byte_size\nend", "def analyze_session session\n analyze session do |action|\n if action[\"_type\"] == \"page_load\"\n pageurl = action[\"pageurl\"]\n if !(pageurl =~ /^http\\:\\/\\/www2\\.hulu\\.jp\\/(\\?.*)?$/).nil?\n @pv_count += 1\n @pv_count_details[pageurl] ||= 0\n @pv_count_details[pageurl] += 1\n end\n end\n end\n end", "def med_stats_hash(_assessed_data); end", "def hash\n [event_count, hour, index_id, index_name, org_name, public_id, retention].hash\n end", "def calcule_nombre_pages\n @pages_count ||= Hash.new\n @pages_count.merge!({\n signes: (length / NUMBER_SIGNES_PER_PAGE) + 1,\n mots: (mots.count / NUMBER_MOTS_PER_PAGE) + 1\n })\n @pages_count.merge!(moy: (@pages_count[:signes] + @pages_count[:mots]) / 2)\n end", "def freq(array)\n hash = Hash.new(0)\n array.each{|key| hash[key] += 1}\n hash\nend", "def hash\n [concatenated_path_down_count, administratively_down_count, no_diagnostic_count, path_down_count, reverse_concatenated_path_down_count, neighbor_signaled_session_down_count, control_detection_time_expired_count, echo_function_failed_count, forwarding_plane_reset_count].hash\n end", "def hash\n [apm_scanned_bytes, events_scanned_bytes, hour, logs_scanned_bytes, org_name, public_id, rum_scanned_bytes, total_scanned_bytes].hash\n end", "def visits_count\n self.visits_count_cache || self.visits_count_cache = self.calculate_visits_count\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n [rel, href].hash\n end", "def collect_common_urls_hash(url,domain_url,urls_hash,options,depth=0)\n #$log.info \"1. Pages crawled: #{@already_visited.size}\"\n #$log.info \"2. Depth: #{depth}\"\n #$log.info \"3. Crawling URL: #{url}\"\n if options[:crawl]\n return if depth == 2 \n else\n return if depth == 1\n end\n return if @already_visited.size == 10\n if @already_visited[url] == nil\n @already_visited[url] = true\n else\n return\n end\n page_urls = find_urls_on_page(url,domain_url,urls_hash)\n return if page_urls == nil\n if options[:crawled_urls]\n @p_obj.puts \"URL: #{url} DEPTH: #{depth}\"\n $log.info \"URLS CRAWLED: #{@already_visited.size}, CRAWLED URL: #{url}\"\n end\n page_urls.each do |page_url|\n break if @already_visited.size == 10\n collect_common_urls_hash(page_url,domain_url,urls_hash,options,depth+1) if page_url.match(/http(s)?:\\/\\/[^\\/]+/).to_s == domain_url and not page_url.include?\"Redirect\"\n end\n end", "def count_frequencies s\n s.downcase.split(//).inject(Hash.new(0)) do |hash,item|\n hash[item] += 1\n hash\n end\n end", "def frequencies\n inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n end", "def analyze_data(ary)\n frequency = count_frequency(ary)\n sort_hash(frequency)\nend", "def get_word_freq\n speech_links = get_links_to_speeches\n word_freq = Hash.new(0)\n \n speech_links.each do |link|\n speech_page = link.click\n if (speech_obj = speech_page.at SPEECH_DIV_IDENTIFIER)\n speech = speech_obj.text\n words = speech.split(' ')\n words.each{ |word| word_freq[clean_str(word)] += 1 }\n end\n end\n\n word_freq.sort_by{ |x,y| y }.reverse\n end", "def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end", "def hashrate\n 7158278.826666666 * shares.fresh.count\n end", "def initialize(url) #pass in the url...cnn\n @url = url #saving the url in n instance variable \n #this is how you create a default value for a hash\n @histogram = Hash.new(0) #taking histogram and creating a hash but setting default values at 0. we're going to be couting words so default should be zero\n\n parse #parse is a method (def below)\n\n #this is how you sort a hash!!!!\n words.each{|w| @histogram[w.downcase] +=1 } #creating the histogram \"for each word..grab each word one at a time- take the histogram and make all the words lowercase. +=1 means add words/couting for all the words that are the same. so we'll have all the words and all the counts\"\n @histogram = @histogram.sort_by {|key, value| value}.reverse #take the histogram and sort it by value. does this in ascending order. .reverse puts it in descending order\n end", "def count_subdomain_visits(subdomains)\n vist_counts = Hash.new(0)\n subdomains.each do |sd|\n count = sd.split(' ').first.to_i\n sds = break_subdomains(sd.split(' ').last)\n sds.each do |d|\n vist_counts[d] += count\n end\n end\n vist_counts\nend", "def page_id_hash content_md_doc\n page_id_hash = {}\n page_resource_nodes = content_md_doc.root.xpath('/contentMetadata/resource[@type=\"page\"]')\n logger.warn(\"no page <resource> elements found in contentMetadata: #{content_md_doc.to_xml}\") if page_resource_nodes.empty?\n page_resource_nodes.each { |p_node|\n # for each resource, get the id and the page number\n page_id_hash[page_id(p_node)] = page_num(p_node)\n }\n page_id_hash\n end", "def serializable_hash \n results.each.inject(empty_bins) do |histogram, result|\n histogram[result] = histogram[result] ? histogram[result] + 1 : 1; histogram\n end\n end", "def analyze_session session\n @total_landings += 1\n unless session[0][\"_type\"] == \"page_load\"\n return\n end\n url = session[0][\"pageurl\"]\n if url =~ /www2.hulu.jp\\/watch\\//\n return\n end\n url = remove_parameter url\n @conversion_landing_counter[url] ||= 0\n @landing_counter[url] ||= 0\n @landing_counter[url] += 1\n analyze session do |action|\n if conversion? action\n @total_conversions += 1\n @conversion_landing_counter[url] += 1\n return\n end\n end\n end", "def summarise()\n summary = Hash.new\n page_count = 0\n\n @nodes.each {|node|\n if summary.include?(node['content_type'])\n summary[node['content_type']] += 1\n else\n summary[node['content_type']] = 1\n end\n }\n\n summary.keys.sort.each {|node_type|\n count = summary[node_type].to_i\n page_count += count\n puts \"%-50s: %s\" % [node_type, count]\n }\n\n puts \"%-50s: %s\" % ['Total pages:', page_count]\n puts \"See output CSV in #{csv_output_path}\"\n end", "def calculate_visits_count\n self.visits.count(:conditions => {:unique => true}).to_i\n end", "def site_data_hash; end", "def compute_frequencies\n @transitions.map { |value, transition_hash|\n sum = 0.0\n transition_hash.each { |succ_value, occurencies| \n sum += occurencies\n }\n \n transition_hash.each { |succ_value, occurencies|\n @frequencies[value] ||= Hash.new{0}\n @frequencies[value][succ_value] = occurencies/sum \n }\n }\n end", "def subdomain_visits(cpdomains)\n result = []\n result_hsh = Hash.new(0)\n\n cpdomains.each do |cpdomain|\n total = cpdomain.split(' ')\n visits = total[0].to_i\n domain = total[1]\n\n sub_domains = domain.split('.')\n\n i = 0\n while i < sub_domains.length\n sub_domain = sub_domains.drop(sub_domains.length - 1 - i).join('.')\n result_hsh[sub_domain] += visits\n i += 1\n end\n end\n\n result_hsh.each do |k, v|\n result << v.to_s + ' ' + k\n end\n\n result\nend", "def make_hash_with_count(passage)\n array_from_excerpt = strip_text(passage)#input from first question\n names_and_counts = Hash.new 0 #initializes at 0\n array_from_excerpt.each do |word|\n names_and_counts[word] += 1#for all subs. occurences, add 1\n end\n names_and_counts # must have the last line return the array!\nend", "def visited_page(url); end", "def visited_page(url); end", "def histo_counts\n @histo_counts ||= calculate_histo_counts\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def sorted_pages\n sorted_array.map { |x| x.join(' ') }.join(' visits ')\n end", "def page_count; pages.count; end", "def frequency\n counts = Hash.new(0)\n self.words.each { |word| counts[word] += 1 }\n counts\n end", "def photos_count(info_count)\n x = info_count.inject(Hash.new(0)) { |h, e| h[e] += 1 ; h }\nend", "def to_s\n return 'No Results' if page_count.all? { |_key, count| count.empty? }\n\n output = []\n page_count.each_pair do |type, counts|\n output << type\n sorted(counts).each do |path, count|\n output << \"#{path} #{count} visit#{'s' if count.zero? || count > 1}\"\n end\n end\n output.join(\"\\n\")\n end", "def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\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 [type, page_access_token, app_id, app_secret, account_sid, auth_token, phone_number_sid, token, channel_access_token, encoding_aes_key, from_address, certificate, password, auto_update_badge, server_key, sender_id, consumer_key, consumer_secret, access_token_key, access_token_secret].hash\n end", "def hash()\n #This is a stub, used for indexing\n end", "def histogram(a_string)\n an_array = Array.new(a_string.length)\n ls_compact_string = a_string.delete(' ')\n an_array = ls_compact_string.downcase\n str_hash = Hash.new(0)\n for idx in 0..an_array.length\n item = an_array[idx]\n str_hash[item] += 1\n end\n return str_hash\nend", "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 word_frequency(words)\n frequencies = Hash.new(0)\n words.each do |word|\n frequencies[word] += 1\n end\n frequencies\nend", "def hash\n [host_list, total_matching, total_returned].hash\n end", "def get_all_links_as_hash(page)\n parsed_page = Nokogiri::HTML(page)\n links = parsed_page.css('a')\n\n all_links = Hash[links.xpath('//a[@href]').map {|link| [link.text.strip, link['href']]}]\n\n return all_links\nend", "def sorted_pages_unique_views\n sorted_array_unique_views.map { |x| x.join(' ') }.join(' unique visits ')\n end", "def num_clicks\n count = 0\n self.visits.each { |user| count += user.visits }\n count\n end", "def frequency\n \n end", "def hash\n 0\n end", "def word_sizes(words)\n count_hash = Hash.new(0)\n words.split.each do |word|\n count_hash[word.size] += 1\n end\n p count_hash\nend", "def hash(*) end", "def hash\n [page_size, field_labels, date_time_format, time_zone_offset].hash\n end", "def count_percentage(array,decimal = 2)\n hash1 = Hash.new(0)\n array.each do |element|\n hash1[element] += 1\n end\n total_elements = array.size\n hash2 = Hash.new(0)\n hash1.each do |key,value|\n hash2[key] = (value/total_elements.to_f).round(decimal)\n end\n return hash2\nend", "def hash\n [name, url].hash\n end", "def info_hash(user, client)\n basic_info = basic_hash(user, client)\n basic_info.merge!({:totalResults => readable_items_count(user, client),\n :link => { :rel => \"self\", :href => \"/appdata/#{client.id}/@collections/#{id}\"}\n })\n return basic_info\n end", "def to_hash\n call\n @hash[:inner_hits] = @inner_hits.to_hash if @inner_hits\n @hash\n end", "def output_hash; end", "def count_hash(arr)\n count = {}\n arr.each {|e|\n count[e] ||= 0\n count[e] += 1\n }\n count\n end", "def display_webpage_views\n webpage_views\n puts 'Overall webpage views'\n puts \"\\n\"\n @webpage_views_hash.each do |webpage, view_hash|\n puts webpage\n puts \"#{view_hash.values[0]} unique views\"\n puts \"#{view_hash.values[1]} total views\"\n puts \"\\n\"\n end\n end", "def get_freq\n #instantiate with values to ensure consistent ordering\n freq = { 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0 }\n #sum up freqencies of each number\n last_100 = get_last_100\n last_100.each do |item|\n freq[item.to_i] += 1\n end\n # convert to percentage\n freq.each do |key, val|\n #divide by real length to handle case of less than 100 outputs\n freq[key] = val / last_100.length.to_f\n end\n freq\n end", "def fill_hash(url)\n @url = url\n countries = Array.new\n populations = Array.new\n country_hash = {}\n\n doc = Nokogiri::HTML(open(@url))\n doc.css('table.wikitable tr:nth-child(2)~tr').each do |item|\n countries << item.at_css('td:nth-child(2) a:nth-child(2)')['title']\n populations << item.at_css('td:nth-child(3)').text\n end\n\n @countries = countries\n @populations = populations\n\n ([email protected] - 1).each do |index|\n country_hash[@countries[index]] = @populations[index]\n end\n return country_hash\nend", "def stats_to_hash\n {\n views_count: views,\n views_till_end_count: views_till_end,\n sum_view_time_sec: sum_view_time_sec,\n comments_count: comments,\n }\n end", "def frequency\n # normal string which has assigned all the alphabets\n name = 'abcdefghijklmnopqrstuvwxyz'\n # this line will first split 'name' string and then assign it to hash\n @letters = name.split('').reduce(@letters){|alphabet,count| alphabet[count] +=0; alphabet}\n # this will convert all the alphabets of 'str' to lower case\n @str = @str.downcase\n # this will remove special characters from the string and only allow lower case alphabets\n @str = @str.gsub(/[^a-z]/, '')\n # this will split the 'str' and assign the letters to hash and add 1 each time the letter appeared\n @letters = @str.split('').reduce(@letters){|alphabet,count| alphabet[count] +=1; alphabet}\n\n end", "def element_count(arr)\n hash = {} \n\n # debugger \n arr.each {|ele| hash[ele] = arr.count(ele) }\n\n hash \nend" ]
[ "0.7714523", "0.70905674", "0.69267744", "0.69012433", "0.68318075", "0.6717959", "0.66150737", "0.6596183", "0.65781957", "0.64680403", "0.6318332", "0.61998767", "0.6187754", "0.6138905", "0.6136407", "0.6070792", "0.60587674", "0.59996647", "0.5976026", "0.5935271", "0.5918527", "0.58720744", "0.58660394", "0.5853891", "0.58514726", "0.5842278", "0.5835841", "0.58138824", "0.58138824", "0.58138824", "0.58138824", "0.58138824", "0.58138824", "0.58138824", "0.5812475", "0.5809878", "0.5807341", "0.5796007", "0.57714546", "0.5757859", "0.57341695", "0.5731959", "0.5729384", "0.5723371", "0.57146275", "0.57038015", "0.5698341", "0.5695527", "0.56942844", "0.56934553", "0.56825393", "0.56781244", "0.5634642", "0.56282324", "0.56282324", "0.56237763", "0.55969846", "0.55969846", "0.55969846", "0.55969846", "0.55969846", "0.55969846", "0.55969846", "0.55969846", "0.55969846", "0.55969846", "0.5596546", "0.5592294", "0.5586191", "0.5583498", "0.5581141", "0.55758524", "0.5568336", "0.55448085", "0.5537031", "0.55295455", "0.5524445", "0.5506571", "0.5505122", "0.55051184", "0.55044484", "0.54906964", "0.5489262", "0.54803705", "0.54789484", "0.547008", "0.54616094", "0.54517704", "0.5437302", "0.54317206", "0.54284775", "0.5428045", "0.5421639", "0.5418161", "0.5416932", "0.5401555", "0.54013395", "0.5398738", "0.53952444", "0.53887725" ]
0.7654522
1
this is a private method for returning the hash of pages and their corresponding frequency of unique visits
def calculate_ip_frequency_per_page ip_frequency_per_page_hash = {} @data.split("\n").each do |line| page_url = line.match(Regex::PAGE_URL)[0] if line =~ Regex::PAGE_URL ip_frequency_per_page_hash[page_url] = [] unless ip_frequency_per_page_hash[page_url] ip_frequency_per_page_hash[page_url] << line.match(Regex::IP_ADDRESS)[0] if line =~ Regex::IP_ADDRESS end ip_frequency_per_page_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_page_visits(visits)\n visits_hash = Hash.new(0)\n visits.each do |visit|\n visits_hash[visit.page] += 1\n end\n # Returned the hash in case it would be required to be stored rather than just printed\n return visits_hash\nend", "def find_unique_page_visits(visits)\n unique_visits_hash = Hash.new(0)\n unique_addresses_hash = Array.new\n visits.each do |visit|\n # Each time a unique visit is detected, it adds the address and page to an array, so that it can be checked against for future checks\n if !unique_addresses_hash.include? [visit.page, visit.address]\n unique_addresses_hash.push [visit.page, visit.address]\n unique_visits_hash[visit.page] +=1\n end\n end\n # Returned the hash in case it would be required to be stored rather than just printed\n return unique_visits_hash\nend", "def calculate_unique_page_views\n ip_frequency_per_page = calculate_ip_frequency_per_page\n ip_frequency_per_page.transform_values { |value| value.uniq.length }.sort_by { |_key, value| value }.reverse.to_h\n end", "def calculate_page_frequency\n page_frequency_hash = {}\n pages_array = []\n @data.split(\"\\n\").each do |line|\n pages_array << line.match(Regex::PAGE_URL)[0] if line =~ Regex::PAGE_URL\n end\n pages_array.each do |page|\n page_frequency_hash[page].nil? ? page_frequency_hash[page] = 1 : page_frequency_hash[page] += 1\n end\n page_frequency_hash\n end", "def unique_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.uniq.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def total_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def urlhist(path)\n\t\tu = Hash.new(0)\n\t\tcnt = 0\n\t\tf=File.open(path)\n\t\tf.readlines.each do |line|\n\t\t\tpart = line.split(' ')\n\t\t\turl = part[6]\n\t\t\tu[url] = u[url] + 1\n\t\t\tcnt +=1\t\n\t\tend\n\t\tu.sort.each do |k, v|\n\t\t\tprint \"The frequency of #{k} | \"\n\t\t\twhile v > 0\n\t\t\t\tprint \"#\"\n\t\t\t\tv-=1\n\t\t\tend\n\t\tputs \"\\n\"\n\t\tend\n\t\t\n\tend", "def count_freq\n hash = Hash.new(0)\n self.each do |element|\n hash[element] +=1\n end\n return hash\n end", "def webpage_views\n count_unique_views\n count_total_views\n\n @unique_views_hash.each do |webpage, unique|\n @webpage_views_hash.store(webpage, 'Unique views' => unique)\n end\n\n @total_views_hash.each do |webpage, total|\n @webpage_views_hash[webpage].store('Total views', total)\n end\n @webpage_views_hash\n end", "def calculate_most_viewed_pages\n pages_with_frequency = calculate_page_frequency\n pages_with_frequency.sort_by { |_key, value| value }.reverse.to_h\n end", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def sorted_pages_unique_views\n sorted_array_unique_views.map { |x| x.join(' ') }.join(' unique visits ')\n end", "def calculate_visits_count\n self.visits.count(:conditions => {:unique => true}).to_i\n end", "def hash\n [_403, _404, _500, _504, start_timestamp, end_timestamp, start_datetime, end_datetime, total_requests, cache_hits, cache_hit_rate, total_request_time, avg_origin_response_time, response_time_ms, _100_x, _20_x, _30_x, _40_x, _50_x, _50th, _95th, _99th].hash\n end", "def freq(array)\n hash = Hash.new(0)\n array.each{|key| hash[key] += 1}\n hash\nend", "def hash (site)\n\t#hash_in_hash = Array.new\n\t#hash_in_hash = {\"URL\" => \"MD5_Digest\"}\n\topen (site) do |s|\n\t\tresponse = s.read\n\t\tdigest = Digest::MD5.hexdigest(response)\n\t\t#string1 = site + \" - \" + digest + \"\\n\"\n\t\t#file2 = File.open(\"/Users/ismeet/code/ruby/js_scan/hashes\", \"a\")\n\t\t#file2.write(string1)\n\t\treturn site, digest #Return site and digest. The hash has to be created in the outside function where we area calling the hash function.\n\tend\nend", "def pages_cache_key\n [\n Page.count,\n Page.order(\"updated_at DESC\").first\n ]\n end", "def num_uniques\n visitors.count\n end", "def num_uniques\n visitors.count\n end", "def num_uniques\n visitors.count\n end", "def popular_links\n result = {}\n urls[0...5].each do |url|\n result[url] = url.num_clicks\n end\n result\n end", "def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\n end", "def frequencies\n inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def count_frequencies s\n s.downcase.split(//).inject(Hash.new(0)) do |hash,item|\n hash[item] += 1\n hash\n end\n end", "def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end", "def serializable_hash \n results.each.inject(empty_bins) do |histogram, result|\n histogram[result] = histogram[result] ? histogram[result] + 1 : 1; histogram\n end\n end", "def dfsLink(url, count)\n begin\n if count == @level\n return \n end\n doc = Nokogiri::HTML(open(url))\n links = getLinks(doc)\n \n puts \"Current scan url is :#{url} value is #{@hash[url]}\"\n @hash[url] = 1\n if links.size == 0 \n return\n else\n links.each do |link|\n href = link['href']\n if @hash.has_key?(href)\n @hash[href] = 1\n else\n @hash[href] = 2 \n dfsLink(href, count+1)\n end\n end\n end\n rescue => exp\n @hash[url] = 0\n return \n end\n end", "def med_stats_hash(_assessed_data); end", "def sort_and_print(hash, type=\"visits\")\n new_hash = hash.sort_by { |page, visits| -visits}.to_h\n # Print into console to check\n new_hash.each do |page, number_of_visits|\n print page + \" \" + number_of_visits.to_s + \" \" + type + \" \"\n end\n # Return sorted hash\n return new_hash\nend", "def count_subdomain_visits(subdomains)\n vist_counts = Hash.new(0)\n subdomains.each do |sd|\n count = sd.split(' ').first.to_i\n sds = break_subdomains(sd.split(' ').last)\n sds.each do |d|\n vist_counts[d] += count\n end\n end\n vist_counts\nend", "def analyze_session session\n visit_time = DateTime.parse(session[0][\"visit_time\"])\n mark_landing = false\n mark_conversion = false\n\n viewed_pages = Set.new\n\n unless during?(\n session[0][\"visit_time\"],\n \"2012-05-17 22:00:00 +0900\",\n \"2012-07-22 11:00:00 +0900\")\n return\n end\n\n version = \"\"\n \n analyze session do |action|\n if !mark_landing and action[\"_type\"] == \"page_load\"\n if front_porch? action\n mark_landing = true\n version = extract_version action[\"pageurl\"]\n end\n end\n \n if action[\"_type\"] == \"page_load\"\n if conversion? action\n mark_conversion = true\n break\n else\n pageurl = action[\"pageurl\"]\n pageurl = pageurl.split(\"?\")[0]\n viewed_pages.add(pageurl)\n end\n end\n end\n\n unless mark_landing\n return\n end\n\n viewed_pages.each do |viewed_page|\n @page_view[version] ||= {}\n @page_view[version][viewed_page] ||= 0\n @page_view[version][viewed_page] += 1\n end\n\n @visits[version] ||= 0 \n @visits[version] += 1\n\n end", "def collect_common_urls_hash(url,domain_url,urls_hash,options,depth=0)\n #$log.info \"1. Pages crawled: #{@already_visited.size}\"\n #$log.info \"2. Depth: #{depth}\"\n #$log.info \"3. Crawling URL: #{url}\"\n if options[:crawl]\n return if depth == 2 \n else\n return if depth == 1\n end\n return if @already_visited.size == 10\n if @already_visited[url] == nil\n @already_visited[url] = true\n else\n return\n end\n page_urls = find_urls_on_page(url,domain_url,urls_hash)\n return if page_urls == nil\n if options[:crawled_urls]\n @p_obj.puts \"URL: #{url} DEPTH: #{depth}\"\n $log.info \"URLS CRAWLED: #{@already_visited.size}, CRAWLED URL: #{url}\"\n end\n page_urls.each do |page_url|\n break if @already_visited.size == 10\n collect_common_urls_hash(page_url,domain_url,urls_hash,options,depth+1) if page_url.match(/http(s)?:\\/\\/[^\\/]+/).to_s == domain_url and not page_url.include?\"Redirect\"\n end\n end", "def hash\n [event_count, hour, index_id, index_name, org_name, public_id, retention].hash\n end", "def unique_visits_count\n # FIXME datampper can't do .count(distinct...) or .count.group_by() ?!\n Visit.count(:user_id, :conditions => {:site_id => self.id})\n end", "def analyze_data(ary)\n frequency = count_frequency(ary)\n sort_hash(frequency)\nend", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def hashrate\n 7158278.826666666 * shares.fresh.count\n end", "def hash\n [apm_scanned_bytes, events_scanned_bytes, hour, logs_scanned_bytes, org_name, public_id, rum_scanned_bytes, total_scanned_bytes].hash\n end", "def total_unique_views_per_file_path\n iterate_unique_views.group_by { |x| x }.map { |k, v| [k, v.count] }\n end", "def make_hash_with_count(passage)\n array_from_excerpt = strip_text(passage)#input from first question\n names_and_counts = Hash.new 0 #initializes at 0\n array_from_excerpt.each do |word|\n names_and_counts[word] += 1#for all subs. occurences, add 1\n end\n names_and_counts # must have the last line return the array!\nend", "def visits_count\n self.visits_count_cache || self.visits_count_cache = self.calculate_visits_count\n end", "def histogram(a_string)\n an_array = Array.new(a_string.length)\n ls_compact_string = a_string.delete(' ')\n an_array = ls_compact_string.downcase\n str_hash = Hash.new(0)\n for idx in 0..an_array.length\n item = an_array[idx]\n str_hash[item] += 1\n end\n return str_hash\nend", "def subdomain_visits(cpdomains)\n result = []\n result_hsh = Hash.new(0)\n\n cpdomains.each do |cpdomain|\n total = cpdomain.split(' ')\n visits = total[0].to_i\n domain = total[1]\n\n sub_domains = domain.split('.')\n\n i = 0\n while i < sub_domains.length\n sub_domain = sub_domains.drop(sub_domains.length - 1 - i).join('.')\n result_hsh[sub_domain] += visits\n i += 1\n end\n end\n\n result_hsh.each do |k, v|\n result << v.to_s + ' ' + k\n end\n\n result\nend", "def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end", "def hash\n [rel, href].hash\n end", "def analyze_session session\n analyze session do |action|\n if action[\"_type\"] == \"page_load\"\n pageurl = action[\"pageurl\"]\n if !(pageurl =~ /^http\\:\\/\\/www2\\.hulu\\.jp\\/(\\?.*)?$/).nil?\n @pv_count += 1\n @pv_count_details[pageurl] ||= 0\n @pv_count_details[pageurl] += 1\n end\n end\n end\n end", "def hash\n [concatenated_path_down_count, administratively_down_count, no_diagnostic_count, path_down_count, reverse_concatenated_path_down_count, neighbor_signaled_session_down_count, control_detection_time_expired_count, echo_function_failed_count, forwarding_plane_reset_count].hash\n end", "def compute_frequencies\n @transitions.map { |value, transition_hash|\n sum = 0.0\n transition_hash.each { |succ_value, occurencies| \n sum += occurencies\n }\n \n transition_hash.each { |succ_value, occurencies|\n @frequencies[value] ||= Hash.new{0}\n @frequencies[value][succ_value] = occurencies/sum \n }\n }\n end", "def calcule_nombre_pages\n @pages_count ||= Hash.new\n @pages_count.merge!({\n signes: (length / NUMBER_SIGNES_PER_PAGE) + 1,\n mots: (mots.count / NUMBER_MOTS_PER_PAGE) + 1\n })\n @pages_count.merge!(moy: (@pages_count[:signes] + @pages_count[:mots]) / 2)\n end", "def initialize(url) #pass in the url...cnn\n @url = url #saving the url in n instance variable \n #this is how you create a default value for a hash\n @histogram = Hash.new(0) #taking histogram and creating a hash but setting default values at 0. we're going to be couting words so default should be zero\n\n parse #parse is a method (def below)\n\n #this is how you sort a hash!!!!\n words.each{|w| @histogram[w.downcase] +=1 } #creating the histogram \"for each word..grab each word one at a time- take the histogram and make all the words lowercase. +=1 means add words/couting for all the words that are the same. so we'll have all the words and all the counts\"\n @histogram = @histogram.sort_by {|key, value| value}.reverse #take the histogram and sort it by value. does this in ascending order. .reverse puts it in descending order\n end", "def count_hash(arr)\n count = {}\n arr.each {|e|\n count[e] ||= 0\n count[e] += 1\n }\n count\n end", "def frequency\n counts = Hash.new(0)\n self.words.each { |word| counts[word] += 1 }\n counts\n end", "def histo_counts\n @histo_counts ||= calculate_histo_counts\n end", "def hash_letter_freq( array )\n\n i = 0 # keeps track of outter loop\n hash = Hash.new()\n\n while( array.length > i )\n\n count = 1\n\n i2 = 1 + i # keeps track of inner while loop\n\n while( array.length > i2 ) # this will never check the last element of the array - otherwise have i2 check itself by doing i2 = i\n\n # puts(\"i #{i} | i2 #{i2}\") -- check if iteration is made right\n\n if( array[i] == array[i2] )\n count += 1\n end\n\n i2 += 1\n end # inner - while\n\n # alternative cond: hash.has_key?(\"#{array[i]}\") http://ruby-doc.org/core-1.9.3/Hash.html#method-i-has_key-3F\n if( hash[\"#{array[i]}\"] == nil ) # checks if key exists\n hash[\"#{array[i]}\"] = count\n end\n\n # for the last element in the array -- skipped by i2\n if( i2 == array.length )\n if( hash[\"#{array[i]}\"] == nil )\n hash[\"#{array[i]}\"] = 1\n end\n end\n\n\n i += 1\n end # while -outter\n\n # puts( hash )\n return hash\n\nend", "def hash()\n #This is a stub, used for indexing\n end", "def hash\n 0\n end", "def generate_hash(input)\n @freq = analyze_raw(input)\n # Reduce returning unnecessarily large hash be stripping away frequencies < min\n @freq.delete_if {|key, value| value < @@MinWordFrequency}\n end", "def calculate_clicks_by_domain(counts)\n all_domains_counter = {}\n\n counts.each do |csv_string|\n click_count = csv_string.split(\",\").first.to_i\n initial_domain_string = csv_string.split(\",\").last\n all_subdomains = break_domain_string_by_elements(initial_domain_string)\n all_subdomains.each do |domain|\n all_domains_counter[domain] ? all_domains_counter[domain] += click_count : all_domains_counter[domain] = click_count\n end\n end\n\n all_domains_counter.map { |domain, click| [click, domain] }.sort_by { |group| group[0] }.reverse\nend", "def hash(*) end", "def summarise()\n summary = Hash.new\n page_count = 0\n\n @nodes.each {|node|\n if summary.include?(node['content_type'])\n summary[node['content_type']] += 1\n else\n summary[node['content_type']] = 1\n end\n }\n\n summary.keys.sort.each {|node_type|\n count = summary[node_type].to_i\n page_count += count\n puts \"%-50s: %s\" % [node_type, count]\n }\n\n puts \"%-50s: %s\" % ['Total pages:', page_count]\n puts \"See output CSV in #{csv_output_path}\"\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def cache_score(data)\n data['freq'] += 1\n if data['freq'] > 10\n data['freq'] = 10\n end\n freq = data['freq']\n byte_size = data['byte_size']\n byte_size /= Float($max_page_size)\n time = data['time']\n time_diff = Float(time - $start_time) / $start_time\n freq /= 10.0\n return freq * time_diff / byte_size\nend", "def photos_count(info_count)\n x = info_count.inject(Hash.new(0)) { |h, e| h[e] += 1 ; h }\nend", "def get_word_freq\n speech_links = get_links_to_speeches\n word_freq = Hash.new(0)\n \n speech_links.each do |link|\n speech_page = link.click\n if (speech_obj = speech_page.at SPEECH_DIV_IDENTIFIER)\n speech = speech_obj.text\n words = speech.split(' ')\n words.each{ |word| word_freq[clean_str(word)] += 1 }\n end\n end\n\n word_freq.sort_by{ |x,y| y }.reverse\n end", "def freq_list\n freq_hash = each_with_object(Hash.new(0)) { |v, h| h[v] += 1 }\n freq_hash.sort_by { |k, v| -v }\n end", "def string_frequency(string, hash)\n string.each_char do |char|\n hash[char]+=1\n end\n return hash\n end", "def sorted_pages\n sorted_array.map { |x| x.join(' ') }.join(' visits ')\n end", "def element_frequency_count\n collection.each_with_object(Hash.new(0)) {|element, occurrence| occurrence[element] += 1}\n end", "def word_frequency(words)\n frequencies = Hash.new(0)\n words.each do |word|\n frequencies[word] += 1\n end\n frequencies\nend", "def count_freq(array)\n array.each_with_object(Hash.new(0)) { |obj, counts| counts[obj] += 1 }\n end", "def duplicate_count(text)\n duplicates = text.downcase.scan(/[a-z0-9]/)\n d2 = Hash.new(0)\n duplicates.each { |i| d2.store(i, d2[i] + 1) }\n d2.select { |k,v| v > 1 }.count\nend", "def element_count(arr)\n hash = {} \n\n # debugger \n arr.each {|ele| hash[ele] = arr.count(ele) }\n\n hash \nend", "def count(r)\n c = Hash.new(0)\n r.each { |z| c[z] += 1}\n c\nend", "def uniq_views\n p 'Sites with most unique views: '\n @content.sort_by { |address| address[1].uniq.count }.reverse.each do |values|\n @output << \"#{values.first} #{values.last.uniq.count} unique views\"\n end\n end", "def analyze_session session\n @total_landings += 1\n unless session[0][\"_type\"] == \"page_load\"\n return\n end\n url = session[0][\"pageurl\"]\n if url =~ /www2.hulu.jp\\/watch\\//\n return\n end\n url = remove_parameter url\n @conversion_landing_counter[url] ||= 0\n @landing_counter[url] ||= 0\n @landing_counter[url] += 1\n analyze session do |action|\n if conversion? action\n @total_conversions += 1\n @conversion_landing_counter[url] += 1\n return\n end\n end\n end", "def count_occurrences(array)\n \n count_hash = {}\n \n array.map(&:downcase!)\n \n array.uniq.each do |ele|\n count_hash[ele] = 0\n end\n \n array.each do |ele|\n count_hash[ele] += 1\n end\n \n puts count_hash\nend", "def num_clicks\n count = 0\n self.visits.each { |user| count += user.visits }\n count\n end", "def to_s\n return 'No Results' if page_count.all? { |_key, count| count.empty? }\n\n output = []\n page_count.each_pair do |type, counts|\n output << type\n sorted(counts).each do |path, count|\n output << \"#{path} #{count} visit#{'s' if count.zero? || count > 1}\"\n end\n end\n output.join(\"\\n\")\n end", "def visit_counter\n\t\t\t@all = Session.all\n\t\t\t@online_users = []\n\t\t\t@online_guess_count = 0\n\t\t\t@day_count = 0\n\t\t\t@week_count = 0\n\t\t\t@month_count = 0\n\t\t\t@year_count = 0\n\t\t\t@in_day_users = []\n\n\t\t\[email protected] do |s|\n\t\t\t\tif s.updated_at > 15.minutes.ago\n\t\t\t\t\tif s.data['user_id'].present?\n\t\t\t\t\t\t@online_users << s.data['user_id']\n\t\t\t\t\telse\n\t\t\t\t\t\t@online_guess_count += 1\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif s.updated_at.year == Date.current.year\n\t\t\t\t\t@year_count += 1\n\t\t\t\t\tif s.updated_at.month == Date.current.month\n\t\t\t\t\t\t@month_count += 1\n\t\t\t\t\t\tif s.updated_at.day >= Date.current.at_beginning_of_week.day\n\t\t\t\t\t\t\t@week_count += 1\n\t\t\t\t\t\t\tif s.updated_at.day == Date.current.day\n\t\t\t\t\t\t\t\t@day_count += 1\n\t\t\t\t\t\t\t\tif s.data['user_id'].present?\n\t\t\t\t\t\t\t\t\t@in_day_users << s.data['user_id']\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@online_users = User.where id: @online_users.uniq, is_online: true\n\t\t\t@in_day_users = User.find @in_day_users.uniq\n\n\t\t\trender layout: 'layout_back'\n\t\tend", "def my_uniq(arr)\n #make hash with each item in teh array as a key, and the value will be its frequency\n new_arr = []\n freqhash = Hash.new(0)\n arr.each do |ele| \n freqhash[ele] += 1\n end\n \n freqhash.each do |k, v| \n new_arr << k\n end\n \n new_arr\nend", "def frequency\n # normal string which has assigned all the alphabets\n name = 'abcdefghijklmnopqrstuvwxyz'\n # this line will first split 'name' string and then assign it to hash\n @letters = name.split('').reduce(@letters){|alphabet,count| alphabet[count] +=0; alphabet}\n # this will convert all the alphabets of 'str' to lower case\n @str = @str.downcase\n # this will remove special characters from the string and only allow lower case alphabets\n @str = @str.gsub(/[^a-z]/, '')\n # this will split the 'str' and assign the letters to hash and add 1 each time the letter appeared\n @letters = @str.split('').reduce(@letters){|alphabet,count| alphabet[count] +=1; alphabet}\n\n end", "def hash_url(url)\n Digest::SHA1.hexdigest \"#{@profile_id}-#{url}\"\n end", "def record_visit\n unless (visit_key = cookies[:id])\n visit_key = SecureRandom.urlsafe_base64(16)\n cookies.permanent[:id] = visit_key\n end\n VisitCounter.record(visit_key)\n end", "def sort_by_occurrence_h(input)\n output = input.each_with_object(Hash.new(0)){ |tag, counts| counts[tag] += 1 }\n output = Hash[output.sort_by{ |tags, counts| counts}.reverse]\n return output\n end" ]
[ "0.76156753", "0.7477628", "0.7345562", "0.7314882", "0.72767776", "0.69916", "0.6907622", "0.66866446", "0.66371316", "0.63823867", "0.62839025", "0.6170911", "0.6140501", "0.61292213", "0.60885084", "0.6034281", "0.60309714", "0.6014932", "0.6014932", "0.6014932", "0.5990967", "0.59625244", "0.5946958", "0.5932624", "0.5932624", "0.5932624", "0.5932624", "0.5932624", "0.5932624", "0.5932624", "0.5929565", "0.5902113", "0.5899683", "0.588081", "0.5867876", "0.58620775", "0.5832554", "0.58156866", "0.58138204", "0.5807325", "0.58040446", "0.5800674", "0.5799507", "0.57901245", "0.5789503", "0.5758055", "0.5753003", "0.57473385", "0.5744053", "0.57114226", "0.56907254", "0.5689733", "0.56877416", "0.56641126", "0.5663779", "0.56561965", "0.5641662", "0.5638364", "0.56321496", "0.5619828", "0.561518", "0.5607305", "0.5606365", "0.56043494", "0.5598958", "0.55950403", "0.55942494", "0.55896187", "0.55896187", "0.55896187", "0.55896187", "0.55896187", "0.55896187", "0.55896187", "0.55896187", "0.55896187", "0.55896187", "0.5584249", "0.5582767", "0.5564824", "0.55609083", "0.55573565", "0.5555159", "0.5542699", "0.554026", "0.55392796", "0.5513203", "0.55130756", "0.5501584", "0.54865474", "0.54842776", "0.5483799", "0.5480399", "0.5480225", "0.5472962", "0.5467003", "0.54637563", "0.546176", "0.54498464", "0.5448678" ]
0.6514058
9
update relationship (keep the record)
def updatestatus # other user @relationship = Relationship.find(params[:id]) status = params[:relationship][:status] # create relationship if current_user.id == @relationship.follower_id @relationship.status = status @relationship.save @user = User.find(@relationship.followed_id) if status == "FOLLOWING" || status == "REQUEST" @user.update_attributes!(:notify => "YES") end respond_to do |format| format.html # index.html.erb format.json { render :json=> { :user=>@user.as_json(:only => [:id, :name, :tender, :invitation_token, :notify, :privateprofile], :methods => [:photo_url], :include => { :drinks => { :only => [:id, :name] }, :workvenues => { :only => [:id, :fs_venue_id, :name] } } ) } } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(attrs)\n @attrs.update(attrs[:relationship]) unless attrs[:relationship].nil?\n self\n end", "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs[:relationship]) unless attrs[:relationship].nil?\n self\n end", "def update!(**args)\n @relation = args[:relation] if args.key?(:relation)\n end", "def update(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.reject {|key, value| key == 'id'}.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.class.rpc_execute('write', self.id, vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end", "def update(related, parent, options)\n parent.send(\"#{options.foreign_key}=\", related.id); related\n end", "def update!(**args)\n @relation_descriptor = args[:relation_descriptor] if args.key?(:relation_descriptor)\n end", "def update_from_relation(field_name, related = Ladder::Config.settings[:with_relations])\n objects = send(field_name).to_a\n\n if related || embedded_relations[field_name]\n # Force autosave of related documents to ensure correct serialization\n methods.select { |i| i[/autosave_documents/] }.each { |m| send m }\n\n # update inverse relation properties\n relation = relations[field_name]\n objects.each { |object| object.resource.set_value(relation.inverse, rdf_subject) } if relation.inverse\n objects.map(&:update_resource)\n else\n # remove inverse relation properties\n objects.each { |object| resource.delete [object.rdf_subject] }\n objects.map(&:rdf_subject)\n end\n end", "def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end", "def update\n @relationship = Relationship.find(params[:id])\n @relationship.update_attributes(params[:relationship])\n @relationships = Relationship.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n end", "def update!(**args)\n @has_referenced_entity_at_creation = args[:has_referenced_entity_at_creation] if args.key?(:has_referenced_entity_at_creation)\n @record_id = args[:record_id] if args.key?(:record_id)\n end", "def update!(**args)\n @annotated_relationship = args[:annotated_relationship] if args.key?(:annotated_relationship)\n @annotations = args[:annotations] if args.key?(:annotations)\n @collections = args[:collections] if args.key?(:collections)\n @entity_join = args[:entity_join] if args.key?(:entity_join)\n @id = args[:id] if args.key?(:id)\n @mrf = args[:mrf] if args.key?(:mrf)\n end", "def update_foreign_keys_to_point_another_translation record\n record.without_current_locale do\n associated = record.send(name)\n associated.update_all({foreign_key => record.translations.first.id})\n end\n end", "def update!\n self.save\n end", "def update!(**args)\n @relation = args[:relation] if args.key?(:relation)\n @source = args[:source] if args.key?(:source)\n @target = args[:target] if args.key?(:target)\n end", "def update_relation(field_name, *obj)\n # Should be an Array of RDF::Term objects\n return unless obj\n\n obj.map! { |item| item.is_a?(RDF::URI) ? Ladder::Resource.from_uri(item) : item }\n relation = send(field_name)\n\n if Mongoid::Relations::Targets::Enumerable == relation.class\n obj.map { |item| relation.send(:push, item) unless relation.include? item }\n else\n send(\"#{field_name}=\", obj.size > 1 ? obj : obj.first)\n end\n end", "def update_partner\n\t\tpartner.update(partner_id: self.id) if partner\n\tend", "def save\n if self.changed? || self.relationships_changed?\n self._version = current_version + 1\n super\n revise\n end\n end", "def update(object, *names)\n key_name = attributes.key[0].name\n key_value = object.public_send(key_name)\n tuple = dump(object)\n fields = names.map { |name| attributes[name].field }\n relation.update({ key_name => key_value }, tuple.reject { |k, _| !fields.include?(k) })\n end", "def save_related\n if self.links.present?\n self.links.each do | link |\n link.parent_type = :action_item\n link.parent_key = self.key\n link.save!\n end\n end\n end", "def set_relationship\n #find relationship\n @relationship = Relationship.find_by_id(params[:id])\n end", "def update\n begin\n @resource = Relation.find params[:id]\n @resource.update_attributes!(params[:relation])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def add_relationship(rel_attr); end", "def after_update\n super\n touch_associations\n end", "def affect_relation_values!\n Relations.new(@klass).affect_relation_values!\n end", "def update(...)\n assign_attributes(...)\n save\n end", "def save\n CONNECTION.execute(\"UPDATE links SET link = '#{self.link}', relative_assignment = '#{self.relative_assignment}' WHERE id = #{self.id};\")\n end", "def update_relation(plan, m_from, op, m_to, m_rel, m_info = nil)\n\t\tif plan\n\t\t Roby::Distributed.update(peer.local_object(plan)) { update_relation(nil, m_from, op, m_to, m_rel, m_info) }\n\t\telse\n\t\t from, to = \n\t\t\tpeer.local_object(m_from, false), \n\t\t\tpeer.local_object(m_to, false)\n\n\t\t if !from\n\t\t\treturn unless to && (to.self_owned? || to.subscribed?)\n\t\t\tfrom = peer.local_object(m_from)\n\t\t elsif !to\n\t\t\treturn unless from && (from.self_owned? || from.subscribed?)\n\t\t\tto = peer.local_object(m_to)\n\t\t end\n\n\t\t rel = peer.local_object(m_rel)\n\t\t Roby::Distributed.update_all([from.root_object, to.root_object]) do\n\t\t\tif op == :add_child_object\n\t\t\t from.add_child_object(to, rel, peer.local_object(m_info))\n\t\t\telsif op == :remove_child_object\n\t\t\t from.remove_child_object(to, rel)\n\t\t\tend\n\t\t end\n\t\tend\n\t\tnil\n\t end", "def update_and_delete user\n self.parents.each do |parent|\n parent.update_and_save\n end\n self.delete user\n end", "def update_relations\n # relational saves require an id\n return false unless @id.present?\n # verify we have relational changes before we do work.\n return true unless relation_changes?\n raise \"Unable to update relations for a new object.\" if new?\n # get all the relational changes (both additions and removals)\n additions, removals = relation_change_operations\n\n responses = []\n # Send parallel Parse requests for each of the items to update.\n # since we will have multiple responses, we will track it in array\n [removals, additions].threaded_each do |ops|\n next if ops.empty? #if no operations to be performed, then we are done\n responses << client.update_object(parse_class, @id, ops, session_token: _session_token)\n end\n # check if any of them ended up in error\n has_error = responses.any? { |response| response.error? }\n # if everything was ok, find the last response to be returned and update\n #their fields in case beforeSave made any changes.\n unless has_error || responses.empty?\n result = responses.last.result #last result to come back\n set_attributes!(result)\n end #unless\n has_error == false\n end", "def update_child(item)\n backing_record = item.backing_record\n # HMT TODO: The following && !association.through_association was commented out, causing wrong class items to be added to\n # associations\n # Why was it commented out.\n if backing_record && @owner && @association && item.attributes[@association.inverse_of] != @owner && [email protected]_association?\n inverse_of = @association.inverse_of\n current_association_value = item.attributes[inverse_of]\n backing_record.virgin = false unless backing_record.data_loading?\n # next line was commented out and following line was active.\n backing_record.update_belongs_to(inverse_of, @owner)\n #backing_record.set_belongs_to_via_has_many(@association, @owner)\n # following is handled by update_belongs_to and is redundant\n # unless current_association_value.nil? # might be a dummy value which responds to nil\n # current_association = @association.inverse.inverse(current_association_value)\n # current_association_attribute = current_association.attribute\n # if current_association.collection? && current_association_value.attributes[current_association_attribute]\n # current_association.attributes[current_association_attribute].delete(item)\n # end\n # end\n @owner.backing_record.sync_has_many(@association.attribute)\n end\n end", "def update!(**args)\n @agency_associations = args[:agency_associations] if args.key?(:agency_associations)\n end", "def update!(**args)\n @attribute_id = args[:attribute_id] if args.key?(:attribute_id)\n @entity_relationship = args[:entity_relationship] if args.key?(:entity_relationship)\n @freebase_mid = args[:freebase_mid] if args.key?(:freebase_mid)\n @personal_entity_child = args[:personal_entity_child] if args.key?(:personal_entity_child)\n end", "def update_relationship_dates\n return true if self.is_a? Relationship\n\n relationships.each do |ass|\n ass.date = self.date\n ass.save\n end\n end", "def update\n relationship = Relationships.find(params[:id])\n if relationship.update(relationship_params)\n render json: relationship, status: 200\n else\n render json: { errors: relationship.errors }, status: 422\n end\n end", "def update!(**args)\n @mid_list = args[:mid_list] if args.key?(:mid_list)\n @relation = args[:relation] if args.key?(:relation)\n end", "def update!(**args)\n @place_id = args[:place_id] if args.key?(:place_id)\n @relation_type = args[:relation_type] if args.key?(:relation_type)\n end", "def save(*)\n update_magic_properties\n clear_association_cache\n create_or_update\n end", "def update!(**args)\n @related_feature_index = args[:related_feature_index] if args.key?(:related_feature_index)\n @relation_type = args[:relation_type] if args.key?(:relation_type)\n end", "def update!(**args)\n @related_feature_index = args[:related_feature_index] if args.key?(:related_feature_index)\n @relation_type = args[:relation_type] if args.key?(:relation_type)\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def update(options = {})\n run_callbacks :update do\n run_callbacks :save do\n # Check if record can be updated\n raise \"Cannot save a destroyed document!\" if destroyed?\n raise \"Calling #{self.class.name}#update on document that has not been created!\" if new?\n \n # Check if we can continue\n return false unless perform_validations(options)\n \n # perform update\n result = connection.update_relationship(self.id, self._to_database_hash)\n \n # if something goes wrong we receive a nil value and return false\n !result.nil?\n end\n end\n end", "def update_and_save\n self.last_update = Time.now\n self.save!\n\n self.parents.each do |parent|\n parent.update_and_save\n end\n end", "def relationship_set_property id, name, value\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n\n put_request 'relationship/' + id + '/properties/' + name, value, headers\n end", "def replace_to_one_relationship(source_record:, new_related_record:, relationship_type:)\n relationship_method = \"replace_#{relationship_type}?\"\n authorize_relationship_operation(\n source_record: source_record,\n relationship_method: relationship_method,\n related_record_or_records: new_related_record\n )\n end", "def update\n @event, @guest = Event.find(params[:event_id]), Guest.find(params[:id])\n @plusone = @guest.plusones[0]\n @rel_manager = RelationshipManager.new(@guest, @event, params[:guest][:relationship])\n @rel_manager.check_for_custom_relationship\n @g_p_mgr = GuestAndPlusoneManager.new(@guest, @plusone, @event)\n to_do = @g_p_mgr.edit_guest(guest_params, plusone_params)\n if !to_do.nil?\n redirect_to @event\n else\n @errors = @event.errors.full_messages\n @relationships = @event.relationships\n @plusone = Plusone.new if @plusone.nil?\n render action: 'edit'\n end\n end", "def update\n record.assign_attributes(data)\n record.save! if record.changed?\n end", "def relationship=(value)\n @relationship = value\n end", "def persist_collection_relationships(record)\n record.class.reflect_on_all_associations\n .select { |ref| ref.collection? && !ref.through_reflection && record.association(ref.name).any? }\n .map do |ref|\n [\n ref.has_inverse? ? ref.inverse_of.name : ref.options[:as],\n record.association(ref.name).target\n ]\n end\n .to_h.each do |name, targets|\n targets.each { |t| t.update name => record }\n end\n end", "def association_changed(record)\n\t\ttouch if persisted?\n\tend", "def replace_related_type(old, new)\n $db.execute \"UPDATE destination.series_relationships SET type = ? WHERE type = ?\", new, old;\nend", "def update\n\n end", "def put_relation(args)\n\tapi_url = \"#{@base_url}/#{args[:coll_A]}/#{args[:key_A]}/relation/\" +\n\t \"#{args[:relation]}/#{args[:coll_B]}/#{key_B}\"\n\tputs do_the_put_call( url: api_url, user: @user, json: '{}')\nend", "def save\n CONNECTION.execute(\"UPDATE links SET assignment_id = '#{self.assignment_id}', link = '#{self.link}', type = '#{self.type}', WHERE id = #{self.id};\")\n end", "def update\n @relationship = @character.relationships.find_by_permalink!(params[:id])\n\n respond_to do |format|\n if @relationship.update_attributes(params[:relationship])\n format.html { redirect_to([@character,@relationship], :notice => 'Relationship was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @relationship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @relationship = Relationship.find(params[:id])\n begin\n save_result = @relationship.update_attributes(params[:relationship])\n rescue Exception => e\n set_errors(e)\n save_result = false\n end\n respond_to do |format|\n if save_result\n flash[:notice] = 'Relationship was successfully updated.'\n format.html { redirect_to(@relationship) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @relationship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def detach_relationship(data) #FIXME: Method doesn't work, RelationshipManager cannot access to id attribute.\n return @client.raw(\"post\", \"/config/relationships/detach\", nil, data)\n end", "def update_many_relation(rel, identifier, candidates)\n existing_relations = eval(\"self.#{rel}\")\n existing_ids = existing_relations.map {| trel | eval(\"trel.#{identifier}\")}.compact\n new_ids = candidates-existing_ids\n deleted_ids = existing_ids - candidates\n new_ids.each do | val |\n eval(\"#{rel}.create(#{identifier}: '#{val}')\")\n end\n deleted_ids.each do | val |\n eval( \"#{rel}.where(#{identifier}: '#{val}')[0].destroy\" )\n end\n end", "def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil)\n path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'\n .gsub('{databaseId}', database_id)\n .gsub('{collectionId}', collection_id)\n .gsub('{key}', key)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if collection_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"collectionId\"')\n end\n\n if key.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"key\"')\n end\n\n params = {\n onDelete: on_delete,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::AttributeRelationship\n )\n end", "def relationship_set_props id, data\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n 'Content-Type' => 'application/json',\n }\n\n put_request 'relationship/' + id + '/properties', data, headers\n end", "def update\n @dependent_relationship = DependentRelationship.find(params[:id])\n\n respond_to do |format|\n if @dependent_relationship.update_attributes(params[:dependent_relationship])\n format.html { redirect_to @dependent_relationship, notice: 'Dependent relationship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dependent_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def set(source, target)\n assert_kind_of 'source', source, source_model\n assert_kind_of 'target', target, target_model, NilClass\n\n @relationship.set(source, [ target ].compact)\n target\n end", "def update_frbr_for_expression_work_relationship(login)\n RelationshipHelper.delete_all_frbr_relationships(:expression, self.expression_id, :is_realisation_of) \n raise if !RelationshipHelper.add_frbr_relationship(:expression, self.expression_id, :is_realisation_of, \n :work, self.work.work_id, login )\n end", "def update_graph\n connection.execute <<-EOS\n UPDATE #{oqgraph_table_name} \n SET origid = #{self.send(self.class.from_key)}, \n destid = #{self.send(self.class.to_key)}, \n weight = #{self.send(self.class.weight_column)} \n WHERE origid = #{self.send(self.class.from_key + '_was')} AND destid = #{self.send(self.class.to_key + '_was')};\n EOS\n end", "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end", "def relate base, name, metadata\n base.relations_sleeping_king_studios.update metadata.relation_key => metadata\n end", "def update(target, document, options)\n document.send(\"#{options.foreign_key}=\", target ? target.id : nil)\n instantiate(document, options, target)\n end", "def update_links\n return if self.suppress_recreate_trigger == true\n \n marc_foreign_objects = Hash.new\n \n # All the allowed relation types *must* be in this array or they will be dropped\n allowed_relations = [\"people\", \"standard_titles\", \"standard_terms\", \"institutions\", \"catalogues\", \"liturgical_feasts\", \"places\"]\n \n # Group all the foreign associations by class, get_all_foreign_associations will just return\n # a flat list of objects\n marc.get_all_foreign_associations.each do |object_id, object|\n next if object.is_a? Source\n \n foreign_class = object.class.name.pluralize.underscore\n marc_foreign_objects[foreign_class] = [] if !marc_foreign_objects.include? (foreign_class)\n \n marc_foreign_objects[foreign_class] << object\n \n end\n \n # allowed_relations explicitly needs to contain the classes we will repond to\n # Log if in the Marc there are \"unknown\" classes, should never happen\n unknown_classes = marc_foreign_objects.keys - allowed_relations\n # If there are unknown classes purge them\n related_classes = marc_foreign_objects.keys - unknown_classes\n \n if !unknown_classes.empty?\n puts \"Tried to relate with the following unknown classes: #{unknown_classes.join(',')}\"\n end\n \n related_classes.each do |foreign_class|\n relation = self.send(foreign_class)\n \n # The foreign class array holds the correct number of object\n # We want to delete or add only the difference betweend\n # what is in marc and what is in the DB relations\n new_items = marc_foreign_objects[foreign_class] - relation.to_a\n remove_items = relation.to_a - marc_foreign_objects[foreign_class]\n \n # Delete or add to the DB relation\n relation.delete(remove_items)\n relation << new_items\n\n # If this item was manipulated, update also the src count\n # Unless the suppress_update_count is set\n if !self.suppress_update_count_trigger\n (new_items + remove_items).each do |o|\n o.update_attribute( :src_count, o.sources.count )\n end\n end\n \n end\n \n # update the parent manuscript when having 773/772 relationships\n update_77x unless self.suppress_update_77x_trigger == true \n end", "def update\n\t\t\n\t\tend", "def update\r\n end", "def nullify\n criteria.update_all(foreign_key => nil)\n _target.clear do |doc|\n unbind_one(doc)\n doc.changed_attributes.delete(foreign_key)\n end\n end", "def update!(**args)\n @remodeling_id = args[:remodeling_id] if args.key?(:remodeling_id)\n end", "def update\n \n end", "def update!(**args)\n @count = args[:count] if args.key?(:count)\n @inverse = args[:inverse] if args.key?(:inverse)\n @relation_id = args[:relation_id] if args.key?(:relation_id)\n @relation_identifier = args[:relation_identifier] if args.key?(:relation_identifier)\n @score = args[:score] if args.key?(:score)\n @target_id = args[:target_id] if args.key?(:target_id)\n @target_identifier = args[:target_identifier] if args.key?(:target_identifier)\n @target_name = args[:target_name] if args.key?(:target_name)\n @type = args[:type] if args.key?(:type)\n end", "def update\n update_medium\n end", "def save\n update({})\n end", "def update(model_data)\n end", "def update\n @relationship = Relationship.find(params[:id])\n\n respond_to do |format|\n if @relationship.update_attributes(params[:relationship])\n format.html { redirect_to @relationship, notice: 'Relationship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dirty = true\n end", "def update(entity)\n return unless entity\n return unless entity.id\n\n address = Core::Dal::Address.find(entity.id)\n return unless address\n\n address.update(entity.to_json)\n address.save!\n entity.id\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end" ]
[ "0.7292227", "0.71883357", "0.7148545", "0.7010047", "0.6958773", "0.67847145", "0.67368144", "0.6595965", "0.64890707", "0.63468003", "0.62852514", "0.62825483", "0.6273581", "0.6271799", "0.6225059", "0.62232465", "0.6221497", "0.6198202", "0.6186048", "0.6179714", "0.6167551", "0.6152301", "0.6147323", "0.61444205", "0.61351824", "0.6122895", "0.6085454", "0.606305", "0.603902", "0.60298836", "0.60188794", "0.5994309", "0.5993759", "0.59896207", "0.5969323", "0.5965566", "0.5957594", "0.59486496", "0.59486496", "0.59444237", "0.59444237", "0.59444237", "0.59444237", "0.59444237", "0.59444237", "0.59444237", "0.59444237", "0.59444237", "0.5937644", "0.5937028", "0.59242404", "0.5913858", "0.5911179", "0.59035915", "0.59006464", "0.58889204", "0.58745563", "0.5859098", "0.58590657", "0.5856878", "0.5839572", "0.5838676", "0.5832736", "0.5817896", "0.58057547", "0.5802889", "0.57942665", "0.57937294", "0.57867205", "0.5759026", "0.5744204", "0.5728978", "0.5723942", "0.57234496", "0.5711609", "0.5703212", "0.56861866", "0.56823653", "0.5678129", "0.5668721", "0.56659913", "0.5663892", "0.56604326", "0.5658778", "0.56563944", "0.56492704", "0.56491506", "0.5647976", "0.5647976", "0.5647976", "0.5647976", "0.5647976", "0.5647976", "0.5647976", "0.5647976", "0.5647976", "0.5647976", "0.5647976", "0.5647976", "0.5647976", "0.5647976" ]
0.0
-1
p calculate_total_1(31.99, 0.15, 0.08) p calculate_total_1(0.15, 0.08, 31.99)
def calculate_total_2(info) tip_amt = info[:price] * info[:tip] tax_amt = info[:price] * info[:tax] info[:price] + tip_amt + tax_amt end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_t1(price, tip, tax)\n tax_amount = price * tax\n tip_amount = price * tip\n price + tip_amount + tax_amount\nend", "def calc_total\n (@total_after_tax * @gratuity) + @total_after_tax\n end", "def calc_return(total, pool, commission)\n if pool == 0\n return 0\n elsif total == 0\n return ( pool - (pool*commission) ) \n else\n return ( pool - (pool*commission) ) / total.to_f\n end\n end", "def calculate_total(bill, percentage)\n tip = sprintf('%.2f', (bill * (percentage * 0.01)).round(2))\n total = sprintf('%.2f', (bill + tip.to_f).round(2))\n puts \"The tip is $#{tip}.\" \n puts \"The total is $#{total}\"\nend", "def total(num1, num2)\n num1 + num2\nend", "def calculate_total_2(info) # info is a hash with expected arguments\n taxAmt = info[:price] * info[:tax]\n tipAmt = info[:price] * info[:tip]\n info[:price] + tipAmt + taxAmt\nend", "def total\n apply_rules(subtotal).round\n end", "def total\n '%.2f' % calculate_total\n end", "def solve(meal_cost, tip_percent, tax_percent)\n total = meal_cost + (meal_cost * tip_percent)/100 + (meal_cost * tax_percent)/100\n puts total.round() \nend", "def total(a,b)\r\n return (a+b)\r\nend", "def calc_percent(n, total)\n (n.to_f/total.to_f) * 100.0\nend", "def after_calculate_total(total, _test_digits)\n return total\n end", "def full_price_total(count)\n count * unit_price\n end", "def calcular_total\n\t\treturn calcular_seguro*calcular_incremento\n\tend", "def calculate\n y = 0\n x = 0.1\n while x % 1 != 0\n x = (@price.to_f - @stamp1.to_f * y) / @stamp2.to_f\n y += 1\n end\n y -= 1\n @stamp1 = y.round(0).to_s # 3 cent stamps\n @stamp2 = x.round(0).to_s # 5 cent stamps\n end", "def total_fee\n fee + fee2 + fee3 + fee4\n end", "def solve(meal_cost, tip_percent, tax_percent)\n\n result = meal_cost * (1 + tip_percent.to_f / 100 + tax_percent.to_f / 100)\n puts result.round()\n \nend", "def dollar_total\n total / 100.0\n end", "def compute_total_value\n @value= @net_price * @count\n end", "def calculate_total\n self.total = total_money(total_gross)\n end", "def total\n price - original_value\n end", "def total\n price - original_value\n end", "def compute_total(total)\n if discount.eq?('percent')\n percent_value = amount.to_f / 100\n total = total - (total * percent_value)\n else\n total = total - amount\n (total < 0) ? 0 : total \n end \n end", "def tip_and_total(bill, tip)\n total_tip = bill.to_f * (tip.to_f / 100)\n puts \"the tip (at #{tip}%) will be: #{total_tip.round(2)}\"\n \n puts \"your total bill will be: #{(bill + total_tip).round(2)}\"\nend", "def second_payment_sum\n total_sum - first_payment_sum\n end", "def obvious_total(subtotal:, tax:, discount:)\r\n subtotal + tax - discount\r\nend", "def compute_total_and_print()\n @total_price=0\n $final_price_list.each do |element| \n @total_price = @total_price + element\n end\n @total_sales_tax=0\n $sales_tax_list.each do |element|\n @total_sales_tax = @total_sales_tax + element\n end\n puts \"Sales Tax : #{@total_sales_tax.round(2)}\"\n puts \"Total : #{@total_price.round(2)}\"\nend", "def tip_calc(bill, tip)\n tip_and_total = []\n tip_and_total << (tip/100) * bill\n tip_and_total << (tip_and_total[0] + bill)\nend", "def total\n conv_price_single * conv_quantity\n end", "def generate_total(list)\n list.inject(:+).round(2)\n end", "def call(items, total)\n total >= @min_value ? total.mult(BigDecimal.new(100).sub(@percentage, 4), 4).div(BigDecimal.new(100), 4) : total\n end", "def calculate_sum\n 1000000000000\n end", "def calculation\n end", "def total\n (amount + fee) if amount\n end", "def calc_total_potential_income_chp(val1= calc_potential_income_heat, val2= calc_potential_income_elec)\n\t\tval1 + val2\n\tend", "def total(numbers)\n numbers.reduce(:+)\nend", "def total; end", "def total(num1, num2)\n puts num1 + num2\nend", "def pretotal\n total\n end", "def calcTaxes price\r\n taxrate = 0.95\r\n return taxrate * price\r\nend", "def compute_total(type)\n list = capture_amounts(type)\n generate_total(list)\n end", "def total(numbers)\n return numbers.reduce(:+)\nend", "def total(prices)\n amount = 0\n prices.each do |price|\n amount += price\n end\n amount\nend", "def total(array1)\n sum=0.0\n array1.each do|i|\n sum+=i\n end\n return sum\n end", "def percentage(percent, total)\n percent.to_f / total * 100\nend", "def calculate\n product.taxes&.map { |tax| tax_portion(tax) }.sum.to_f || 0\n end", "def total\n subtotal\n # + tax\n end", "def sub_total\n # quantity * unit_price\n unit_price\n end", "def compute_unit_rental_price\n per_time_fee + per_mileage_fee\n end", "def total(prices)\n amount = 0\n prices.each do |price|\n amount += price\n end\n amount\nend", "def total(numbers)\n\tsum = 0\n\tnumbers.each do |x|\n\t\tsum += x.to_f\n\tend\n\treturn sum\nend", "def total\n result = 0\n (1..3).each do |n|\n v = eval \"cost_\" + n.to_s\n result += v.to_f\n end\n result\n end", "def get_grand_total_one_month\n\t$pokitdok_call.each do |drug|\n\t$total_cost << drug['retail']['total_cost_30_day']['amount'].to_f\n\tend\n\t\n\tsum_total_cost = $total_cost.inject(:+)\nend", "def calculate(units)\n @price_per_unit * (units - units.to_i / 2)\n end", "def amount_calc\n quantity * price\n end", "def calc_carbon_savings_from_chp_elec(val1= chp_salable_elec, val2= 2.7, val3= 0.643)\n\t\t(val1 * val2 * val3).round 2\n\tend", "def get_grand_total_one_month\n\t\t$pokitdok_call.each do |drug|\n\t\t$total_cost << drug['retail']['total_cost_30_day']['amount'].to_f\n\t\tend\n\n\t\tsum_total_cost = $total_cost.inject(:+)\n\tend", "def calcTotalCustomerValue\n\t\t\n\tend", "def total\n regular_total = sub_total\n if used_promo\n regular_total -= discount_from_promo\n end\n regular_total >= 0 ? (\"%.2f\" % regular_total).to_f : 0.0 \n end", "def test_calculate_subtotal_price\n assert_equal(23.52, Stub.new.calculate_subtotal_price(24.0,0.48))\n end", "def total_tonnes\n\t\t(calculations.collect(&:tonnes).sum).round 2\n\tend", "def calculate!\n calculate_amount\n calculate_fee\n calculate_insurance\n calculate_deposit\n end", "def porcentaje (base,total)\n #Con if o con unless se chequea el cumplimiento de la condicion de la excepción\n raise TypeError, \"El primer argumento es invalido\" unless base.is_a? Numeric\n if !total.is_a? Numeric\n raise TypeError, \"El segundo argumento es invalido\" \n end\n (base*100.0) / total\nend", "def total_payment\r\n checks.inject(0.00){|sum, check| sum += check.check_amount.to_f}\r\n end", "def calculate_area(num1, num2)\n (num1.to_i.to_f * num2.to_i).round(1)\nend", "def solve(meal_cost, tip_percent, tax_percent)\n tip = meal_cost * (tip_percent / 100.0)\n tax = meal_cost * (tax_percent / 100.0)\n total_cost = (meal_cost + tip + tax).round\n puts total_cost\nend", "def total ( numbers )\r\n\r\n\treturn numbers.reduce(:+);\r\n\r\nend", "def sale_price_total(count)\n (count / sale_quantity) * sale_price + (count % sale_quantity) * unit_price\n end", "def uberXL_fare_calculator(distance, minutes)\n base_fareXL = 3.85\n xlTotal = base_fareXL + (0.50 * minutes.to_i) + (2.85 * distance.to_i)\n if xlTotal < 10.50\n puts 10.50\n else\n puts \"The total for an UberXL is #{xlTotal}\"\n end\nend", "def add_brand_tot_prc(brand_hash, full_prc = 0.0, options = {})\n brand_hash[:total_prc] = (brand_hash[:total_prc] + full_prc.to_f).round(options[:precision] || 2)\nend", "def calcuate_tax\n @price * 0.12\n end", "def gross_total_base\n net_total_base + tax_total_base\n end", "def total\n sum = 0\n\n @four_result.each do |result|\n sum += result\n end\n @six_result.each do |result|\n sum += result\n end\n @eight_result.each do |result|\n sum += result\n end\n @ten_result.each do |result|\n sum += result\n end\n @twelve_result.each do |result|\n sum += result\n end\n @twenty_result.each do |result|\n sum += result\n end\n @percentile_result.each do |result|\n sum += result\n end\n\n sum\n end", "def total(numbers)\n\tnumbers.inject(:+)\nend", "def compute_total_price\n self.total_price_ati = computed_total_price_ati\n end", "def pmt(interest_rate,payments,principal)\n numerator =interest_rate*principal*(1 + interest_rate)**payments\n denominator= (1+ interest_rate)**payments - 1\n return numerator/denominator.to_f\nend", "def total_amount\n (total * 100).to_i\n end", "def calculate_remainder(amount:, total:)\n 100 - calculate_percentage(amount: amount, total: total)\n end", "def calculate_fee_pounds\n calculate_fee / PENCE_IN_POUND\n end", "def bill_calc\n puts \"What is the cost of the bill?:\"\n bill = gets.chomp.to_f\n puts \"What is the tip rate percentage?:\"\n tip_percentage= gets.chomp.to_f\n \n tip_total = ((bill / 100) * tip_percentage)\n \n puts \"The tip cost is : #{sprintf('%.2f',(tip_total))}\"\n puts \"The total cost including the tip is #{sprintf('%.2f',(bill + tip_total))}\"\n \nend", "def calc_bottles(spend_amt)\n spend_amt.to_i/2\nend", "def total\n return 0 if @products.empty?\n total = (@products.sum { |name, price| price } * 1.075).round(2)\n return total\n end", "def total(numbers)\n result = 0\n numbers.each { |x| result += x }\n return result\nend", "def total\n @total ||= ((shipping_amount * subtotal).to_f/100) + subtotal + promotion_amount.to_i\n end", "def solve(meal_cost, tip_percent, tax_percent)\r\n puts (meal_cost + meal_cost*tip_percent/100 + meal_cost*tax_percent/100).round\r\nend", "def sum(num, total) => total += num", "def subtotal\n precio * cantidad\n end", "def calculate_tax_for(total)\n if self.vat_rate.present? && self.vat_rate != 0.0\n ((self.vat_rate / 100) * total)\n else\n 0\n end\n end", "def restaurant_deposit\n location_percentage = location.percentage.to_f / 100\n total = (subtotal * location_percentage) + ((subtotal * location_percentage) * 0.0825)\n return total\n end", "def ir_grasa_total \n\t\t@grasa_ir = grasas_totales\n\t\t@ir_grasa_total = (@grasa_ir/70.to_f) * 100\n\t\t@ir_grasa_total.round(1)\n\tend", "def total_price(tax_rate)\n ((1 + tax_percentage(tax_rate)) * price)\n end", "def total_in_dollars_and_cents\n total.to_f / 100\n end", "def add(x,y)\n total = x + y\n puts total\n calculate(total)\nend", "def calc_tip(bill, tip)\n (bill * (tip / 100))\nend", "def calc_carbon_savings_from_upg_ggrid(val1= calc_upg_mwh_ch4, val2= 1.1, val3= 0.203)\n\t\t(val1 * val2 * val3).round 2\n\tend", "def trip_cost(distance, miles_per_gal, price_per_gal)\n result = (((distance.to_f / 100) * miles_per_gal) * price_per_gal) #can also do distance / 100.0 because as long as one of the numbers is a floating point it will return a decimal number\n return result\nend", "def full_price\n price + tax_evaluation\n end", "def series_sum(n)\n return \"0.00\" if n == 0\n start = 1.0\n value = 0.0\n \n n.times do \n value += (1.0 / start)\n start += 3.0\n end\n\n p \"%.2f\" % value\nend", "def calculate\n=begin\n self.net_amount = nil\n self.tax_amount = nil\n self.gross_amount = nil\n=end\n self.total\n end", "def calculate_tip(percent, bill)\n (percent/100.0) * bill\nend" ]
[ "0.6879973", "0.67622167", "0.6657539", "0.6612627", "0.6587358", "0.656407", "0.65630376", "0.6561427", "0.64806914", "0.6459962", "0.6435332", "0.6415027", "0.63927615", "0.6373905", "0.6363716", "0.63554835", "0.6332464", "0.63104635", "0.6303777", "0.6297794", "0.6289773", "0.6289773", "0.6254996", "0.62348634", "0.6227687", "0.62166125", "0.6213833", "0.6195158", "0.61877227", "0.61803645", "0.6156861", "0.61539066", "0.6151545", "0.6120266", "0.6117584", "0.6113526", "0.6109627", "0.6098301", "0.6096355", "0.6089705", "0.60858697", "0.60731727", "0.6071185", "0.6071056", "0.6069427", "0.6067492", "0.6067437", "0.606717", "0.6061593", "0.6059992", "0.6059016", "0.60584295", "0.60512954", "0.60389525", "0.60382473", "0.60364735", "0.60182756", "0.6016299", "0.60155535", "0.60114086", "0.6002291", "0.60011715", "0.5998474", "0.5991887", "0.5990247", "0.59891456", "0.59884703", "0.5984993", "0.5981246", "0.59754986", "0.59733576", "0.5972717", "0.5972578", "0.5970976", "0.59678966", "0.59647757", "0.59598935", "0.59549934", "0.5949943", "0.5949025", "0.59473324", "0.5947084", "0.5945491", "0.5944565", "0.5935259", "0.5917183", "0.59099025", "0.58967614", "0.58956575", "0.5893967", "0.5887874", "0.58869946", "0.5878614", "0.58587396", "0.5858272", "0.58528745", "0.58528495", "0.5852258", "0.5848373", "0.5847846" ]
0.6542172
8
Internal: Updates the standings points, goals, results of teams in a match. match a string in the format "Home Team 0 0 Away Team", includes the teams and goals for update.
def update_standings(match) home_team, away_team = get_match_teams(match) home_team_goals, away_team_goals = get_match_goals(match) save_match_result(home_team, home_team_goals, away_team_goals) save_match_result(away_team, away_team_goals, home_team_goals) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_teams\n if (home_team != nil and away_team != nil)\n puts \"Updating teams\"\n #match = Matchup.new(params)\n home_team.updateResults(self)\n away_team.updateResults(self)\n home_team.save\n away_team.save\n else\n return false\n end\n end", "def update\n for i in [email protected]\n match = @matchday.matches[i]\n unless match.played\n local_data = [params.fetch('local_goals_'+i.to_s), params.fetch('local_yellows_'+i.to_s), params.fetch('local_reds_'+i.to_s)]\n visit_data = [params.fetch('visit_goals_'+i.to_s), params.fetch('visit_yellows_'+i.to_s), params.fetch('visit_reds_'+i.to_s)]\n match.update_result(local_data, visit_data)\n end\n end\n\n redirect_to @matchday.tournament, notice: 'Resultados de Fecha ' + @matchday.number.to_s + ' guardados.'\n end", "def add_match_results(match)\n if match[0][1] == match[1][1]\n team1 = @teams.find { |team| team.name == match[0][0] }\n team2 = @teams.find { |team| team.name == match[1][0] }\n\n team1.score += 1\n team2.score += 1\n else\n winner = match.max_by { |x| x[1] }\n losser = match.min_by { |x| x[1] }\n\n team1 = @teams.find { |team| team.name == winner[0] }\n team2 = @teams.find { |team| team.name == losser[0] }\n\n team1.score += 3\n end\n team1.goals += match[0][1].to_i\n team2.goals += match[1][1].to_i\n end", "def update\n UpdateMatch.run(params)\n redirect_to tournament_path(tournament_id), status: 303\n end", "def update\n # Vudo: Recalculate win or loss value based on updated score (if there is one) -- make own endpoint for score?\n update_params = matchup_params\n\n # Handle Spread History\n if @matchup.spread_history.blank?\n spread_object = {\n spread: matchup_params[:vegas_spread],\n date: DateTime.now.strftime('%Q').to_f,\n }\n spread_history = [spread_object].to_json\n update_params[:spread_history] = spread_history\n else\n spread_history = append_spread_to_matchup\n update_params[:spread_history] = spread_history\n end\n\n @matchup.update(update_params)\n @matchup.reload\n\n if !([\"home_team_score\", \"away_team_score\", \"vegas_spread\", \"system_spread\"] & matchup_params.keys).empty?\n @matchup.correct_pick = @matchup.correct_pick?.to_s\n @matchup.save!\n end\n\n render :json => @matchup\n end", "def update\n respond_to do |format|\n if @match_team.update(match_team_params)\n format.html { redirect_to @match_team, notice: 'Match team was successfully updated.' }\n format.json { render :show, status: :ok, location: @match_team }\n else\n format.html { render :edit }\n format.json { render json: @match_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @match_time = args[:match_time] if args.key?(:match_time)\n @matched_locations = args[:matched_locations] if args.key?(:matched_locations)\n end", "def update!(**args)\n @match_time = args[:match_time] if args.key?(:match_time)\n @matched_locations = args[:matched_locations] if args.key?(:matched_locations)\n end", "def update\n respond_to do |format|\n if @team_match.update(team_match_params)\n format.html { redirect_to @team_match, notice: 'Team match was successfully updated.' }\n format.json { render :show, status: :ok, location: @team_match }\n else\n format.html { render :edit }\n format.json { render json: @team_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @com1_old_score = @match.competitor1_score\n @com2_old_score = @match.competitor2_score\n respond_to do |format|\n if @match.update(match_params)\n update_tournament\n puts \"Updating\"\n update_channel_name(@match)\n update_channel_name(@match.winner_match) unless @match.winner_match.nil?\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @matched_locations = args[:matched_locations] if args.key?(:matched_locations)\n @match_time = args[:match_time] if args.key?(:match_time)\n end", "def update\n @team_for_the_match = TeamForTheMatch.find(params[:id])\n\n respond_to do |format|\n if @team_for_the_match.update_attributes(params[:team_for_the_match])\n format.html { redirect_to(@team_for_the_match, :notice => 'Team for the match was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team_for_the_match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_match_winner\n match.set_current_match_winner\n end", "def perform(match_id, update, uid)\n puts \"UPDATE = #{update}\"\n current_user = User.find(uid)\n\n match_json = SteamController.get_match(match_id)\n\n begin\n\n match = Match.find(match_id.to_i)\n\n # -----\n # If we don't have the match data in the DB already, OR the update boolean has\n # been passed in as True which means the user has requested their match data\n # to be updated regardless, then update the match.\n # -----\n if (match == nil) || update\n\n # Only make a new match if match wasn't found in the DB. (remember, match could\n # already be in the DB and it should just be updated if \"update\" boolean was True)\n match = Match.new if (match == nil)\n\n match.players = []\n\n match.has_pro = false\n\n players = match_json['players']\n\n # -----\n # Parse player information from the game data.\n # -----\n players.each do |p|\n\n # Check if we have this player in our list of \"pro/ticketed\" players in the DB\n pro_in_db = Proplayer.find(p['account_id'].to_i)\n\n # -----\n # If the player is a \"pro\", then the match gets flagged with match.has_pro, the player\n # gets flagged with the \"pro\" boolean later, and the proplayer gets added to the user's\n # linked list of pros if it's not already there.\n # -----\n if pro_in_db\n pro = true\n match.has_pro = true\n puts \"adding pro player to user\"\n current_user.proplayers.push(pro_in_db) unless current_user.proplayers.find(pro_in_db.id)\n else\n pro = false\n end\n\n # -----\n # Parse out player match data and add it to the match\n # -----\n hero_name = Hero.find(p['hero_id']).name.downcase.gsub(\" \", \"_\")\n match.players.push(\n Player.new(\n id: p['account_id'],\n player_slot: p['player_slot'],\n hero: hero_name,\n item_0: p['item_0'],\n item_1: p['item_1'],\n item_2: p['item_2'],\n item_3: p['item_3'],\n item_4: p['item_4'],\n item_5: p['item_5'],\n kills: p['kills'],\n deaths: p['deaths'],\n assists: p['assists'],\n gold: p['gold'],\n last_hits: p['last_hits'],\n denies: p['denies'],\n level: p['level'],\n gold_per_min: p['gold_per_min'],\n xp_per_min: p['xp_per_min'],\n hero_damage: p['hero_damage'],\n tower_damage: p['tower_damage'],\n hero_healing: p['hero_healing'],\n gold_spent: p['gold_spent'],\n pro_player: pro\n ))\n end\n\n # -----\n # Parse out match information\n # -----\n match.radiant_win = match_json['radiant_win']\n match.duration = match_json['duration']\n match.start_time = match_json['start_time']\n match.id = match_json['match_id']\n\n # match.update will save the match if it doesn't exist and update it if it does\n match.update\n\n # Add this match to user's list of matches for quick retrieval later\n current_user.matches.push(match) unless current_user.matches.find(match.id)\n\n end\n \n rescue\n puts \"MATCH #{match_id} FUCKIN ERRORED DOG\"\n end\n \n end", "def match!(teams,team)\n my_rating = team_rating(team)\n best = nil\n best_team = nil\n teams.teams.each do |other|\n\n if other.members.size < other.min_for_match\n next\n end\n\n if rating = team_rating(other)\n diff = my_rating > rating ? my_rating - rating : rating - my_rating\n if best.nil? || diff < best\n best = diff\n best_team = other\n end\n end\n end\n\n if best_team\n GameMachine::Models::StartMatch.new(:team_names => [team.name,best_team.name])\n else\n nil\n end\n end", "def update_match_results_and_points(match)\n case match[2]\n when 'W'\n $wins[match[0]] = $wins[match[0]].to_i + 1\n $loses[match[1]] = $loses[match[1]].to_i + 1\n $points[match[0]] = $points[match[0]].to_i + 3\n when 'L'\n $loses[match[0]] = $loses[match[0]].to_i + 1\n $wins[match[1]] = $wins[match[1]].to_i + 1\n $points[match[1]] = $points[match[1]].to_i + 3\n else\n $draws[match[0]] = $draws[match[0]].to_i + 1\n $draws[match[1]] = $draws[match[1]].to_i + 1\n $points[match[0]] = $points[match[0]].to_i + 1\n $points[match[1]] = $points[match[1]].to_i + 1\n end\nend", "def update!(**args)\n @match_score = args[:match_score] if args.key?(:match_score)\n end", "def update_team\n \n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to matches_path, notice: 'Match was successfully updated.' }\n format.json { render :index, status: :ok, location: @match }\n else\n set_matches\n format.html { redirect_to matches_path, alert: @match.errors.full_messages.join(\"<br/>\") }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @raw_match_quality_score = args[:raw_match_quality_score] if args.key?(:raw_match_quality_score)\n @st_expression_results = args[:st_expression_results] if args.key?(:st_expression_results)\n end", "def update!(**args)\n @duration_to_predicted_time_ms = args[:duration_to_predicted_time_ms] if args.key?(:duration_to_predicted_time_ms)\n @match_score = args[:match_score] if args.key?(:match_score)\n @matched_asr_start_pos = args[:matched_asr_start_pos] if args.key?(:matched_asr_start_pos)\n @matched_asr_text = args[:matched_asr_text] if args.key?(:matched_asr_text)\n @matched_asr_time_ms = args[:matched_asr_time_ms] if args.key?(:matched_asr_time_ms)\n @matched_asr_time_ratio = args[:matched_asr_time_ratio] if args.key?(:matched_asr_time_ratio)\n @matched_asr_token_count = args[:matched_asr_token_count] if args.key?(:matched_asr_token_count)\n @matched_description_item_index_ratio = args[:matched_description_item_index_ratio] if args.key?(:matched_description_item_index_ratio)\n @matched_description_text = args[:matched_description_text] if args.key?(:matched_description_text)\n @matched_description_token_count = args[:matched_description_token_count] if args.key?(:matched_description_token_count)\n end", "def set_team_match\n @team_match = TeamMatch.find(params[:id])\n end", "def update\n respond_to do |format|\n if @stat_of_player_of_team_of_match.update(stat_of_player_of_team_of_match_params)\n format.html { redirect_to @stat_of_player_of_team_of_match, notice: 'Stat of player of team of match was successfully updated.' }\n format.json { render :show, status: :ok, location: @stat_of_player_of_team_of_match }\n else\n format.html { render :edit }\n format.json { render json: @stat_of_player_of_team_of_match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n\n #First update the players table to indicate who is playing this game\n set_player_availability(params)\n \n #Find teams and update their names\n home_team = Team.find(@game.home_team_id)\n home_team.name = params[:home_team_name]\n away_team = Team.find(@game.away_team_id)\n away_team.name = params[:away_team_name]\n \n #Create home and away teams from available players\n build_teams(home_team, away_team)\n \n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @longest_match = args[:longest_match] if args.key?(:longest_match)\n @match_segments = args[:match_segments] if args.key?(:match_segments)\n @reference_id = args[:reference_id] if args.key?(:reference_id)\n @total_match = args[:total_match] if args.key?(:total_match)\n end", "def update\n @match = @contest.matches.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n flash[:notice] = 'Match was successfully updated.'\n format.html { redirect_to(contest_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match_set.update(match_set_params)\n format.html { redirect_to @match_set, notice: 'Match set was successfully updated.' }\n format.json { render :show, status: :ok, location: @match_set }\n else\n format.html { render :edit }\n format.json { render json: @match_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @match.assign_attributes(match_params)\n @match.end = @match.end_date\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: ['Match was successfully updated.', \"alert alert-dismissible alert-success\"] }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n match_day_team = MatchDayTeam.find(params[:id])\n if match_day_team.update(match_day_team_params)\n render json: match_day_team, status: 200, location: [:api, match_day_team]\n else\n failed_to_update(match_day_team, \"match_day_team\")\n end\n end", "def score_matchup(matchup_id, winning_submission_id, losing_submission_id)\n # TODO: ensure we're filtering by category or whatever\n matchup = $MATCHUPS.find{|matchup| matchup[:id] == matchup_id}\n matchup[:completed] = true\n matchup[:winning_submission_id] = winning_submission_id\n\n winning_submission = $SUBMISSIONS.find{|s| s[:id] == winning_submission_id }\n losing_submission = $SUBMISSIONS.find{|s| s[:id] == losing_submission_id }\n\n winning_sub_elo = Elo::Player.new(:rating => winning_submission[:elo_rating])\n losing_sub_elo = Elo::Player.new(:rating => losing_submission[:elo_rating])\n \n winning_sub_elo.wins_from(losing_sub_elo)\n\n winning_submission[:elo_rating] = winning_sub_elo.rating\n losing_submission[:elo_rating] = losing_sub_elo.rating\n\n # $SUBMISSIONS.map{|s| s[:id] == winning_submission_id ? winning_submission : s[:id] == losing_submission_id ? losing_submission : s }\n\n # $MATCHUPS.map{|m| m[:id] == matchup_id ? matchup : m }\n incomplete_matches = $MATCHUPS.select{|m| m[:completed] == false && m[:assigned] == false}\n\n if(incomplete_matches.count() < $NUM_TEAMS) \n generate_more_matchups()\n end\nend", "def commit_match(match)\n\t\tif match.class == Array\n\t\t\tp1 = Player[:in_tournament_id => match[0], :tournament_id => self.id]\n\t\t\tp2 = Player[:in_tournament_id => match[1], :tournament_id => self.id]\n\t\t\tresult = match[2]\n\t\telse\n\t\t\tp1 = match.p1\n\t\t\tp2 = match.p2\n\t\t\tresult = match.result\n\t\tend\n\t\t@@logger.info { \"Trying to find-out if this match were given and was not returned yet.\" } if have_logger?\n\t\tmymatch = RSwiss::Match[:p1_id => p1.id, :p2_id => p2.id, :checked_out => true, :result => nil]\n\t\tmymatch = RSwiss::Match[:p1_id => p2.id, :p2_id => p1.id, :checked_out => true, :result => nil] if mymatch.nil?\n\t\traise MatchNotCheckedOut if mymatch.nil?\n\t\t@@logger.info { \"Great... we found it. Let's commit it then.\" } if have_logger?\n\t\tmymatch.result = result\n\t\tmymatch.save\n\tend", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n if [email protected]?\n pronostics=Pronostic.find_all_by_match_id(@match.id)\n pronostics.each do |p|\n if p.win?\n player=p.user\n if player\n player.score=player.score+3\n player.scoreday=player.scoreday+3\n player.save\n end\n elsif !p.win? && p.global_win?\n player=p.user\n if player\n player.score=player.score+1\n player.scoreday=player.scoreday+1\n player.save\n end\n end\n end\n end\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_match_team\n @match_team = MatchTeam.find(params[:id])\n end", "def run_match\n if @number_of_players != @match_participants.count\n puts \" Match runner skipping match #\" + @match_id.to_s +\n \" (\" + @match_participants.count.to_s + \"/\" + @number_of_players.to_s + \" in player_matches)\"\n return\n end\n #Call round wrapper which runs the executables and generates game hashes\n round_wrapper = RoundWrapper.new(@referee, @match_id, @number_of_players, @max_match_time, @match_participants, @num_rounds, @duplicate_players)\n puts \" Match runner running match #\" + @match_id.to_s\n round_wrapper.run_match\n\n @match_participants = [@match.players.first] if @duplicate_players\n\n self.send_results_to_db(round_wrapper)\n end", "def update!(**args)\n @face_match = args[:face_match] if args.key?(:face_match)\n @personal_results = args[:personal_results] if args.key?(:personal_results)\n @voice_match = args[:voice_match] if args.key?(:voice_match)\n end", "def update_score_from_games!\n return if self.games.count == 0\n score_by_steam_id = {}\n self.games.each do |g|\n # Add one point to winning team, 0 to losing team so that they show up in the keyset when we check later\n if g.radiant_win === true\n score_by_steam_id[g.radiant_team_id] = score_by_steam_id[g.radiant_team_id].to_i + 1\n score_by_steam_id[g.dire_team_id] = score_by_steam_id[g.dire_team_id].to_i\n elsif g.radiant_win === false\n score_by_steam_id[g.radiant_team_id] = score_by_steam_id[g.radiant_team_id].to_i\n score_by_steam_id[g.dire_team_id] = score_by_steam_id[g.dire_team_id].to_i + 1\n end\n end\n\n # OK the keys are team ids, so now save them\n if score_by_steam_id[self.home_participant.id] != nil && score_by_steam_id[self.away_participant.id] != nil\n self.home_score = score_by_steam_id[self.home_participant.id]\n self.away_score = score_by_steam_id[self.away_participant.id]\n self.save!\n else\n puts score_by_steam_id.inspect\n puts self.home_participant_id.inspect\n puts self.away_participant_id.inspect\n puts \"WARNING: teams did not match, not updating match score\"\n end\n end", "def func_editmatch(sender, dest, args)\r\n\t\tif args.size() == 3\r\n\t\t\tmatchid= args[0].to_i()\r\n\t\t\twhat= args[1]\r\n\t\t\tnew_value= args[2]\r\n\r\n\t\t\tres= @db.query(\"SELECT * FROM matchs WHERE id='#{matchid}'\")\r\n\t\t\tif res.num_rows() > 0\r\n\t\t\t\tfields= {\r\n\t\t\t\t\t\t\t\"team\" \t\t=> \"Adversaires\",\r\n\t\t\t\t\t\t\t\"maps\" \t\t=> \"Maps\",\r\n\t\t\t\t\t\t\t\"server\" \t=> \"Server\",\r\n\t\t\t\t\t\t\t\"pass\" \t\t=> \"Password\"\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\tif fields.fetch(what, nil) != nil\r\n\t\t\t\t\twhat= fields.fetch(what, nil)\r\n\t\t\t\t\[email protected](\"UPDATE matchs SET #{what}='#{new_value}' WHERE id='#{matchid}'\")\r\n\t\t\t\t\tsender.notice(\"Match #{matchid} updated.\")\r\n\t\t\t\t\tupdateTopic()\r\n\t\t\t\telse\r\n\t\t\t\t\tsender.notice(\"unknown property #{what}, valid properties: \" + fields.keys().join(\",\"))\r\n\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\tsender.notice(\"no match with id #{matchid}.\")\r\n\t\t\tend\r\n\t\t\tres.free()\r\n\t\telse\r\n\t\t\treturn -1\r\n\t\tend\r\n\tend", "def update!(**args)\n @babel_match = args[:babel_match] if args.key?(:babel_match)\n @description_span_info = args[:description_span_info] if args.key?(:description_span_info)\n @list_item_index = args[:list_item_index] if args.key?(:list_item_index)\n @match_scores = args[:match_scores] if args.key?(:match_scores)\n @pretrigger_score = args[:pretrigger_score] if args.key?(:pretrigger_score)\n @title_anchor_babel_match_score = args[:title_anchor_babel_match_score] if args.key?(:title_anchor_babel_match_score)\n end", "def update_match_day_team(match_day_team)\n if match_day_team.save\n render json: match_day_team, status: 200, location: [:api, match_day_team]\n else\n failed_to_update(match_day_team, \"match_day_team\")\n end\n end", "def update!(**args)\n @is_matchless_result_context = args[:is_matchless_result_context] if args.key?(:is_matchless_result_context)\n @mid = args[:mid] if args.key?(:mid)\n @name = args[:name] if args.key?(:name)\n @result_entity_score = args[:result_entity_score] if args.key?(:result_entity_score)\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: \"Match was successfully updated.\" }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n # format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.html { redirect_to [@fes, @match], notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to @match, :notice => 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @matches = args[:matches] if args.key?(:matches)\n end", "def update!(**args)\n @matches = args[:matches] if args.key?(:matches)\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @match = Match.find(params[:id])\n @result = Result.where(:match_id => params[:id])\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to(@match, :notice => 'Match was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n # Vérifie si il y a les points des matches dans les params\n if (params[:points_manche])\n\n # Additionne tous les points des annonces\n team1_total_point_announce = params[:team1_num0_announce].to_i + params[:team1_num01_announce].to_i + params[:team1_num2_announce].to_i + params[:team1_num3_announce].to_i + params[:team1_num4_announce].to_i\n team2_total_point_announce = params[:team2_num0_announce].to_i + params[:team2_num01_announce].to_i + params[:team2_num2_announce].to_i + params[:team2_num3_announce].to_i + params[:team2_num4_announce].to_i\n\n # Met a jour la manche de la partie\n @game.update(rounds: @game.rounds + 1)\n\n # Permet de définir le nouveau distributeur\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.distributor)\n @distributor_position = player.position\n player.update(distributor: false)\n end\n end\n end\n @new_distributor_position = @distributor_position + 1\n if (@new_distributor_position == 5)\n @new_distributor_position = 1\n end\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.position == @new_distributor_position)\n player.update(distributor: true)\n end\n end\n end\n\n # Permet de définir le joueur qui devra chosir l'atout\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.first_to_play)\n @first_to_play_position = player.position\n player.update(first_to_play: false)\n end\n end\n end\n @new_first_to_play_position = @first_to_play_position + 1\n if (@new_first_to_play_position == 5)\n @new_first_to_play_position = 1\n end\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.position == @new_first_to_play_position)\n player.update(first_to_play: true)\n end\n end\n end\n\n # Verifie si les points de la manche sont a 0 et met a jour les points de l'équipe 2\n if params[:points_manche].to_i == 0\n # Vérifie si il y a un match; Si oui on ajoute 257 points sinon 157\n if params[:match] == \"oui\"\n @game.teams.last.update(points: 257 + @game.teams.last.points.to_i + team2_total_point_announce)\n else\n @game.teams.last.update(points: 157 + @game.teams.last.points.to_i + team2_total_point_announce)\n end\n elsif 157 - params[:points_manche].to_i <= 0\n @game.teams.last.update(points: 0 + @game.teams.last.points.to_i + team2_total_point_announce)\n else\n @game.teams.last.update(points: 157 - params[:points_manche].to_i + @game.teams.last.points.to_i + team2_total_point_announce)\n end\n\n # Met a jour les points de l'équipe 2\n @game.teams.first.update(points: params[:points_manche].to_i + @game.teams.first.points.to_i + team1_total_point_announce )\n\n # Vérifie si il y a un gagnant dans la partie\n if (@game.teams.first.points >= @game.points)\n @game.teams.first.update(winner: true)\n @game.update(winner: true)\n elsif (@game.teams.last.points >= @game.points)\n @game.teams.last.update(winner:true)\n @game.update(winner: true)\n end\n\n # Sauvegarde une partie\n if @game.save\n render json: { success: true, teams: @game.teams, game: @game}\n end\n\n # Met a jour l'atout et affichige l'icone sur le bon joueur (atout)\n elsif (params[:atout] != '')\n @game.update(atout: params[:atout])\n if (params[:chibre] == \"true\")\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.first_to_play)\n @first_to_play_position = player.position\n player.update(first_to_play: false)\n end\n end\n end\n @new_first_to_play_position = @first_to_play_position + 2\n if (@new_first_to_play_position == 5)\n @new_first_to_play_position = 1\n end\n if (@new_first_to_play_position == 6)\n @new_first_to_play_position = 2\n end\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.position == @new_first_to_play_position)\n player.update(first_to_play: true)\n render json: { success: true, teams: @game.teams}\n end\n end\n end\n else\n render json: { success: true, teams: @game.teams}\n end\n\n # Verifie le status de la partie\n elsif (params[:status] != '')\n @game.update(status: params[:status])\n end\n\n end", "def update\n @match = match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to @match, notice: 'match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def reset_standings\n\t\[email protected]\n\t\[email protected] { |match| update_standings(match) }\n\tend", "def update\n authorize! :update, Match\n\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(match_params)\n UserMailer.match_played(@match.player1, @match.player2, @match).deliver\n UserMailer.match_played(@match.player2, @match.player1, @match).deliver\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n Rails.logger.debug \"GOT TO matches -> update\"\n match = Match.find(params[:match_id].to_i)\n requestor = match.user_for_id(params[:requestor_id].to_i)\n recipient = match.user_for_id(params[:requested_id].to_i)\n match.ask_for_cards(requestor: requestor, recipient: recipient, card_rank: params['rank'].upcase)\n match.save!\n render json: nil, status: :ok\n end", "def update\n @match_stat = MatchStat.find(params[:id])\n\n respond_to do |format|\n if @match_stat.update_attributes(params[:match_stat])\n format.html { redirect_to @match_stat, notice: 'Match stat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @match_stat.errors, status: :unprocessable_entity }\n end\n end\n end", "def matchname\n \"#{self.date}: #{self.hometeam.name} V #{self.awayteam.name}\"\n end", "def update!(**args)\n @match_type = args[:match_type] if args.key?(:match_type)\n @text = args[:text] if args.key?(:text)\n end", "def update\n\n respond_to do |format|\n ap @team.name\n ap @categorys = Category.where(:team => @team.name)\n ap @admin_tasks = AdminTask.where(:team => @team.name)\n ap @eadmin_tasks = EadminTask.where(:team => @team.name)\n ap @users = User.where(:user_info => @team.name)\n\n if @team.update(team_params)\n ap @team.name\n @admin_tasks.update_all(:team => @team.name )\n @eadmin_tasks.update_all(:team => @team.name )\n @categorys.update_all(:team => @team.name )\n @users.update_all(:user_info => @team.name )\n\n\n format.html { redirect_to team_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @match = args[:match] if args.key?(:match)\n @query = args[:query] if args.key?(:query)\n end", "def update\n \t@team = Team.find(params[:id])\n \tif @team.update(model_params)\n \t\tif params[:team][:filter]\n \t\t\tredirect_to teams_path(filter: params[:team][:filter]), notice: \"Score Updated\"\n \t\telse\n\t\t \tredirect_to team_path(@team)\n \tend\n \telse\n\t \t\t@leaders = Leader.all.order(room: :asc)\n \t\trender :edit\n \tend\n \tend", "def update!(**args)\n @content_match_type = args[:content_match_type] if args.key?(:content_match_type)\n @match_duration = args[:match_duration] if args.key?(:match_duration)\n @match_percent = args[:match_percent] if args.key?(:match_percent)\n @reference_duration = args[:reference_duration] if args.key?(:reference_duration)\n @reference_percent = args[:reference_percent] if args.key?(:reference_percent)\n @required_territories = args[:required_territories] if args.key?(:required_territories)\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to(@match, :notice => 'Match was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n format.html { redirect_to(@match, :notice => 'Match was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @match = Match.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n flash[:notice] = 'Match was successfully updated.'\n format.html { redirect_to(@match) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to @match, notice: 'Match was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_score\n games = Hash.new([])\n predictions.each do |prediction|\n key = prediction.match_id\n games[key] = {}\n games[key][:teams] = []\n games[key][:round] = prediction.round_id\n unless prediction.winner.nil?\n games[key][:teams] << prediction.winner.id\n end\n end\n Game.includes(:team1, :team2).find_each do |game|\n key = game.match_id\n unless game.winner.nil?\n games[key][:teams] << game.winner.id\n end\n end\n\n puts games.inspect\n\n score = 0\n games.each do |key, data|\n round = games[key][:round]\n winners = games[key][:teams]\n if winners.length == 2 and winners.first == winners.last\n score += (2 ** (round))\n end\n end\n self.update_attributes :score => score\n end", "def update_team\n @team.update(team_params)\n end", "def update!(**args)\n @matches = args[:matches] if args.key?(:matches)\n @minimum_wait_duration = args[:minimum_wait_duration] if args.key?(:minimum_wait_duration)\n @negative_cache_duration = args[:negative_cache_duration] if args.key?(:negative_cache_duration)\n end", "def update\n @team = Team.find(params[:team][:team_id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n if params[:players]\n TeamPlayers.update(params[:players], team_name: @team.name)\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n tournament = Tournament.find(params[:id])\n champion_id = User.find_by(username: params[:winner]).id\n tournament.update(champion_id: champion_id)\n\n # If the last match winner id is nil, it was a double elim match that never had to be played. \n # May as well delete it\n if (tournament.matches.last.winner_id == nil)\n Match.destroy(tournament.matches.last.id)\n end\n end", "def update\n @matchup = Matchup.find(params[:id])\n if params[:winner]\n @matchup.winner = params[:winner]\n end\n\n respond_to do |format|\n if @matchup.update_attributes(params[:matchup])\n format.html { redirect_to(:action => \"index\", :week_num => @matchup.week, :notice => 'Matchup was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @matchup.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_teams(a_game)\n\n add_new_teams(a_game)\n\n teams_in_game = teams_in_game(a_game)\n teams_with_score_max = teams_with_score_max(a_game)\n\n teams_in_game.each_value do |team_in_game|\n\n if !teams_with_score_max.has_key?(team_in_game.name.to_sym)\n # team isn't in group with high score\n team_in_game.lost += 1\n\n else\n # team is in group with high score.\n # team won or tied\n if (1 == teams_with_score_max.length)\n # only one team has high score\n # team won\n team_in_game.won += 1\n elsif (2 <= teams_with_score_max.length)\n # more than one team has high score\n # team tied\n team_in_game.tied += 1\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @matchparticipant.update(matchparticipant_params)\n format.html { redirect_to @matchparticipant, notice: 'Matchparticipant was successfully updated.' }\n format.json { render :show, status: :ok, location: @matchparticipant }\n else\n format.html { render :edit }\n format.json { render json: @matchparticipant.errors, status: :unprocessable_entity }\n end\n end\n end", "def matchups\n\t# we will create a temporary array\n\t# for use only in this method,\n\t# so we don't effect the original\n\t# @teams array with an deletions\n\ttemp_arr = []\n\[email protected] do |t|\n\t\ttemp_arr.push(t)\n\tend\n\n\tif temp_arr.length % 2 != 0\n\t\t# check if there is an odd number of teams,\n\t\t# if there is an odd number, we pull pull\n\t\t# out the top one and give them a bye week\n\t\tputs \"(1) #{temp_arr.delete_at(0).name} has a bye\"\n\t\t# and now we have an even number of teams\n\tend\n\n\t# match up the even amount of teams,\n\t# assuming there are any teams...\n\twhile temp_arr.length > 0\n\t\tteam1 = temp_arr.delete_at(0)\n\t\t# team 1 is the first one in array\n\t\tteam2 = temp_arr.pop\n\t\t# team 2 is last in array\n\t\tputs \"(#{team1.ranking}) #{team1.name} versus (#{team2.ranking}) #{team2.name}\"\n\t\t# this continues until no teams are left in the array\n\t\t# Example: \n\t\t# [1,2,3,4,5,6]\n\t\t# team1 = 1\n\t\t# team2 = 6\n\t\t# [2,3,4,5]\n\t\t# team1 = 2\n\t\t# team2 = 5\n\t\t# [3,4]\n\t\t# team1 = 3\n\t\t# team2 = 4\n\tend\n\n\treturn_to_menu\nend", "def update!(**args)\n @best_asr_and_description_anchors_match_info = args[:best_asr_and_description_anchors_match_info] if args.key?(:best_asr_and_description_anchors_match_info)\n @best_description_and_instruction_anchors_match_info = args[:best_description_and_instruction_anchors_match_info] if args.key?(:best_description_and_instruction_anchors_match_info)\n @instruction_anchors_match_info = args[:instruction_anchors_match_info] if args.key?(:instruction_anchors_match_info)\n end", "def update\n team_data = params[:team]\n begin\n team = Team.where(:id=>team_data[:id]).first\n if team && registration = Registration.on_team(team).for_user(current_user).first\n team.update_attributes(team_data) if registration.captain?\n end\n end\n flash[:success] = \"Your team changes were saved successfully. Check them out:\"\n redirect_to registration_olympiad_path(@olympiad, :page=>\"team\")\n end", "def update\n\n @gameparam = params[:game]\n\n updategameplayers(params[:local_subs_ids], params[:id], @gameparam[:home_team], \"Sub\")\n updategameplayers(params[:visit_subs_ids], params[:id], @gameparam[:visit_team], 'Sub')\n\n updategameplayers(params[:local_starter_ids], params[:id], @gameparam[:home_team], 'Starter')\n updategameplayers(params[:visit_starter_ids], params[:id], @gameparam[:visit_team], 'Starter') \n\n calculategeneraltable(@game.tournament_id, @game.home_team)\n calculategeneraltable(@game.tournament_id, @game.visit_team)\n\n CreateGameaction(params[:action_id])\n \n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def standings_query(args)\n order_by = \"points DESC NULLS LAST, diff DESC NULLS LAST, shot DESC NULLS LAST, got ASC NULLS LAST\"\n query= <<EOF\nSELECT\tteam_id,\n\tsum(own_score)\t\tAS\tshot,\n\tsum(other_score)\tAS\tgot,\n\tsum(own_score) - sum(other_score)\tAS\tdiff,\n\tsum(\tCASE\tWHEN\town_score > other_score\tTHEN\t3\n\t\t\tWHEN\town_score < other_score\tTHEN\t0\n\t\t\tWHEN\town_score = other_score THEN \t1\n\t\t\tELSE\t0\n\t\tEND)\tAS points,\n\tsum(\tCASE\tWHEN\town_score IS NOT NULL\tTHEN\t1\n\t\tELSE\t0\n\t\tEND) \tAS matches\nFROM\n\t(\n\tSELECT \tmatches.id,\n\t\tmp.team_id,\n\t\tCASE\tWHEN\tmp.role = 0\tTHEN\tmatches.home_score\n\t\t\tELSE\tmatches.guest_score\n\t\tEND\tAS\town_score,\n\t\tCASE\tWHEN\tmp.role = 1\tTHEN\tmatches.home_score\n\t\t\tELSE\tmatches.guest_score\n\t\tEND\tAS\tother_score,\n\t\tCASE\tWHEN\tmp.role = 0\tTHEN\tmp.team_id\n\t\t\tELSE\tother.team_id\n\t\tEND\tAS\thome_team_id,\n\t\tCASE\tWHEN\tmp.role = 0\tTHEN \tother.team_id\n\t\t\tELSE\tmp.team_id\n\t\tEND\tAS\tguest_team_id,\n\t\tmatches.home_score,\n\t\tmatches.guest_score,\n\t\tmp.role\n\t\t\n\tFROM\t\tmatches\n\t\t\tLEFT OUTER JOIN\tmatch_participations\n\t\t\tAS\t\tmp\n\t\t\tON\t\tmatches.id = mp.match_id\n\t\t\tINNER JOIN\tmatch_participations\n\t\t\tAS\t\tother\n\t\t\tON\t\t(mp.match_id = other.match_id AND mp.role <> other.role)\n\n\tWHERE\tmatches.stage_id\tIN\n\t\t(\n\t\tSELECT\tid\n\t\tFROM\tstages\n\t\tWHERE\tstages.cup_id = #{cup}\t#{group && \"AND\tstages.id = #{group}\"}\n\t\t)\n\t)\nAS\t\tresults\nGROUP BY\tteam_id\nORDER BY #{order_by}\nEOF\n end", "def update!(**args)\n @matched_score = args[:matched_score] if args.key?(:matched_score)\n @matched_score_info = args[:matched_score_info] if args.key?(:matched_score_info)\n @phrases_score = args[:phrases_score] if args.key?(:phrases_score)\n @site = args[:site] if args.key?(:site)\n @text = args[:text] if args.key?(:text)\n @trusted_score = args[:trusted_score] if args.key?(:trusted_score)\n end", "def update_team( params )\n\n raise ArgumentError.new(format('wrong type. \\'params\\' must be an Hash, given \\'%s\\'', params.class.to_s)) unless( params.is_a?(Hash) )\n raise ArgumentError.new('missing \\'params\\'') if( params.size.zero? )\n\n v, mv = version.values\n return { 'status' => 404, 'message' => format( 'team has been supported in Grafana since version 5. you use version %s', v) } if(mv < 5)\n\n team_id = validate( params, required: true , var: 'team_id' )\n name = validate( params, required: false, var: 'name' , type: String )\n email = validate( params, required: true , var: 'email', type: String )\n\n if(team_id.is_a?(String))\n o_team = search_team(name: team_id)\n status = o_team.dig('status')\n total_count = o_team.dig('totalCount')\n\n return { 'status' => 404, 'message' => format( 'No Team \\'%s\\' found', team_id) } unless(status == 200 && total_count > 0)\n\n teams = o_team.dig('teams')\n team = teams.detect { |x| x['name'] == team_id }\n\n team_id = team.dig('id')\n end\n\n payload = {\n email: email,\n name: name\n }\n payload.reject!{ |_, y| y.nil? }\n\n endpoint = format( '/api/teams/%d', team_id )\n @logger.debug(\"Updating team with Id #{team_id} (PUT #{endpoint})\") if @debug\n\n put( endpoint, payload.to_json )\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to league_team_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def play_match\r\n reset_scores\r\n\r\n loop do\r\n display_scores\r\n choose_turn_order\r\n play_round\r\n break if someone_won_match?\r\n end\r\n\r\n display_match_result\r\n end", "def match_url\n\t\tself.first_team.name + \" vs \" + self.opponent_team.name + \" \" + self.time.strftime(\"%b %d\")\n\tend", "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 respond_to do |format|\n if @ab_team.update(ab_team_params)\n format.html { redirect_to @ab_team, notice: 'Record was updated' }\n else\n format.html { render :edit }\n format.json { render json: @ab_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @match.update(match_params)\n format.html { redirect_to matches_url, notice: 'Match modifié avec succès' }\n format.json { render :index, status: :ok, location: @match }\n else\n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n (kick and return) if not is_god?\n if (params[:team].has_key? :pass_hash) and (params.has_key? :do_hash)\n clear_pass = params[:team][:pass_hash]\n hash = Digest::SHA1.base64digest clear_pass\n params[:team][:pass_hash] = hash\n end\n @team = Team.find(params[:id])\n points_adjust = params[:points_adjust].to_i\n @team.points = @team.points + points_adjust\n\n pref = 'has_solved_'\n puzzles_to_set_solved = params.keys.select do |k| \n k.start_with? pref\n end.map do |k|\n k.sub(pref, '').to_i\n end\n actual_solved_ids = @team.puzzles.map{|p| p.id}\n # puts actual_solved_ids.inspect\n # puts puzzles_to_set_solved.inspect\n\n puzzles_to_set_solved.each do |pid|\n if not actual_solved_ids.include? pid\n s = Solve.new(:puzzle_id => pid, :team_id => @team.id, :time_solved => Time.now)\n s.save\n end\n end\n actual_solved_ids.each do |pid|\n if not puzzles_to_set_solved.include? pid\n Solve.where(:puzzle_id => pid, :team_id => @team.id).destroy_all\n Callin.where(:puzzle_id => pid, :team_id => @team.id).destroy_all\n end\n end\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_team(opts)\n HelloSign::Resource::Team.new post('/team', body: opts)\n end", "def update!(**args)\n @is_exact_match = args[:is_exact_match] if args.key?(:is_exact_match)\n @location = args[:location] if args.key?(:location)\n end", "def update\n respond_to do |format|\n if @match_detail.update(match_detail_params)\n format.html { redirect_to @match_detail, notice: 'Match detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @match_detail }\n else\n format.html { render :edit }\n format.json { render json: @match_detail.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.71209383", "0.65185446", "0.6468156", "0.64107573", "0.6388802", "0.6321186", "0.6294751", "0.6293475", "0.62733483", "0.6227035", "0.62262446", "0.61532116", "0.60718673", "0.60554236", "0.6043873", "0.6020962", "0.59756714", "0.59331685", "0.5929624", "0.59246397", "0.5921359", "0.59001124", "0.58937275", "0.58439237", "0.5831901", "0.5827023", "0.5825177", "0.58059084", "0.5803553", "0.5790863", "0.5778754", "0.5764338", "0.5757675", "0.57515514", "0.57381946", "0.5737888", "0.57373697", "0.57237357", "0.5721027", "0.57103205", "0.5707191", "0.56998265", "0.56998265", "0.56998265", "0.56998265", "0.56998265", "0.56998265", "0.56998265", "0.56998265", "0.56998265", "0.56998265", "0.5699197", "0.5684425", "0.56836426", "0.5677897", "0.5677897", "0.5664", "0.56638324", "0.56564677", "0.5650419", "0.56392294", "0.5620718", "0.5619924", "0.5614159", "0.560808", "0.56066906", "0.5596733", "0.55872184", "0.5581057", "0.5576759", "0.55739975", "0.5565804", "0.5565804", "0.5553202", "0.55407834", "0.55392796", "0.552553", "0.552487", "0.5523781", "0.55184036", "0.5517221", "0.5516846", "0.5499764", "0.5495006", "0.549368", "0.5493338", "0.5491569", "0.54859394", "0.54710966", "0.5455969", "0.5436965", "0.5431206", "0.54270566", "0.5425451", "0.54240364", "0.5423872", "0.5423342", "0.5422426", "0.54184633", "0.54164773" ]
0.7898494
0
Internal: Resets the team standings in a league points, goals, results of teams in a match. Clears the team instance variable and uses the update_standings method to create new teams and standings.
def reset_standings @teams.clear @matches.each { |match| update_standings(match) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_standings(match)\n\t\thome_team, away_team = get_match_teams(match) \n\t\thome_team_goals, away_team_goals = get_match_goals(match)\n\t\tsave_match_result(home_team, home_team_goals, away_team_goals)\n\t\tsave_match_result(away_team, away_team_goals, home_team_goals)\n\tend", "def reset\n @round = 0\n @turn = 0 \n assign_player_colors\n seat_players\n seed_player_funds\n reset_state_bins\n add_home_state_picks\n pick_who_goes_first\n start_at_first_day\n end", "def reset()\r\n\t\[email protected]\r\n\t\[email protected]\r\n\t\t@usedHelp = 0\r\n\t\t@numberOfStars = 0\r\n\t\t@isFinished = false\r\n\t\t@nbClick = 0\r\n\t\treturn self\r\n\tend", "def reset_game\n @cur_board.clear_board\n @cur_board.setup_board\n @turn = 1\n @player_to_move = \"w\"\n end", "def reset()\n\n @board.locations.each do |row|\n row.each do |location|\n \n # removes all pieces from the board.\n if location\n location.removePiece() \n end\n end\n end\n\n # player 1, remove all pieces\n for piece in @player1.unplayedPieces\n piece = nil\n end\n\n # player2, remove all pieces\n for piece in @player2.unplayedPieces\n piece = nil \n end\n\n # calls start game\n startGame(@player1, @player2)\n\n end", "def resetgame\r\n\t\t \t @wordtable = []\r\n\t\t\t\t\t\t@secretword = \"\"\r\n\t\t\t\t\t\t@turn = 0\r\n\t\t\t\t\t\t@resulta = []\r\n\t\t\t\t\t\t@resultb = []\r\n\t\t\t\t\t\t@winner = 0\r\n\t\t\t\t\t\t@guess = \"\"\r\n\t\t\t\t\t\t@template = \"[]\"\r\n\t\t\t\t\t\t@turnsleft = GOES\r\n\t\t\t\t\t\t@score = 0\r\n\t\t\t\t\t\t@reward = \"\"\r\n\t\t\t\t\t\t@descr = []\r\n\t\t\t\t\t\t@num_words = 0\r\n\t\t\t\t\t\t@spin_flag = false\r\n\t\t\t\t\t\t@game_analysis.clear\r\n\t\t\t\t\t\t@spin_counter=0\r\n\t\t\t\t\t\t@guess_counter=0\r\n\t\t\t\t\t\t@num_guessed = 0\r\n\t\t\t\t\t\t@message = \"Guess a letter from the word/phrase.\"\r\n\t\t\t\t\t\t@web_initial = true\r\n\t\t\t\t\t\t@win = false\r\n\t\t\t\t\t\t@game_over = false\r\n\r\n\t\t end", "def reset_timed_hit\n @timed_hit = nil\n @timed_hit_setup = TIMED_HIT_SETUP.clone\n end", "def reset_scores\n @player1.points = 0\n @player2.points = 0\n end", "def reset_turn\n\t\t#$logger.info \"Entered\"\n\n\t\t#moved = false\n\t\t#moved_to = nil\n\t\t@next_move = nil\n\t\t@enemies = []\n\t\t@friends = nil #[]\n\tend", "def reset_instance_variables_values\n @guess = []\n @feedback = []\n @round = 1\n @winner = ''\n end", "def clear_standings\n if season.current\n Standing.where([\"season_id = ? and game_type_id = ?\", self.season_id, self.game_type_id]).delete_all\n end\n end", "def settle(team)\n self.team = team\n \n if self.is_home_team?\n self.match.home_team = team\n else\n self.match.away_team = team\n end\n self.match.save!\n self.save!\n end", "def reset\n @previous_valid_total_score = 0\n @previous_valid_scores = Hash.new(0)\n end", "def update_teams\n if (home_team != nil and away_team != nil)\n puts \"Updating teams\"\n #match = Matchup.new(params)\n home_team.updateResults(self)\n away_team.updateResults(self)\n home_team.save\n away_team.save\n else\n return false\n end\n end", "def reset_stats\n self.rounds = 0\n self.wins = 0\n self.losses = 0\n self.total_points = 0\n self.rank = 0\n end", "def reset\n @game = Game.new(level, enemyWidth, enemyHeight)\n resetLevels\n @laserFiring = false\n laser.resetEnergy\n # reset the text to indicate 0 score\n # (used for width to center text)\n inGameOptions = \"Score: 0 <Space> for Pause\"\n inGameOptionsWidth = font.getWidth(inGameOptions)\n end", "def start_new_match\n @player1.points = 0\n @player1.deuce = false\n @player1.advantage = false\n @player1.win = false\n @player1.games_won = 0\n @player1.sets_won = 0\n\n @player2.points = 0\n @player2.deuce = false\n @player2.advantage = false\n @player2.win = false\n @player2.games_won = 0\n @player2.sets_won = 0\n end", "def normalize_games\n @match.games.each do |game|\n if !game.player1_score.present? && !game.player2_score.present?\n @match.games.delete(game)\n next\n end\n game.player1_id = @match.player1_id\n game.player2_id = @match.player2_id\n end\n end", "def reset_points_current_giocata\r\n @players_on_match.each do |pl_match|\r\n player_label = pl_match.name.to_sym\r\n @points_status[player_label][:scopa] = 0\r\n @points_status[player_label][:num_cards] = 0\r\n #each player needs last taken cards information\r\n @taken_card_info_last[player_label] = {} \r\n points_gfx_update(pl_match)\r\n end\r\n end", "def reset_stats\n self.actual_rounds = 0\n self.points = 0\n self.average = 0.0\n self.total_correct = 0\n self.total_errors = 0\n self.rank = 0\n \n # total quizzes\n total_quizzes = 0\n self.quiz_team.round_teams.each do |round_team|\n total_quizzes += 1 if round_team.round.complete? and round_team.round.from_prelims?\n end\n self.total_rounds = total_quizzes\n end", "def reset_game\n\t\t#Reset the board\n\t\treset_board\n\t\t\n\t\t# Reset the Points\n\t\t@points_player1 = 0\n\t\t@points_player2 = 0\n\t\t\n\t\t@hud_player1.set_text(\"Player X: \"+@points_player1.to_s)\n\t\t@hud_player2.set_text(\"Player O: \"+@points_player2.to_s)\n\t\t\n\t\t# Setting the X Player to start\n\t\t@playerx = true\n\t\t@current_player.set_text \"Player: X\"\n\tend", "def prepare_for_new_round\n @teams.each(&:prepare_for_new_round)\n end", "def prepare_for_new_round\n @teams.each(&:prepare_for_new_round)\n end", "def reset_abs_data\n # reset killed battlers arrays and the counters\n @killed, @battlers_number = {}, {}\n end", "def reset_self\r\n @hole_cards = []\r\n @folded = false\r\n @bet = 0\r\n end", "def reset_values\n @pot_size = 0\n @committed = 0\n @table_current_bet = 0\n @stage_of_play = 0\n @active_players = @player_positions.clone\n @active_players.each do |player|\n player.hole_cards = []\n player.folded = false\n player.current_bet = 0\n player.max_winnings = 0\n player.max_pot = 0\n player.acted = false\n player.strongest_hand = []\n end\nend", "def reset\n timeline.clear\n end", "def reset\n @guessed = []\n @to_guess = get_word\n @guessing = Array.new(@to_guess.length, \"_\")\n @lives = 10\n end", "def set_team\n @team = current_team\n end", "def reset\n @gold, @metal, @stone, @wood = [5, 1, 1, 1]\n @dwarves, @elves, @gnomes = [3, 3, 0]\n @properties, @score = [12, 0]\n\n self\n end", "def reset\n @prev_pos = @pos = 0\n @match = nil\n self\n end", "def reset\n @players.each { |player| player.reset }\n @dealer.reset\n system \"clear\"\n end", "def reset\n @results = []\n @number = 0\n @score = 0\n @average = 0\n @min = 0\n @max = 0\n end", "def refresh_team_info(*)\n reload # SQL caching causing users to be empty when creating team making all teams ineligible\n set_team_captain\n set_slots_available\n set_eligibility\n cleanup\n end", "def reassign_team_sets\n @delta[:teams].each do |tobj|\n team_set = get_team_set_by_team_id(tobj[:id])\n next if team_set.blank?\n if tobj[:deleted]\n @team_sets_by_team_id.delete(tobj[:id])\n team_set.destroy\n elsif tobj[:new]\n set_team_set_by_team_id(tobj[:new_id], team_set_class.create(assessment_id: @assessment.id, team_id: tobj[:new_id]))\n else \n team_set.team_id = tobj[:new_id]\n team_set.save\n set_team_set_by_team_id(tobj[:new_id], team_set)\n end\n end\n end", "def create\n @match = Match.new(match_params)\n if @match.save\n # destroying first record in schedule for displaying current match in view\n @thisround = Round.last\n @thisround.schedule.shift\n @thisround.save\n @team_one = @match.team_ids.first\n @team_two = @match.team_ids.last\n @player_one_id = Team.find(@team_one).players.first.id\n @player_two_id = Team.find(@team_one).players.last.id\n @player_three_id = Team.find(@team_two).players.first.id\n @player_four_id = Team.find(@team_two).players.last.id\n \n @team_one_wins = 0\n @team_one_losses = 0\n @team_one_ties = 0\n @team_one_goals_for = @match.home\n @team_one_goals_against = @match.away\n \n @team_two_wins = 0\n @team_two_losses = 0\n @team_two_ties = 0\n @team_two_goals_for = @match.away\n @team_two_goals_against = @match.home\n \n @match_balance = 0\n \n \n \n if @match.home > @match.away\n @team_one_wins = 1\n @team_two_losses = 1\n @goal_difference = @match.home - @match.away\n end\n if @match.home < @match.away\n @team_one_losses = 1 \n @team_two_wins = 1\n @goal_difference = @match.away - @match.home\n\n end\n if @match.home == @match.away\n @team_one_ties = 1 \n @team_two_ties = 1\n @goal_difference = 0\n end\n if @goal_difference > 0\n @match_balance = (@goal_difference.fdiv(2).round(0) * 20)\n end\n if @match.bet == 1\n @match_balance += 20\n end\n \n \n \n @statistic_player_one_all_time = StatisticAllTime.where(\"player_id = #{@player_one_id}\").last\n @statistic_player_two_all_time = StatisticAllTime.where(\"player_id = #{@player_two_id}\").last\n @statistic_player_three_all_time = StatisticAllTime.where(\"player_id = #{@player_three_id}\").last\n @statistic_player_four_all_time = StatisticAllTime.where(\"player_id = #{@player_four_id}\").last\n \n @statistic_player_one_last_time = StatisticLastTime.where(\"player_id = #{@player_one_id}\").last\n @statistic_player_two_last_time = StatisticLastTime.where(\"player_id = #{@player_two_id}\").last\n @statistic_player_three_last_time = StatisticLastTime.where(\"player_id = #{@player_three_id}\").last\n @statistic_player_four_last_time = StatisticLastTime.where(\"player_id = #{@player_four_id}\").last\n \n @statistic_player_one_last_season = StatisticLastSeason.where(\"player_id = #{@player_one_id}\").last\n @statistic_player_two_last_season = StatisticLastSeason.where(\"player_id = #{@player_two_id}\").last\n @statistic_player_three_last_season = StatisticLastSeason.where(\"player_id = #{@player_three_id}\").last\n @statistic_player_four_last_season = StatisticLastSeason.where(\"player_id = #{@player_four_id}\").last\n \n if @statistic_player_one_all_time == nil\n @statistic_player_one_all_time = StatisticAllTime.create(player_id: @player_one_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_two_all_time == nil\n @statistic_player_two_all_time = StatisticAllTime.create(player_id: @player_two_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_three_all_time == nil\n @statistic_player_three_all_time = StatisticAllTime.create(player_id: @player_three_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_four_all_time == nil\n @statistic_player_four_all_time = StatisticAllTime.create(player_id: @player_four_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n \n if @statistic_player_one_last_time == nil || (@statistic_player_one_last_time.created_at + 16.hours) < Time.now \n @statistic_player_one_last_time = StatisticLastTime.create(player_id: @player_one_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_two_last_time == nil || (@statistic_player_two_last_time.created_at + 16.hours) < Time.now \n @statistic_player_two_last_time = StatisticLastTime.create(player_id: @player_two_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_three_last_time == nil || (@statistic_player_three_last_time.created_at + 16.hours) < Time.now \n @statistic_player_three_last_time = StatisticLastTime.create(player_id: @player_three_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_four_last_time == nil || (@statistic_player_four_last_time.created_at + 16.hours) < Time.now \n @statistic_player_four_last_time = StatisticLastTime.create(player_id: @player_four_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n \n if @statistic_player_one_last_season == nil || (@statistic_player_one_last_season.created_at + 365.days) < Time.now \n @statistic_player_one_last_season = StatisticLastSeason.create(player_id: @player_one_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_two_last_season == nil || (@statistic_player_two_last_season.created_at + 365.days) < Time.now \n @statistic_player_two_last_season = StatisticLastSeason.create(player_id: @player_two_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_three_last_season == nil || (@statistic_player_three_last_season.created_at + 365.days) < Time.now \n @statistic_player_three_last_season = StatisticLastSeason.create(player_id: @player_three_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n if @statistic_player_four_last_season == nil || (@statistic_player_four_last_season.created_at + 365.days) < Time.now \n @statistic_player_four_last_season = StatisticLastSeason.create(player_id: @player_four_id, wins: 0, losses: 0, ties: 0, goals_for: 0, goals_against: 0, win_streak: 0, lose_streak: 0, tie_streak: 0, balance: 0)\n end\n \n \n @statistic_player_one_all_time = StatisticAllTime.where(\"player_id = #{@player_one_id}\").last\n @statistic_player_two_all_time = StatisticAllTime.where(\"player_id = #{@player_two_id}\").last\n @statistic_player_three_all_time = StatisticAllTime.where(\"player_id = #{@player_three_id}\").last\n @statistic_player_four_all_time = StatisticAllTime.where(\"player_id = #{@player_four_id}\").last\n \n @statistic_player_one_last_time = StatisticLastTime.where(\"player_id = #{@player_one_id}\").last\n @statistic_player_two_last_time = StatisticLastTime.where(\"player_id = #{@player_two_id}\").last\n @statistic_player_three_last_time = StatisticLastTime.where(\"player_id = #{@player_three_id}\").last\n @statistic_player_four_last_time = StatisticLastTime.where(\"player_id = #{@player_four_id}\").last\n \n @statistic_player_one_last_season = StatisticLastSeason.where(\"player_id = #{@player_one_id}\").last\n @statistic_player_two_last_season = StatisticLastSeason.where(\"player_id = #{@player_two_id}\").last\n @statistic_player_three_last_season = StatisticLastSeason.where(\"player_id = #{@player_three_id}\").last\n @statistic_player_four_last_season = StatisticLastSeason.where(\"player_id = #{@player_four_id}\").last\n \n #this part is saving stats-table pre-match for sending info to event \n @players = Player.all\n @all_time_players = []\n @last_time_players = []\n @last_season_players = []\n @players.each do |player|\n if player.statistic_all_times.any?\n @all_time_players.push({\"player\" => player, \"player_balance\" => player.statistic_all_times.last.balance})\n end\n if player.statistic_last_times.any?\n @last_time_players.push({\"player\" => player, \"player_balance\" => player.statistic_last_times.last.balance})\n end\n if player.statistic_last_seasons.any?\n @last_season_players.push({\"player\" => player, \"player_balance\" => player.statistic_last_seasons.last.balance})\n end\n end\n @all_time_players_sorted = @all_time_players.sort_by { |k| k[\"player_balance\"] }.reverse\n @last_time_players_sorted = @last_time_players.sort_by { |k| k[\"player_balance\"] }.reverse\n @last_season_players_sorted = @last_season_players.sort_by { |k| k[\"player_balance\"] }.reverse\n \n #<-----\n\n \n if @team_one_wins > 0\n \n @statistic_player_one_all_time.update_attributes(wins: @statistic_player_one_all_time.wins + @team_one_wins, losses: @statistic_player_one_all_time.losses + @team_one_losses, ties: @statistic_player_one_all_time.ties + @team_one_ties, goals_for: @statistic_player_one_all_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_all_time.goals_against + @team_one_goals_against, win_streak: @statistic_player_one_all_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_one_all_time.balance + @match_balance)\n @statistic_player_two_all_time.update_attributes(wins: @statistic_player_two_all_time.wins + @team_one_wins, losses: @statistic_player_two_all_time.losses + @team_one_losses, ties: @statistic_player_two_all_time.ties + @team_one_ties, goals_for: @statistic_player_two_all_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_all_time.goals_against + @team_one_goals_against, win_streak: @statistic_player_two_all_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_two_all_time.balance + @match_balance)\n @statistic_player_three_all_time.update_attributes(wins: @statistic_player_three_all_time.wins + @team_two_wins, losses: @statistic_player_three_all_time.losses + @team_two_losses, ties: @statistic_player_three_all_time.ties + @team_two_ties, goals_for: @statistic_player_three_all_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_all_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: @statistic_player_three_all_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_three_all_time.balance - @match_balance)\n @statistic_player_four_all_time.update_attributes(wins: @statistic_player_four_all_time.wins + @team_two_wins, losses: @statistic_player_four_all_time.losses + @team_two_losses, ties: @statistic_player_four_all_time.ties + @team_two_ties, goals_for: @statistic_player_four_all_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_all_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: @statistic_player_four_all_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_four_all_time.balance - @match_balance)\n \n @statistic_player_one_last_time.update_attributes(wins: @statistic_player_one_last_time.wins + @team_one_wins, losses: @statistic_player_one_last_time.losses + @team_one_losses, ties: @statistic_player_one_last_time.ties + @team_one_ties, goals_for: @statistic_player_one_last_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_last_time.goals_against + @team_one_goals_against, win_streak: @statistic_player_one_last_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_one_last_time.balance + @match_balance)\n @statistic_player_two_last_time.update_attributes(wins: @statistic_player_two_last_time.wins + @team_one_wins, losses: @statistic_player_two_last_time.losses + @team_one_losses, ties: @statistic_player_two_last_time.ties + @team_one_ties, goals_for: @statistic_player_two_last_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_last_time.goals_against + @team_one_goals_against, win_streak: @statistic_player_two_last_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_two_last_time.balance + @match_balance)\n @statistic_player_three_last_time.update_attributes(wins: @statistic_player_three_last_time.wins + @team_two_wins, losses: @statistic_player_three_last_time.losses + @team_two_losses, ties: @statistic_player_three_last_time.ties + @team_two_ties, goals_for: @statistic_player_three_last_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_last_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: @statistic_player_three_last_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_three_last_time.balance - @match_balance)\n @statistic_player_four_last_time.update_attributes(wins: @statistic_player_four_last_time.wins + @team_two_wins, losses: @statistic_player_four_last_time.losses + @team_two_losses, ties: @statistic_player_four_last_time.ties + @team_two_ties, goals_for: @statistic_player_four_last_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_last_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: @statistic_player_four_last_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_four_last_time.balance - @match_balance)\n \n @statistic_player_one_last_season.update_attributes(wins: @statistic_player_one_last_season.wins + @team_one_wins, losses: @statistic_player_one_last_season.losses + @team_one_losses, ties: @statistic_player_one_last_season.ties + @team_one_ties, goals_for: @statistic_player_one_last_season.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_last_season.goals_against + @team_one_goals_against, win_streak: @statistic_player_one_last_season.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_one_last_season.balance + @match_balance)\n @statistic_player_two_last_season.update_attributes(wins: @statistic_player_two_last_season.wins + @team_one_wins, losses: @statistic_player_two_last_season.losses + @team_one_losses, ties: @statistic_player_two_last_season.ties + @team_one_ties, goals_for: @statistic_player_two_last_season.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_last_season.goals_against + @team_one_goals_against, win_streak: @statistic_player_two_last_season.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_two_last_season.balance + @match_balance)\n @statistic_player_three_last_season.update_attributes(wins: @statistic_player_three_last_season.wins + @team_two_wins, losses: @statistic_player_three_last_season.losses + @team_two_losses, ties: @statistic_player_three_last_season.ties + @team_two_ties, goals_for: @statistic_player_three_last_season.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_last_season.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: @statistic_player_three_last_season.lose_streak + 1, tie_streak: 0, balance: @statistic_player_three_last_season.balance - @match_balance)\n @statistic_player_four_last_season.update_attributes(wins: @statistic_player_four_last_season.wins + @team_two_wins, losses: @statistic_player_four_last_season.losses + @team_two_losses, ties: @statistic_player_four_last_season.ties + @team_two_ties, goals_for: @statistic_player_four_last_season.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_last_season.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: @statistic_player_four_last_season.lose_streak + 1, tie_streak: 0, balance: @statistic_player_four_last_season.balance - @match_balance)\n \n end\n if @team_one_losses > 0\n \n @statistic_player_one_all_time.update_attributes(wins: @statistic_player_one_all_time.wins + @team_one_wins, losses: @statistic_player_one_all_time.losses + @team_one_losses, ties: @statistic_player_one_all_time.ties + @team_one_ties, goals_for: @statistic_player_one_all_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_all_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: @statistic_player_one_all_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_one_all_time.balance - @match_balance)\n @statistic_player_two_all_time.update_attributes(wins: @statistic_player_two_all_time.wins + @team_one_wins, losses: @statistic_player_two_all_time.losses + @team_one_losses, ties: @statistic_player_two_all_time.ties + @team_one_ties, goals_for: @statistic_player_two_all_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_all_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: @statistic_player_two_all_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_two_all_time.balance - @match_balance)\n @statistic_player_three_all_time.update_attributes(wins: @statistic_player_three_all_time.wins + @team_two_wins, losses: @statistic_player_three_all_time.losses + @team_two_losses, ties: @statistic_player_three_all_time.ties + @team_two_ties, goals_for: @statistic_player_three_all_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_all_time.goals_against + @team_two_goals_against, win_streak: @statistic_player_three_all_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_three_all_time.balance + @match_balance)\n @statistic_player_four_all_time.update_attributes(wins: @statistic_player_four_all_time.wins + @team_two_wins, losses: @statistic_player_four_all_time.losses + @team_two_losses, ties: @statistic_player_four_all_time.ties + @team_two_ties, goals_for: @statistic_player_four_all_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_all_time.goals_against + @team_two_goals_against, win_streak: @statistic_player_four_all_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_four_all_time.balance + @match_balance)\n \n @statistic_player_one_last_time.update_attributes(wins: @statistic_player_one_last_time.wins + @team_one_wins, losses: @statistic_player_one_last_time.losses + @team_one_losses, ties: @statistic_player_one_last_time.ties + @team_one_ties, goals_for: @statistic_player_one_last_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_last_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: @statistic_player_one_last_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_one_last_time.balance - @match_balance)\n @statistic_player_two_last_time.update_attributes(wins: @statistic_player_two_last_time.wins + @team_one_wins, losses: @statistic_player_two_last_time.losses + @team_one_losses, ties: @statistic_player_two_last_time.ties + @team_one_ties, goals_for: @statistic_player_two_last_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_last_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: @statistic_player_two_last_time.lose_streak + 1, tie_streak: 0, balance: @statistic_player_two_last_time.balance - @match_balance)\n @statistic_player_three_last_time.update_attributes(wins: @statistic_player_three_last_time.wins + @team_two_wins, losses: @statistic_player_three_last_time.losses + @team_two_losses, ties: @statistic_player_three_last_time.ties + @team_two_ties, goals_for: @statistic_player_three_last_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_last_time.goals_against + @team_two_goals_against, win_streak: @statistic_player_three_last_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_three_last_time.balance + @match_balance)\n @statistic_player_four_last_time.update_attributes(wins: @statistic_player_four_last_time.wins + @team_two_wins, losses: @statistic_player_four_last_time.losses + @team_two_losses, ties: @statistic_player_four_last_time.ties + @team_two_ties, goals_for: @statistic_player_four_last_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_last_time.goals_against + @team_two_goals_against, win_streak: @statistic_player_four_last_time.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_four_last_time.balance + @match_balance)\n \n @statistic_player_one_last_season.update_attributes(wins: @statistic_player_one_last_season.wins + @team_one_wins, losses: @statistic_player_one_last_season.losses + @team_one_losses, ties: @statistic_player_one_last_season.ties + @team_one_ties, goals_for: @statistic_player_one_last_season.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_last_season.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: @statistic_player_one_last_season.lose_streak + 1, tie_streak: 0, balance: @statistic_player_one_last_season.balance - @match_balance)\n @statistic_player_two_last_season.update_attributes(wins: @statistic_player_two_last_season.wins + @team_one_wins, losses: @statistic_player_two_last_season.losses + @team_one_losses, ties: @statistic_player_two_last_season.ties + @team_one_ties, goals_for: @statistic_player_two_last_season.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_last_season.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: @statistic_player_two_last_season.lose_streak + 1, tie_streak: 0, balance: @statistic_player_two_last_season.balance - @match_balance)\n @statistic_player_three_last_season.update_attributes(wins: @statistic_player_three_last_season.wins + @team_two_wins, losses: @statistic_player_three_last_season.losses + @team_two_losses, ties: @statistic_player_three_last_season.ties + @team_two_ties, goals_for: @statistic_player_three_last_season.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_last_season.goals_against + @team_two_goals_against, win_streak: @statistic_player_three_last_season.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_three_last_season.balance + @match_balance)\n @statistic_player_four_last_season.update_attributes(wins: @statistic_player_four_last_season.wins + @team_two_wins, losses: @statistic_player_four_last_season.losses + @team_two_losses, ties: @statistic_player_four_last_season.ties + @team_two_ties, goals_for: @statistic_player_four_last_season.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_last_season.goals_against + @team_two_goals_against, win_streak: @statistic_player_four_last_season.win_streak + 1, lose_streak: 0, tie_streak: 0, balance: @statistic_player_four_last_season.balance + @match_balance)\n \n end\n if @team_one_ties > 0\n \n @statistic_player_one_all_time.update_attributes(wins: @statistic_player_one_all_time.wins + @team_one_wins, losses: @statistic_player_one_all_time.losses + @team_one_losses, ties: @statistic_player_one_all_time.ties + @team_one_ties, goals_for: @statistic_player_one_all_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_all_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_one_all_time.tie_streak + 1)\n @statistic_player_two_all_time.update_attributes(wins: @statistic_player_two_all_time.wins + @team_one_wins, losses: @statistic_player_two_all_time.losses + @team_one_losses, ties: @statistic_player_two_all_time.ties + @team_one_ties, goals_for: @statistic_player_two_all_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_all_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_two_all_time.tie_streak + 1)\n @statistic_player_three_all_time.update_attributes(wins: @statistic_player_three_all_time.wins + @team_two_wins, losses: @statistic_player_three_all_time.losses + @team_two_losses, ties: @statistic_player_three_all_time.ties + @team_two_ties, goals_for: @statistic_player_three_all_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_all_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_three_all_time.tie_streak + 1)\n @statistic_player_four_all_time.update_attributes(wins: @statistic_player_four_all_time.wins + @team_two_wins, losses: @statistic_player_four_all_time.losses + @team_two_losses, ties: @statistic_player_four_all_time.ties + @team_two_ties, goals_for: @statistic_player_four_all_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_all_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_four_all_time.tie_streak + 1)\n \n @statistic_player_one_last_time.update_attributes(wins: @statistic_player_one_last_time.wins + @team_one_wins, losses: @statistic_player_one_last_time.losses + @team_one_losses, ties: @statistic_player_one_last_time.ties + @team_one_ties, goals_for: @statistic_player_one_last_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_last_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_one_last_time.tie_streak + 1)\n @statistic_player_two_last_time.update_attributes(wins: @statistic_player_two_last_time.wins + @team_one_wins, losses: @statistic_player_two_last_time.losses + @team_one_losses, ties: @statistic_player_two_last_time.ties + @team_one_ties, goals_for: @statistic_player_two_last_time.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_last_time.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_two_last_time.tie_streak + 1)\n @statistic_player_three_last_time.update_attributes(wins: @statistic_player_three_last_time.wins + @team_two_wins, losses: @statistic_player_three_last_time.losses + @team_two_losses, ties: @statistic_player_three_last_time.ties + @team_two_ties, goals_for: @statistic_player_three_last_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_last_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_three_last_time.tie_streak + 1)\n @statistic_player_four_last_time.update_attributes(wins: @statistic_player_four_last_time.wins + @team_two_wins, losses: @statistic_player_four_last_time.losses + @team_two_losses, ties: @statistic_player_four_last_time.ties + @team_two_ties, goals_for: @statistic_player_four_last_time.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_last_time.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_four_last_time.tie_streak + 1)\n \n @statistic_player_one_last_season.update_attributes(wins: @statistic_player_one_last_season.wins + @team_one_wins, losses: @statistic_player_one_last_season.losses + @team_one_losses, ties: @statistic_player_one_last_season.ties + @team_one_ties, goals_for: @statistic_player_one_last_season.goals_for + @team_one_goals_for, goals_against: @statistic_player_one_last_season.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_one_last_season.tie_streak + 1)\n @statistic_player_two_last_season.update_attributes(wins: @statistic_player_two_last_season.wins + @team_one_wins, losses: @statistic_player_two_last_season.losses + @team_one_losses, ties: @statistic_player_two_last_season.ties + @team_one_ties, goals_for: @statistic_player_two_last_season.goals_for + @team_one_goals_for, goals_against: @statistic_player_two_last_season.goals_against + @team_one_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_two_last_season.tie_streak + 1)\n @statistic_player_three_last_season.update_attributes(wins: @statistic_player_three_last_season.wins + @team_two_wins, losses: @statistic_player_three_last_season.losses + @team_two_losses, ties: @statistic_player_three_last_season.ties + @team_two_ties, goals_for: @statistic_player_three_last_season.goals_for + @team_two_goals_for, goals_against: @statistic_player_three_last_season.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_three_last_season.tie_streak + 1)\n @statistic_player_four_last_season.update_attributes(wins: @statistic_player_four_last_season.wins + @team_two_wins, losses: @statistic_player_four_last_season.losses + @team_two_losses, ties: @statistic_player_four_last_season.ties + @team_two_ties, goals_for: @statistic_player_four_last_season.goals_for + @team_two_goals_for, goals_against: @statistic_player_four_last_season.goals_against + @team_two_goals_against, win_streak: 0, lose_streak: 0, tie_streak: @statistic_player_four_last_season.tie_streak + 1)\n \n end \n respond_with @match, location: create_event(@match, @all_time_players_sorted, @last_season_players_sorted, @last_time_players_sorted)\n end\n end", "def setup_reset\n stop_all_movements\n goto(@ori_x, @ori_y, @acts[1], @acts[2])\n end", "def setup_reset\n stop_all_movements\n goto(@ori_x, @ori_y, @acts[1], @acts[2])\n end", "def reset\n @gold_coins = 0\n @health_points = 10\n @lives = 5\n end", "def reset\n self.time_step = DEFAULT_TIME_STEP\n self.availiable_days = DEFAULT_AVAILIABLE_DAYS\n self.availiable_steps = DEFAULT_AVAILIABLE_STEPS\n self.steps_day_shift = DEFAULT_STEPS_DAY_SHIFT\n end", "def clear!\n @match_x = nil\n @match_y = nil\n end", "def reset\n @player_status = \"in\" \n @hands = [] \n @hands_status = [] \n @bets = [] \n @values = [] \n @cur = 0 \n end", "def reset\n @results = @hits = @verified_hits = @total = @solr_response = @doc_ids = nil\n end", "def reset\n @results = @hits = @verified_hits = @total = @solr_response = @doc_ids = nil\n end", "def improve_teams\n @teams = steepest_ascent_hill(@teams)\n end", "def white_turn\n @teams[:white].current_team = true\n @teams[:black].current_team = false\n @current_team = @teams[:white]\n end", "def reset\n @lives = 7\n @letter = ''\n @bank = []\n @guess = []\n @word = ''\n set_word\n set_guess\n end", "def reset_player args\n args.state.player.x = 0\n args.state.player.y = args.state.bridge_top\n args.state.player.dy = 0\n args.state.player.dx = 0\n args.state.enemy.hammers.clear # empties hammer collection\n args.state.enemy.hammer_queue.clear # empties hammer_queue\n args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time)\nend", "def reset_player args\n args.state.player.x = 0\n args.state.player.y = args.state.bridge_top\n args.state.player.dy = 0\n args.state.player.dx = 0\n args.state.enemy.hammers.clear # empties hammer collection\n args.state.enemy.hammer_queue.clear # empties hammer_queue\n args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time)\nend", "def reset\n @sets = {}\n self\n end", "def reset\n @lives = 3\n @score = 0\n @answer = \"\"\n end", "def reset\n\t\tself.tlvs = []\n\tend", "def reset\n\t\tself.tlvs = []\n\tend", "def set_player_team!\n player.update!(team_name: team_name) if player.team_name != team_name\n piece.update!(team_name: team_name) if piece.team_name != team_name\n end", "def reset\n @grid = empty_grid\n end", "def prepare_for_new_round\n @units.clear\n @heroes.clear\n @minions.clear\n @mercenaries.clear\n end", "def prepare_for_new_round\n @units.clear\n @heroes.clear\n @minions.clear\n @mercenaries.clear\n end", "def reset_game\n @current_room_id = 9\n find_room_by_id(9).isLocked = true\n find_item_by_id(8).show_item = false\n @inventory.delete(8)\n @talk_id = 18\n end", "def reset\n self.turn = 1\n self.state = ONGOING\n self.board # Triggers default value if necessary.\n self.players\n self.currentPlayer = self.players.first\n board_each do |r,c|\n self.board[r][c] = nil\n changed(true)\n notify_observers U_BOARD, r, c, self.board[r][c]\n end\n binding.pry\n postcondition do\n raise \"Turn should be set to one after reset.\" unless self.turn == 1\n end\n # Let the computer move if necessary.\n computer_actions\n end", "def matchups\n\t# we will create a temporary array\n\t# for use only in this method,\n\t# so we don't effect the original\n\t# @teams array with an deletions\n\ttemp_arr = []\n\[email protected] do |t|\n\t\ttemp_arr.push(t)\n\tend\n\n\tif temp_arr.length % 2 != 0\n\t\t# check if there is an odd number of teams,\n\t\t# if there is an odd number, we pull pull\n\t\t# out the top one and give them a bye week\n\t\tputs \"(1) #{temp_arr.delete_at(0).name} has a bye\"\n\t\t# and now we have an even number of teams\n\tend\n\n\t# match up the even amount of teams,\n\t# assuming there are any teams...\n\twhile temp_arr.length > 0\n\t\tteam1 = temp_arr.delete_at(0)\n\t\t# team 1 is the first one in array\n\t\tteam2 = temp_arr.pop\n\t\t# team 2 is last in array\n\t\tputs \"(#{team1.ranking}) #{team1.name} versus (#{team2.ranking}) #{team2.name}\"\n\t\t# this continues until no teams are left in the array\n\t\t# Example: \n\t\t# [1,2,3,4,5,6]\n\t\t# team1 = 1\n\t\t# team2 = 6\n\t\t# [2,3,4,5]\n\t\t# team1 = 2\n\t\t# team2 = 5\n\t\t# [3,4]\n\t\t# team1 = 3\n\t\t# team2 = 4\n\tend\n\n\treturn_to_menu\nend", "def get_standings(games)\n teams = Hash.new\n games.each do |game|\n division_id = game.division_id\n home_team = game.home_team\n away_team = game.visiting_team\n if(teams[home_team.name].nil?)\n teams[home_team.name] = {:win => 0, :loss => 0, :tie => 0, :point=> 0}\n end\n\n if(teams[away_team.name].nil?)\n teams[away_team.name] = {:win => 0, :loss => 0, :tie => 0, :point => 0}\n end\n if(game.home_team_score && game.visiting_team_score)\n if(game.home_team_score > game.visiting_team_score)\n # home team won\n teams[home_team.name][:win] += 1\n teams[home_team.name][:point] += 5\n # visiting team loss\n teams[away_team.name][:loss] += 1\n elsif(game.home_team_score < game.visiting_team_score)\n # home team loss\n teams[home_team.name][:loss] += 1\n #visiting team won\n teams[away_team.name][:win] += 1\n teams[away_team.name][:point] += 5\n else\n # tie game\n teams[home_team.name][:tie] += 1\n teams[home_team.name][:point] += 1\n teams[away_team.name][:tie] += 1\n teams[away_team.name][:point] += 1\n end\n end\n end\n teams.each do |team, value|\n puts team\n total_games = value[:win] + value[:loss] + value[:tie]\n if total_games > 0 \n win_percentage = value[:win]/total_games.to_f\n else\n win_percentage = 0\n end \n value[:percentage] = win_percentage\n end\n teams_sorted = teams.sort_by{ |k, v| v[:point]}.reverse\n return teams_sorted\n end", "def match!(teams,team)\n my_rating = team_rating(team)\n best = nil\n best_team = nil\n teams.teams.each do |other|\n\n if other.members.size < other.min_for_match\n next\n end\n\n if rating = team_rating(other)\n diff = my_rating > rating ? my_rating - rating : rating - my_rating\n if best.nil? || diff < best\n best = diff\n best_team = other\n end\n end\n end\n\n if best_team\n GameMachine::Models::StartMatch.new(:team_names => [team.name,best_team.name])\n else\n nil\n end\n end", "def black_turn\n @teams[:white].current_team = false\n @teams[:black].current_team = true\n @current_team = @teams[:black]\n end", "def reset\n\t\t@board = Hash[:one => 1, :two => 2, :three => 3, :four => 4, :five => 5, :six => 6, :seven => 7, :eight => 8, :nine => 9]\n\t\tself.display\n\tend", "def resetStates()\r\n @players.each do |player|\r\n if(player.money > 0)\r\n player.state = \"fine\"\r\n else\r\n player.state = \"broke\"\r\n end\r\n end\r\n end", "def reset_stats!\r\n @@available_locales = nil\r\n @@enabled_locales = nil\r\n @@language_completion = nil\r\n @@all_translation_info = nil\r\n @@datetime_vars = nil\r\n end", "def set_match_team\n @match_team = MatchTeam.find(params[:id])\n end", "def destroy_standings\n for s in standings(true)\n Standings.delete(s.id)\n end\n end", "def reset\n @current = 0\n @matched = false\n end", "def reset\n @equations = nil\n @results = nil\n end", "def reset_game()\n # If money in pot, distribute\n while (self.pot > 0)\n winners = []\n # In case where everyone has folded, set the winner to whoever is left\n if self.players.where(:in_hand => true).length <= 1\n winners = self.players.where(:in_hand => true)\n else\n #gets people with highest score\n winners = get_winners()\n end\n winners.each do |winner|\n #TO IMPLEMENT: more advanced side pots\n winner.money += self.pot / winners.length()\n winner.save\n end\n self.pot = 0\n end\n # reset deck of cards\n self.cards.where.not(:location => -1).each do |card|\n card.location = -1\n card.save\n end\n # reset amount each player has in the pot to 0\n self.players.each do |player|\n player.in_hand = true\n player.in_pot_hand = 0\n player.in_pot_current = 0\n player.hand = ''\n player.save\n end\n # reset pot to empty, increment dealer if not first hand\n if self.round != -1\n self.dealer = (self.dealer + 1)%10 + 10\n end\n # makes sure a player exists where the dealer is set\n while self.players.where(:location => self.dealer).length == 0\n self.dealer = (self.dealer + 1)%10 + 10\n end\n self.round = 0\n self.high_bet = 0\n self.high_better = get_next_player(self.dealer)\n self.save\n deal(self.round)\n end", "def set_team_match\n @team_match = TeamMatch.find(params[:id])\n end", "def restructure_team_data!\n if !site.data['team'].nil? && site.data['team'].respond_to?(:keys)\n site.data['team'].keys.each do |key|\n site.data['team'][site.data['team'][key]['name']] = site.data['team'].delete(key)\n end\n end\n end", "def reset(previous = nil)\n @rooms = []\n @afk_users = previous ? previous.afk_users : []\n @notes = previous ? previous.notes : []\n @quotes = previous ? previous.quotes : []\n @rooms_names = previous ? previous.room_names : []\n @num_processed = previous ? previous.num_processed : 0\n \n # sit around the campfire..\n @campfire = Tinder::Campfire.new(@address)\n @campfire.login email, password\n \n # setup rooms and threads\n threads = []\n @room_names.each do |name|\n room = @campfire.find_room_by_name(name)\n @rooms << room\n threads << RoomThread.new(room, self)\n end\n threads.each(&:join)\n \n # yay, time for play\n puts \"Ready in all rooms - processing.\"\n end", "def reset!\n _central_mwares.clear\n _mwares.clear\n _before.clear\n _after.clear\n end", "def reset_meeting_times\n leader = User.where(:id => self.creator).first\n self.initialize_group_meeting_times(leader)\n self.users.each do |user|\n self.update_group_meeting_times(user)\n end\n end", "def reset\n @time_travel_offsets = []\n end", "def reset\n update_attributes(year_of_study: nil,\n faculty_id: nil,\n department_id: nil,\n course_id: nil)\n\n self.uni_modules.each do |uni_module|\n unsave_module(uni_module)\n end\n\n self.pathways.each do |pathway|\n self.pathways.delete(pathway)\n end\n end", "def reset\n (1..9).each { |key| @squares[key] = Square.new }\n end", "def reset\n (1..9).each { |key| @squares[key] = Square.new }\n end", "def simulate\n self.ticket_price = self.local.ticket_price\n create_line_ups(self.local.starters, self.local.suppliers, self.guest.starters,\n self.guest.suppliers)\n available_minutes = create_minutes\n self.details = Simulator.simulate_match(self.local, self.guest, MatchDetail::ACTIONS_PLAY, available_minutes)\n self.spectators = Simulator.simulate_spectators(self.local, self.guest)\n self.local_goals = self.details.goals.\n find(:all, :conditions => {:club_id => self.local}).length\n self.guest_goals = self.details.goals.\n find(:all, :conditions => {:club_id => self.guest}).length\n\n end", "def new\n @game_set = GameSet.find(params[:game_set_id])\n @match = @game_set.match\n @game = @game_set.games.build\n @hangout = @match.hangout\n @league = @match.league\n @teams = @league.structured ? @league.teams : @hangout.teams\n @game.team_one_winner ||= true\n \n @p1 = @game.plays_ins.build\n @p2 = @game.plays_ins.build\n\n if @match.in_progress\n @team1 = @match.games.first.plays_ins.last.team\n @team2 = @match.games.first.plays_ins.first.team\n\n @p1.team_id = @team1.id\n @p2.team_id = @team2.id\n else\n @team1 = @team2 = @teams\n end\n\n\n @p1.build_scores(@league)\n @p2.build_scores(@league)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @game }\n end\n end", "def reset_all()\n\[email protected] = \"$0\"\n\tfor i in 0..4\n\t\t@playerimages[i].path = \"images/#{$game.players[0].hand[i]}.png\" \n\tend\n\[email protected] = $game.ranks[$game.players[0].ranks[0]]\n\[email protected] = \"-----\"\n\[email protected] = $game.roundnum\n\tfor i in 0..3\n\t\t@fflag[i].text = \"\"\n\tend\n\nend", "def stats_reset\n @stats = nil\n end", "def reset_for_new_round(role)\n if role == 'code breaker'\n @@player_key = []\n puts \"You have #{12 - @@turn_counter} turns left.\"\n else\n @computer_key = []\n keep_color_matches = []\n answer = ''\n puts \"The computer has #{12 - @@turn_counter} turns left.\"\n puts \"Type 'go' to play the next round\"\n answer = gets.chomp.downcase.strip until answer == 'go'\n end\n @@direct_matches = []\n @@color_matches = []\n end", "def reset_player_scores()\n @players.each do |player|\n player.score = 0\n player.save\n end\n end", "def set_team (game)\n\n\t\tif bet_type == \"lay\"\n \t\tif game.spread < 0\n \t\tself.team = \"home\"\n \t\tend\n \t\tif game.spread > 0\n \t\tself.team = \"away\"\n \t\tend\n\t\tend\n\t\tif bet_type == \"take\"\n\t\t\tif game.spread > 0\n\t\t\t\tself.team = \"home\"\n\t\t\tend\n\t\t\tif game.spread < 0\n\t\t\t\tself.team = \"away\"\n\t\t\tend\n\t\tend\n\t\tif bet_type == \"over\" || bet_type == \"under\"\n\t\t\t\tself.team = \"-\"\n\t\tend\n\tend", "def reset\n @lbs.clear\n end", "def clear_scores\n @scores.clear\n @scores_ordered_names.clear\n @scores_idx = -1\n self\n end", "def reset\n @cursor = Point.new(0, 0)\n @delta = Point.new(0, 1)\n @stores = Code::FINAL_CONSONANTS.times.map do |consonant|\n case consonant\n when 21 then Queue.new # ㅇ\n when 27 then Port.new # ㅎ\n else Stack.new\n end\n end\n @selected_store = @stores[0]\n @finished = false\n end", "def game_reset\n\t\tuser_hash = {\n\t\t0 => \" \",\n\t\t1 => \" \",\n\t\t2 => \" \",\n\t\t3 => \" \",\n\t\t4 => \" \",\n\t\t5 => \" \",\n\t\t6 => \" \",\n\t\t7 => \" \",\n\t\t8 => \" \"\n\t\t}\n\t\tstart_game(user_hash)\n\tend", "def set_game(i, games, played, teams, rem)\n # Convenience vars: N of teams and total N of games.\n nt = teams.size\n ng = (nt - 1) * nt / 2\n\n # If we are working on the first game of a round,\n # reset rem (the teams remaining to be scheduled in\n # the round) to the full list of teams.\n rem = Array.new(teams) if i % (nt / 2) == 0\n\n # Remove the top-seeded team from rem.\n top = rem.sort_by { |tt| teams.index(tt) }.pop\n rem.delete(top)\n\n # Find the opponent for the top-seeded team.\n rem.each_with_index do |opp, j|\n # If top and opp haven't already been paired, schedule the matchup.\n next if played[top][opp]\n games[i] = [ top, opp ]\n\n played[top][opp] = true\n\n # create the round\n create_group_stage_game(games[i]) \n\n # Create a new list of remaining teams, removing opp\n # and putting rejected opponents at the end of the list.\n rem_new = [ rem[j + 1 .. rem.size - 1], rem[0, j] ].compact.flatten\n\n # Method has succeeded if we have scheduled the last game\n # or if all subsequent calls succeed.\n return true if i + 1 == ng\n return true if set_game(i + 1, games, played, teams, rem_new)\n\n # The matchup leads down a bad path. Unschedule the game\n # and proceed to the next opponent.\n played[top][opp] = false\n destroy_group_stage_game(games[i]) \n # puts \" *** removed *** \" \n end\n\n return false\n end", "def reset\n @conditions.reset\n @results = []\n end", "def reset\n\t\tfor i in (0...9)\n\t\t\t@board[i] = nil\n\t\tend\n\tend", "def update_match_winner\n match.set_current_match_winner\n end", "def create\n sport_id = user_session.get(:filter_sport_id) # okay that's how mistakes happen.... TODO!!!\n sport = Sport.find(sport_id)\n team_points = Hash.new(0)\n team_games = Hash.new(0)\n team_goals_for = Hash.new(0)\n team_goals_against = Hash.new(0)\n\n sport.leagues.each do |league|\n league.games.each do |game| #iterate through EVERY game in EVERY league, calculate points, set it in team table\n if game.tie == false and not game.winner_id.nil? # no tie and winner exists\n team_points[game.winner_id] += 2\n team_games[game.team_1_id] += 1\n team_games[game.team_2_id] += 1\n elsif game.tie == true\n team_points[game.team_1_id] += 1\n team_points[game.team_2_id] += 1\n team_games[game.team_1_id] += 1\n team_games[game.team_2_id] += 1\n end # else, game has not been played yet\n\n # go through all the sets and calculate goal difference\n game.gamesets.each do |set|\n team_goals_for[game.team_1_id] += set.points_team_1.to_i\n team_goals_for[game.team_2_id] += set.points_team_2.to_i\n team_goals_against[game.team_1_id] += set.points_team_2.to_i\n team_goals_against[game.team_2_id] += set.points_team_1.to_i\n end\n\n end\n\n league.teams.each do |team|\n team.points = team_points[team.id] #|| 0 should work without this\n team.game_count = team_games[team.id]\n team.goals_for = team_goals_for[team.id]\n team.goals_against = team_goals_against[team.id]\n team.goals_difference = team_goals_for[team.id] - team_goals_against[team.id]\n team.save\n end\n end\n redirect_to rankings_path, success: t(:object_created)\n end", "def join_match\n match = Match.create()\n @game.update_attributes(match_id: match.id)\n 2.times do |time|\n game = Game.new \n game.attributes = @game.attributes.except(\"id\", \"team_score\", \"opponent_team_score\")\n game.save\n end\n listing_games\n end", "def reset()\n # Reset to random position, bounded by the window dimensions\n @position = {:x => rand((0.5*@sprite.width)..Params::WINDOW_WIDTH-(0.5*@sprite.width)),\n :y => rand((0.5*@sprite.width)..Params::WINDOW_HEIGHT-(0.5*@sprite.height))}\n # Reset fitness to base fitness\n @fitness = Params::BASE_FITNESS\n # Reset age to zero.\n @age = 0\n # Reset number of goals reached.\n @goals_reached = 0\n # Reset rotation to random angle (in radians).\n @angle = rand(0.0..Params::TWO_PI)\n end", "def reset_score\n @score = 0\n end", "def start_round!\n @players.each { |player| player.empty_hand! }\n @players_in_round.replace(@players)\n @round_winner = nil\n ante_up!\n deal_initial_hands\n end" ]
[ "0.6546848", "0.65100235", "0.60607445", "0.5985785", "0.59726113", "0.5947998", "0.5935943", "0.5896813", "0.58856", "0.58662164", "0.5864433", "0.58328974", "0.5800734", "0.57623667", "0.5756863", "0.57123566", "0.5697158", "0.5684034", "0.5679345", "0.56528586", "0.5648832", "0.56403047", "0.56403047", "0.5629124", "0.56251615", "0.56216", "0.5615098", "0.5613748", "0.5589599", "0.55719143", "0.55557203", "0.5550513", "0.5521316", "0.5521095", "0.5502924", "0.54941154", "0.5442336", "0.5442336", "0.54235584", "0.54030895", "0.5400217", "0.5400055", "0.5383703", "0.5383703", "0.53808045", "0.53740436", "0.5373994", "0.53723395", "0.53723395", "0.5370763", "0.5370289", "0.5363506", "0.5363506", "0.5362454", "0.5361809", "0.53470427", "0.53470427", "0.53353965", "0.5328929", "0.5316076", "0.5315132", "0.53081447", "0.5290573", "0.5290282", "0.527226", "0.5256555", "0.5248015", "0.5237352", "0.52367175", "0.5228391", "0.5224126", "0.5209487", "0.52083284", "0.52005595", "0.5185564", "0.51835793", "0.5179639", "0.5171212", "0.5170528", "0.5170528", "0.5168081", "0.5157113", "0.51561344", "0.5155342", "0.5130338", "0.5115499", "0.5108655", "0.5107105", "0.5104775", "0.50956583", "0.5092762", "0.509261", "0.50901204", "0.50850314", "0.5074512", "0.50599086", "0.5057799", "0.50571537", "0.50553346", "0.5050312" ]
0.8577282
0
Called for every frame
def update @player.shape.body.reset_forces 6.times do if button_down? Gosu::KbLeft or button_down? Gosu::GpLeft then @player.move_left end if button_down? Gosu::KbRight or button_down? Gosu::GpRight then @player.move_right end #if button_down? Gosu::KbUp or button_down? Gosu::GpRight then # @player.shape.body.a += 0.1 # # puts @player.shape.body.a.inspect #end #if button_down? Gosu::KbDown or button_down? Gosu::GpRight then # @player.shape.body.a -= 0.1 # puts @player.shape.body.a.inspect #end @space.step 1.0/10.0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frames; end", "def frame; end", "def frame=(pos); end", "def c_frame?; end", "def frame_reset\n @delta_time = @frame_to_skip = 0\n @ruby_time = @current_time = @last_time = @last_second_time = Time.new\n reset_gc_time\n reset_ruby_time\n @last_frame_count = Graphics.frame_count\n end", "def updateDebugFPS(frame)\n end", "def end_frame\n end", "def update\n @currentFrame += 1\n self.updateElements\n if [email protected]? && @totalFrames >= 0 && @currentFrame >= @totalFrames\n self.restart\n end\n end", "def initial_frame(bindings); end", "def update\n super\n # update_bitmap # Not needed for now\n update_screen # Update the position the graphic should be displayed\n # update_frame # Update the frame count (if wanted later)\n end", "def update\n if @frame == @gfx.length - 1\n @frame = 0\n elsif @frame == 7\n @frame += 1\n @deleted = true\n else\n @frame += 1\n end\n end", "def blit; end", "def update_frame\n # If animation frame is different, change graphic\n if @anim_frame != @unit.frame\n @anim_frame = @unit.frame\n end\n end", "def update \n\t\t@currentframe = (@currentframe + 1) % @frames.size \n\t\t@image = @frames[@currentframe] # load the image\n \[email protected]!(-@xspeed,0) # move horizontally left \n if @rect.right() < 0\n\t\t\t\tself.kill # went off screen, kill it\n\t\t\t\treturn \n\t\t end\n end", "def refresh_frame(run_whereami = T.unsafe(nil)); end", "def update\n super\n if self.bitmap != nil and delay(@delay) and @animated\n x = @current_frame * @frame_width + @offset_x\n self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)\n @current_frame = (@current_frame + 1) unless @frames == 0\n @animated = false if @current_frame == @frames and @once\n @current_frame %= @frames\n end\n end", "def update_frame\n # If animation frame is different, change graphic\n if @unit.frame != Graphics.frame_count % 60 / 15\n @unit.frame = Graphics.frame_count % 60 / 15\n end\n #Update the flag graphic\n # Is $viewing ranges necessary?#\n unless @is_moving or @unit.selected\n @flag.moveto(@unit.x, @unit.y)\n @flag.update\n @health.moveto(@unit.x, @unit.y)\n @health.update\n else\n @flag.bitmap = nil\n @health.bitmap = nil\n end\n \n end", "def game_loop\n end", "def update\n super\n refresh if @cw_data.include?(:playtime) && Graphics.frame_count / Graphics.frame_rate != @total_sec\n end", "def game_loop\n end", "def nextFrame(view)\n # Compute how long it took to display the last frame. This will\n # be used to compute how much to move or turnfor the next frame.\n time = view.last_refresh_time\n time_delay = 0\n if( time < 0.04 )\n time_delay = 0.04 - time\n time = 0.04\n end\n \n if( (@keys & (LEFT_ARROW | RIGHT_ARROW)) != 0 )\n self.send(self.lr_function, view, time)\n end\n if( (@keys & (UP_ARROW | DOWN_ARROW)) != 0 )\n self.send(self.ud_function, view, time)\n end\n \n # update the camera parameters\n @rep.update(view.camera) if @rep\n\n view.show_frame time_delay\n self.show_height\n \n true\nend", "def frame_step \n send_cmd(\"frame_step\")\n end", "def frames; motion.frames; end", "def end_frame\n @frame = false\n end", "def post_loop; end", "def intro\n\t\t@frame = @frame + 1\n\t\tif @frame == 1 or @frame == 40 \n\t\t\[email protected]([0, 0, 0])\n\t\telsif @frame == 10 or @frame == 60\n\t\t\[email protected]\n\t\t\[email protected] { |sprite|\n\t\t\t\tsprite.draw(@screen)\n\t\t\t}\n\t\telsif @frame == 220\n\t\t\t@frame = 0\n\t\t\tstats\n\t\t\tsetMenu\n\t\telsif @frame > 120\n\t\t\[email protected]\n\t\tend\n\tend", "def frame(id); end", "def update_animation\n if @wait != 0\n @wait -= 1\n if @wait == 0\n @wait = 6\n #update frame every six updates\n @p_index += 1 \n if @p_index == @pattern.size\n @p_index = 0\n end\n end\n end\n end", "def postloop\n end", "def each_frame &block\n\t\t\t@update_block = block\n\t\tend", "def initialize\n self.frames = []\n self.options = {}\n reset_for_fullscreen\n end", "def frame_teardown\n @top_frame = @frame = @current_thread = nil \n @threads2frames = {}\n end", "def restart\n pbBGMStop(0)\n 51.times do\n @viewport.tone.red-=5\n @viewport.tone.green-=5\n @viewport.tone.blue-=5\n self.updateElements\n Graphics.update\n end\n raise Reset.new\n end", "def add_frame(frame)\n end", "def last_frame; frames.last; end", "def frame\n @rad.frame(0)\n end", "def draw\n end", "def after_cycle; end", "def frame_self(frame_postion=0)\n #This is a stub, used for indexing\n end", "def tenth_frame; end", "def delay(frame)\n (frame*40).to_i.times {Graphics.update}\n end", "def after_win\n\n end", "def update_bitmap\n ### The following commented lines may be used for animation frames ###\n # # Get the graphic that represents the current frame\n # sx = @unit.frame * @cw\n # # Take the square graphic from the rectangular picture\n # self.src_rect.set(sx, 0, @cw, @ch)\n self.src_rect.set(0, 0, @cw, @ch)\n end", "def tick; end", "def tick; end", "def tick; end", "def tick\n end", "def set_game_frame(frame)\n @frame = frame\n end", "def wait(frames = 1)\n frames.times do\n self.update\n Graphics.update\n end\n end", "def current_frame\n @current_frame\n end", "def initialize\n @frame = Rect.zeroRect\n end", "def eb; self.iframes += 15; end", "def frame_time=(a); motion.frame_time = a; end", "def pop_frame_manager(_pry_); end", "def after_play\n\n end", "def frame\n (@frame || 1).to_f\n end", "def replace_external_frame\n end", "def setup\n\t\tsize(displayWidth, displayHeight)\n\t\tcolorMode(HSB,360,100,100,60)\n\t\t@w, @h = [width/2.0, 0]\n\t\t@i = 0 ; @t = 0\n frame_rate 20\n\t\tbackground(0)\n\n\t\t@monster = Monster.new 7, width, height\n\t\tstroke_width(160)\n\tend", "def timer; end", "def timer; end", "def timer; end", "def timer; end", "def draw\n @screen.insert(@frame, 0, 0)\n @screen.draw(0, 0, 0)\n end", "def setup_frames\n @frames ||=\n begin\n frames = 10.times.map {|i| Frame.new(i+1,0,0,0,nil)}\n # link frames\n (0...9).each {|i| frames[i].next_frame = frames[i+1]}\n frames\n end\n end", "def handleUpdate(sprite) end", "def draw; end", "def draw; end", "def step\n @queue << UndrawSprites.new( @screen, @background )\n @queue.fetch_sdl_events\n @queue << $game.clock.tick\n @queue << DrawSprites.new( @screen )\n @queue.each do |event|\n handle( event )\n end\n end", "def frame\n animation[Gosu.milliseconds / 100 % animation.size]\n end", "def tick_main_sequence\n @avatar.assign(@tileset.sprite_for(@avatar.cur_tile)) if @avatar.tick\n @camera.start_following(@avatar) if @avatar.walking\n @avatar.reposition(*@camera.follow)\n @map.change_tiles(*@camera.pos)\n end", "def onStart\r\n end", "def initialize(viewport, battler = nil)\n super(viewport)\n change\n @old = Graphics.frame_count # For the delay method\n @goingup = true # Increasing animation? (if @rm2k_mode is true)\n @once = false # Is the animation only played once?\n @animated = true # Used to stop animation when @once is true\n self.opacity = 0\n @index = 0\n @pattern_b = 0\n @counter_b = 0\n @trans_sprite = Sprite.new\n @trans_sprite.opacity = 0\n @bar_hp_sprite = Sprite.new\n @bar_hp_sprite.bitmap = Bitmap.new(64, 10)\n @bar_sp_sprite = Sprite.new\n @bar_sp_sprite.bitmap = Bitmap.new(64, 10)\n @color1 = Color.new(0, 0, 0, 192)\n @color2 = Color.new(255, 255, 192, 192)\n @color3 = Color.new(0, 0, 0, 192)\n @color4 = Color.new(64, 0, 0, 192)\n @old_hp = -1\n @old_sp = -1\n @battler = battler\n @battler_visible = false\n @first = true\n @pattern = 0\n if $target_index == nil\n $target_index = 0\n end\n @battler.is_a?(Game_Enemy) ? enemy_pose(0, 1) : pose(0, 1)\nend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def go_game\n #RPG::BGM.fade(30)\n #Graphics.fadeout(30)\n #Graphics.frame_count = 0\n DataManager.autosave(true, false)\n SceneManager.goto(Scene_Map)\n #$game_system.on_after_load\n end", "def draw\n end", "def draw\n end", "def draw\n end", "def rasterise \r\n @frames.each do |frame|\r\n printf '.';\r\n canvas = Canvas.new(@width, @height);\r\n @canvases.push(canvas);\r\n if frame.pixmaps.length == 0 then next; end;\r\n frame.pixmaps.each do |pixmap|\r\n img = pixmap.sprite.getImage(pixmap.frame);\r\n pixmap.frame = (pixmap.frame + 1) % (pixmap.sprite.images.length);\r\n canvas.add(img, pixmap.x, pixmap.y);\r\n end\r\n end \r\n end", "def clear_frame_managers(_pry_); end", "def bound!(_frame)\n # Do nothing\n end", "def framing\n previous, klass.current_frame = klass.current_frame, self unless @delegate_to_klass\n yield\n ensure\n klass.current_frame = previous unless @delegate_to_klass\n end", "def initialize(viewport = nil)\n super(viewport)\n @frame_width, @frame_height = 0, 0\n change # A basic change to set initial variables\n @old = Graphics.frame_count # For the delay method\n @goingup = true # Increasing animation? (if @rm2k_mode is true)\n @once = false # Is the animation only played once?\n @animated = true # Used to stop animation when @once is true\n\n end", "def update\n super\n # blinking period of 1 second\n @frame = (@frame + 1) % 20\n update_input\n update_cursor\n end", "def frame_managers(_pry_); end", "def preloop\n end", "def refresh\n # get unit bitmap (picture folder)\n id = \"_\" + @unit.army.id.to_s\n self.bitmap = RPG::Cache.character(@unit.name + id, 0)\n # define unit sprite width and height (32 x 32)\n @cw = self.bitmap.width / 4 # four frames of animation\n @ch = self.bitmap.height\n update\n end", "def pbCaveEntranceEx(exiting)\n sprite = BitmapSprite.new(Graphics.width,Graphics.height)\n sprite.z = 100000\n totalBands = 15\n totalFrames = 15\n bandheight = ((Graphics.height/2)-10).to_f/totalBands\n bandwidth = ((Graphics.width/2)-12).to_f/totalBands\n grays = []\n tbm1 = totalBands-1\n for i in 0...totalBands\n grays.push(exiting ? 0 : 255)\n end\n totalFrames.times do |j|\n x = 0\n y = 0\n rectwidth = Graphics.width\n rectheight = Graphics.height\n for k in 0...j\n t = (255.0)/totalFrames\n if exiting\n t = 1.0-t\n t *= 1.0+((k)/totalFrames.to_f)\n else\n t *= 1.0+0.3*(((totalFrames-k)/totalFrames.to_f)**0.7)\n end\n grays[k] -= t\n grays[k] = 0 if grays[k]<0\n end\n for i in 0...totalBands\n currentGray = grays[i]\n sprite.bitmap.fill_rect(Rect.new(x,y,rectwidth,rectheight),\n Color.new(currentGray,currentGray,currentGray))\n x += bandwidth\n y += bandheight\n rectwidth -= bandwidth*2\n rectheight -= bandheight*2\n end\n Graphics.update\n Input.update\n end\n if exiting\n pbToneChangeAll(Tone.new(255,255,255),0)\n else\n pbToneChangeAll(Tone.new(-255,-255,-255),0)\n end\n for j in 0..15\n if exiting\n sprite.color = Color.new(255,255,255,j*255/15)\n else\n sprite.color = Color.new(0,0,0,j*255/15) \n end\n Graphics.update\n Input.update\n end\n pbToneChangeAll(Tone.new(0,0,0),8)\n for j in 0..5\n Graphics.update\n Input.update\n end\n sprite.dispose\nend", "def each_frame(&block)\n if !block_given?\n return enum_for(:each_frame)\n end\n\n available_frames.each(&block)\n supercall(nil, :each_frame, &block)\n end", "def onLoad\n end", "def update\n update_animation\n end", "def frames\n _nudge[3]\n end", "def pre_loop; end", "def update(elapsed)\n \n end", "def frame_interval\n 1.0/@fps\n end", "def frame_interval\n 1.0/@fps\n end", "def frame_interval\n 1.0/@fps\n end", "def pbSceneStandby\n Graphics.frame_reset; yield\n $scene.disposeSpritesets if $scene && $scene.is_a?(Scene_Map)\n $scene.createSpritesets if $scene && $scene.is_a?(Scene_Map)\nend", "def frames_per_second=(a); motion.frames_per_second = a; end" ]
[ "0.75351626", "0.74464256", "0.7228442", "0.6771172", "0.66857177", "0.66337997", "0.66227144", "0.65079665", "0.64800376", "0.6469522", "0.64419365", "0.6440652", "0.63844496", "0.63645774", "0.63602835", "0.63563836", "0.6330764", "0.62287503", "0.6153098", "0.6152806", "0.61286", "0.61251426", "0.61100066", "0.6106453", "0.6073401", "0.59941036", "0.59777826", "0.5973234", "0.5963401", "0.595753", "0.59550893", "0.59547585", "0.5951878", "0.5931032", "0.5926856", "0.5915928", "0.58929807", "0.5875222", "0.58746606", "0.5872311", "0.58694315", "0.5863181", "0.5852183", "0.5851965", "0.5851965", "0.5851965", "0.5837048", "0.5834669", "0.5829642", "0.58285475", "0.5822995", "0.58173096", "0.5815453", "0.58123577", "0.5811032", "0.58106554", "0.5807718", "0.57907885", "0.5790532", "0.5790532", "0.5790532", "0.5790532", "0.5790298", "0.57698303", "0.57616276", "0.5761572", "0.5761572", "0.5749157", "0.5742037", "0.57396626", "0.57392", "0.5738966", "0.572988", "0.572988", "0.572988", "0.572988", "0.57279575", "0.5721896", "0.5721896", "0.5721896", "0.5713496", "0.57088256", "0.5707004", "0.5701747", "0.5699142", "0.5691632", "0.56884634", "0.5682703", "0.56826055", "0.5671412", "0.5670736", "0.5669244", "0.5666101", "0.5661943", "0.56528616", "0.5652643", "0.5651326", "0.5651326", "0.5651326", "0.56480706", "0.56374425" ]
0.0
-1
Used for status setting
def update_status case @part.status when 'Unstarted' @part.status = 'Started' @part.user = current_user @part.bitbucket.post_user(current_user.email) if @part.name == 'Prototype' @part.create_activity key: 'part.started', owner: current_user @part.start_rep_points when 'Started' @part.status = 'Finished' @part.create_activity key: 'part.finished', owner: current_user when 'Finished' @part.status = 'In Review' @part.create_activity key: 'part.in_review', owner: current_user when 'In Review' @part.status = 'Accepted' @part.accepted_rep_points @part.create_activity key: 'part.accepted', owner: current_user end @part.save redirect_to :back end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status=(status); end", "def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end", "def statuses; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status\n end", "def status\n end", "def status\n end", "def status\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def set_status\n self.status = 1\n end", "def get_status\n\t\tstatus\n\tend", "def status(*) end", "def status\n super\n end", "def set_status(val)\n self.status = val\n self\n end", "def setStatus(status)\r\n\t\t\t\t\t@status = status\r\n\t\t\t\tend", "def status=(status)\n @_status = status\n end", "def status=(status)\n @_status = status\n end", "def default_status\n\t\tself.status = \"Pending\"\n end", "def status\n case @status\n when 0 then :off\n when 1 then :on\n end\n end", "def custom_status\n {}\n end", "def status\n @status\n end", "def status\n @status\n end", "def status\n @status\n end", "def status\n @status\n end", "def retrieve_status\n \n end", "def set_status\n self.status = Status.find_by(code: \"OPEN\")\n end", "def set_Status(value)\n set_input(\"Status\", value)\n end", "def set_Status(value)\n set_input(\"Status\", value)\n end", "def set_status\n if !draft\n self.status = STATUS[get_status]\n end\n end", "def change_status(status)\n #not implemented \n end", "def set_default_status\n\t self.status = 0 \n\tend", "def last_status; end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def set_initial_status\n \tself.status = \"waiting\"\n end", "def status_object\n @status\n end", "def status\n STATUSES[self.status_id]\n end", "def status\n\t\treturn @status\n\tend", "def status\n @__status\n end", "def status\n\t\t\t\ttrue\n\t\t\tend", "def status\n \"#{@description} #{@status}\"\n end", "def status\n super || StatusType.active\n end", "def set_StatusUpdate(value)\n set_input(\"StatusUpdate\", value)\n end", "def status=(new_status)\n self.last_status = status\n\n self.setValue new_status, forKey: 'status'\n end", "def extend_status(_status)\n end", "def status\n value_for('status')\n end", "def getStatus\n @status\n end", "def status()\n puts @status\n end", "def status\r\n case status_id\r\n when 1; \"Sending\"\r\n when 2; \"Sent\"\r\n when 3; \"Bounced\"\r\n when 4; \"Opened\"\r\n when 5; \"Downloaded\"\r\n when 6; \"Send Failed\"\r\n else; \"Processing\"\r\n end\r\n end", "def checkstatus()\n merge(checkstatus: 'true')\n end", "def status\n STATUSES[self.status_id || 0]\n end", "def change_status\n\t\tif status.include?(\"available\")\n\t\t\tstatus = \"checked_out\"\n\t\telsif status.include?(\"checked_out\")\n\t\t\tstatus = \"available\"\n\t\tend\n\tend", "def auto_update_status \n if self.status == \"To Be Published\"\n self.status = \"Published\"\n end \n end", "def set_status!(status)\n ## FIXME_NISH Fix this.\n ## FIXED\n update(status: (status == 'true'))\n end", "def set_default_status\n self['status'] = 'active' if status.blank?\n end", "def status\n info['status']\n end", "def status_message; end", "def status=(v)\n @status = alma_string v\n end", "def setStatus( status )\n\t\t\tif @options.status.include?( status )\n\t\t\t\[email protected] = status\n\t\t\t\treturn true\n\t\t\tend\n\t\t\tfalse\n\t\tend", "def status\n data[:status]\n end", "def set_status\n\t \t#establecer status en BD\n\t \tself.status = \"created\"\n\t \tself.save #para que se guarde\n\t end", "def set_status\n @status = Status.find(params[:id])\n end", "def getStatus\r\n\t\t\t\t\treturn @status\r\n\t\t\t\tend", "def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end", "def setStatusInfo(name, value)\n @device.setStatusInfo(name,value) ;\n end", "def status_effect; end", "def status=(new_status)\n update_values([:status] => new_status)\n end", "def good\n @status\n end", "def default_status\n\n self.status = \"active\"\n\n end", "def set_status\n if status.blank?\n if (consulted_legal) && (consulted_marketing)\n status = \"Pending Approval\"\n elsif (consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing Approval\"\n elsif (!consulted_legal) && (consulted_marketing)\n status = \"Awaiting Legal Approval\"\n elsif (!consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing & Legal Approval\"\n end\n end\n true # Needs to return true for the update to go through \n end" ]
[ "0.8149229", "0.78564215", "0.77720827", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.76866704", "0.76866704", "0.76866704", "0.76866704", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7617679", "0.760702", "0.7595988", "0.75904787", "0.73992014", "0.73923707", "0.7365614", "0.7358034", "0.7358034", "0.7307145", "0.7288786", "0.7261542", "0.7247535", "0.7247535", "0.7239499", "0.7239499", "0.72364134", "0.7206057", "0.7198514", "0.7198514", "0.71857417", "0.71680766", "0.7163162", "0.71602887", "0.7126241", "0.7126241", "0.7104068", "0.7100585", "0.7068641", "0.70586306", "0.70518273", "0.70508885", "0.703384", "0.702322", "0.70070046", "0.69968265", "0.6995675", "0.69816977", "0.6978111", "0.69716763", "0.6970959", "0.6970575", "0.69605047", "0.69581485", "0.69516253", "0.6950782", "0.6918542", "0.6910098", "0.6897227", "0.6890343", "0.6888849", "0.6877749", "0.6855641", "0.6855555", "0.68496734", "0.68452674", "0.6832093", "0.6831942", "0.6825805", "0.6822678", "0.68211114", "0.6819416" ]
0.0
-1
Used for status setting
def unstart_part @part.unstart_rep_points @part.status = 'Unstarted' @part.user = nil @part.save @part.create_activity key: 'part.unstarted', owner: current_user @part.bitbucket.delete_users if @part.name == 'Prototype' redirect_to idea_build_path(@part.idea), notice: 'You successfully unstarted the part.' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status=(status); end", "def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end", "def statuses; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status\n end", "def status\n end", "def status\n end", "def status\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def set_status\n self.status = 1\n end", "def get_status\n\t\tstatus\n\tend", "def status(*) end", "def status\n super\n end", "def set_status(val)\n self.status = val\n self\n end", "def setStatus(status)\r\n\t\t\t\t\t@status = status\r\n\t\t\t\tend", "def status=(status)\n @_status = status\n end", "def status=(status)\n @_status = status\n end", "def default_status\n\t\tself.status = \"Pending\"\n end", "def status\n case @status\n when 0 then :off\n when 1 then :on\n end\n end", "def custom_status\n {}\n end", "def status\n @status\n end", "def status\n @status\n end", "def status\n @status\n end", "def status\n @status\n end", "def retrieve_status\n \n end", "def set_status\n self.status = Status.find_by(code: \"OPEN\")\n end", "def set_Status(value)\n set_input(\"Status\", value)\n end", "def set_Status(value)\n set_input(\"Status\", value)\n end", "def set_status\n if !draft\n self.status = STATUS[get_status]\n end\n end", "def change_status(status)\n #not implemented \n end", "def set_default_status\n\t self.status = 0 \n\tend", "def last_status; end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def set_initial_status\n \tself.status = \"waiting\"\n end", "def status_object\n @status\n end", "def status\n STATUSES[self.status_id]\n end", "def status\n\t\treturn @status\n\tend", "def status\n @__status\n end", "def status\n\t\t\t\ttrue\n\t\t\tend", "def status\n \"#{@description} #{@status}\"\n end", "def status\n super || StatusType.active\n end", "def set_StatusUpdate(value)\n set_input(\"StatusUpdate\", value)\n end", "def status=(new_status)\n self.last_status = status\n\n self.setValue new_status, forKey: 'status'\n end", "def extend_status(_status)\n end", "def status\n value_for('status')\n end", "def getStatus\n @status\n end", "def status()\n puts @status\n end", "def status\r\n case status_id\r\n when 1; \"Sending\"\r\n when 2; \"Sent\"\r\n when 3; \"Bounced\"\r\n when 4; \"Opened\"\r\n when 5; \"Downloaded\"\r\n when 6; \"Send Failed\"\r\n else; \"Processing\"\r\n end\r\n end", "def checkstatus()\n merge(checkstatus: 'true')\n end", "def status\n STATUSES[self.status_id || 0]\n end", "def change_status\n\t\tif status.include?(\"available\")\n\t\t\tstatus = \"checked_out\"\n\t\telsif status.include?(\"checked_out\")\n\t\t\tstatus = \"available\"\n\t\tend\n\tend", "def auto_update_status \n if self.status == \"To Be Published\"\n self.status = \"Published\"\n end \n end", "def set_status!(status)\n ## FIXME_NISH Fix this.\n ## FIXED\n update(status: (status == 'true'))\n end", "def set_default_status\n self['status'] = 'active' if status.blank?\n end", "def status\n info['status']\n end", "def status_message; end", "def status=(v)\n @status = alma_string v\n end", "def setStatus( status )\n\t\t\tif @options.status.include?( status )\n\t\t\t\[email protected] = status\n\t\t\t\treturn true\n\t\t\tend\n\t\t\tfalse\n\t\tend", "def status\n data[:status]\n end", "def set_status\n\t \t#establecer status en BD\n\t \tself.status = \"created\"\n\t \tself.save #para que se guarde\n\t end", "def set_status\n @status = Status.find(params[:id])\n end", "def getStatus\r\n\t\t\t\t\treturn @status\r\n\t\t\t\tend", "def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end", "def setStatusInfo(name, value)\n @device.setStatusInfo(name,value) ;\n end", "def status_effect; end", "def status=(new_status)\n update_values([:status] => new_status)\n end", "def good\n @status\n end", "def default_status\n\n self.status = \"active\"\n\n end", "def set_status\n if status.blank?\n if (consulted_legal) && (consulted_marketing)\n status = \"Pending Approval\"\n elsif (consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing Approval\"\n elsif (!consulted_legal) && (consulted_marketing)\n status = \"Awaiting Legal Approval\"\n elsif (!consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing & Legal Approval\"\n end\n end\n true # Needs to return true for the update to go through \n end" ]
[ "0.8149229", "0.78564215", "0.77720827", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.76866704", "0.76866704", "0.76866704", "0.76866704", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "0.7617679", "0.760702", "0.7595988", "0.75904787", "0.73992014", "0.73923707", "0.7365614", "0.7358034", "0.7358034", "0.7307145", "0.7288786", "0.7261542", "0.7247535", "0.7247535", "0.7239499", "0.7239499", "0.72364134", "0.7206057", "0.7198514", "0.7198514", "0.71857417", "0.71680766", "0.7163162", "0.71602887", "0.7126241", "0.7126241", "0.7104068", "0.7100585", "0.7068641", "0.70586306", "0.70518273", "0.70508885", "0.703384", "0.702322", "0.70070046", "0.69968265", "0.6995675", "0.69816977", "0.6978111", "0.69716763", "0.6970959", "0.6970575", "0.69605047", "0.69581485", "0.69516253", "0.6950782", "0.6918542", "0.6910098", "0.6897227", "0.6890343", "0.6888849", "0.6877749", "0.6855641", "0.6855555", "0.68496734", "0.68452674", "0.6832093", "0.6831942", "0.6825805", "0.6822678", "0.68211114", "0.6819416" ]
0.0
-1
It's guaranteed that the answer exists. If there are several answers, return the one which starts from the smallest index. Example For s = "adobecodebanc" and t = "abc", the output should be minSubstringWithAllChars(s, t) = "banc".
def minSubstringWithAllChars(s, t) (0..s.size).lazy.map { |l| (0..s.size - l).lazy.map { |i| s[i, l] } .find { |x| t.each_char.all? { |c| x[c] } } }.find { |x| x } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(a)\n shortest = a.min_by &:length\n maxlen = shortest.length\n maxlen.downto(0) do |len|\n 0.upto(maxlen - len) do |start|\n substr = shortest[start,len]\n return substr if a.all?{|str| str.include? substr }\n end\n end\nend", "def find_short(s)\n l = s.split(\" \").min_by { |x| x.length}.length\n return l #l: length of the shortest word\nend", "def shortest_string(list_of_words)\n \n array = []\n\n list_of_words.each {|value|\n \tarray << value.length\n }\n\n if array.empty?\n \tnil\n else\n return list_of_words[array.index(array.min)]\n end\n\nend", "def find_short(string)\n string.split.map(&:length).min\nend", "def smallest_string(strings)\n smallest = strings[0]\n strings.each do |string|\n if string.length < smallest.length\n smallest = string\n end\n end\n smallest\nend", "def find_short(s)\n return s.split(\" \").map { |word| word.length }.min\nend", "def shortest_string(list_of_words)\n list_of_words.min {|x,y| x.size <=> y.size}\nend", "def find_short(s)\n s.split(' ').map{|e|e.length}.min\nend", "def shortest_string(list_of_words)\n\treturn list_of_words.min_by {|x| x.length }\nend", "def shortest_string(list_of_words)\n list_of_words.min_by(&:length)\nend", "def shortest_string(list_of_words)\n list_of_words.min_by(&:length)\nend", "def shortest_string(list_of_words)\n list_of_words.min { |a, b| a.size <=> b.size }\nend", "def shortest_string(list_of_words)\n if list_of_words == []\n return nil\n end\n i = 0\n array_length = array_size(list_of_words)\n smallest_index = 0\n for i in 0..array_length - 1\n if string_length(list_of_words[smallest_index]) > string_length(list_of_words[i])\n smallest_index = i\n end\n end\n return list_of_words[smallest_index]\nend", "def shortest_string(list_of_words)\n\n for x in 0..list_of_words.length - 1\n if x == 0\n currentSmallest = list_of_words[x]\n else\n if list_of_words[x].length < currentSmallest.length\n currentSmallest = list_of_words[x]\n end\n end\n end\n\n return currentSmallest\nend", "def shortest_string(list_of_words)\n length_of_words = {}\n list_of_words.each do |word|\n word_length = word.length\n length_of_words[word] = word_length\n end\n answer = length_of_words.min_by{|k,v| v}\n if answer == nil\n return nil\n else\n answer.first\n end\nend", "def shortest_string(list_of_words)\n return nil if no_string?(list_of_words)\n return list_of_words[0] if one_string?(list_of_words)\n \telse\n \t\tfirst_word = list_of_words[0]\n \t\tx = 1\n \t\twhile x < list_of_words.length\n \t\t\tif first_word.length > list_of_words[x].length\n \t\t\t\tfirst_word = list_of_words[x]\n \t\t\tend\n \t\t\tx += 1\n \t\tend\n \t\treturn first_word\nend", "def find_short(s)\n # s.split.map(&:size).min\n s.split\n .map(&:size)\n .min\nend", "def shortest_string(list_of_words)\n\treturn list_of_words.min{|a,b| a.size <=> b.size}\nend", "def shortest_string(list_of_words)\n # PSEUDOCODE\n # return nil if list has no strings in it\n # I'm assuming the .length method is okay here, otherwise this problem would be a lot more tedious\n # Initialize initial shortest word as first word in array\n # Initialize initial shortest length as length of that word\n # FOR each word\n # IF word length is smaller than minimum\n # Set shortest word as that word\n # Set shortest length as word's length\n # Return minimum\n\n\n# INITIAL SOLUTION\n# return nil if list_of_words == []\n#\n# shortest = list_of_words[0]\n# min_length = shortest.length\n# list_of_words.each { |word|\n#\n# if word.length < min_length\n# shortest = word\n# min_length = word.length\n# end\n# }\n# return shortest\n\n #BUILT-IN SOLUTION\n\n return list_of_words.min { |a, b| a.length <=> b.length }\n\n\nend", "def find_short(s)\n return s.split(' ').min_by{|word| word.length}.length\nend", "def shortest_string(list_of_words)\n # Your code goes here!\n return list_of_words[0].to_s if list_of_words.length == 1\n smallest_word(list_of_words)\n# until_loop(list_of_words)\n# for_loop(list_of_words)\n# smallest = list_of_words[0]\n# list_of_words.each do |word|\n# smallest = word if word.length < smallest.length\n# end\n# return smallest\nend", "def shortest_string(list_of_words)\n if list_of_words.empty? \n return nil\n end\n \n short=list_of_words[0]\n list_of_words.each { |str| \n if str.length < short.length\n short=str\n end \n }\n return short\nend", "def shortest_string(list_of_words)\n\tif list_of_words.length == 0\n\t\treturn nil\n\tend\n\ti = list_of_words[0]\n\tj = 1\n\twhile j <= list_of_words.length - 1 do\n\t\tif i.length > list_of_words[j].length\n\t\t\ti = list_of_words[j]\n\t\tend\n\t\tj = j + 1\n\tend\n\treturn i\nend", "def shortest_word_in_array(array)\n array.min_by{|word|word.length}\nend", "def shortest_string(list_of_words)\n if list_of_words.empty?\n return nil\n else\n shortest = list_of_words[0]\n list_of_words.each.to_s do |x|\n if list_of_words.length < shortest\n shortest = x\n end\n end\n end\n return shortest\nend", "def min_window(s, t)\n targets = t.chars.reduce({}) { |acc, x| \n acc[x] ||= 0\n acc[x] += 1\n acc\n }\n empties = targets.dup\n \n visited = {}\n left = 0\n max = \"\"\n for i in 0...s.size\n next if targets[s[i]].nil?\n visited[s[i]] = (visited[s[i]] || 0) + 1\n while (visited[s[left]].nil? || visited[s[left]] > targets[s[left]]) && left < i\n visited[s[left]] -= 1 if !visited[s[left]].nil?\n left += 1\n end\n \n if empties[s[i]]\n empties[s[i]] -= 1\n empties.delete(s[i]) if empties[s[i]] == 0\n end\n \n substring = s[left..i].to_s\n max = substring if (max == \"\" || substring.size < max.size) && empties.empty?\n end\n \n max\nend", "def first_uniq_char(s)\n return -1 if s.empty?\n \n count_hash = Hash.new {|hash,key| hash[key]=[]}\n \n s.each_char.with_index do |char, idx|\n count_hash[char]<<idx\n end\n \n count_hash = count_hash.invert\n \n min_arr = count_hash.min_by {|indices, val| indices.length}\n \n return min_arr.first[0] if min_arr.first.length == 1\n \n -1\nend", "def shortest_string(list_of_words)\n shortest = list_of_words[0]\n\n list_of_words.each do |word|\n if word.length < shortest.length\n shortest = word\n end\nend\n\nreturn shortest\nend", "def longest_prefix(strings)\n return \"\" if strings.empty?\n prefix = \"\"\n smallest_word = strings.min_by { |word| word.length } # start with smallest word\n for i in 0..smallest_word.length-1\n if strings.all? { |word| word[i] == smallest_word[i] } # if the index matches the same index of the other words\n prefix += smallest_word[i] # then append the index value to the prefix\n else\n break # otherwise index is not in all words, so stop\n end\n end\n return prefix\nend", "def shortest_string(list_of_words)\n if list_of_words.length == 0\n \treturn nil\n end\n shortest_str = list_of_words[0]\n list_of_words.each do |str| \n \tif str.size < shortest_str.size\n \t\tshortest_str = str\n \tend\n end\n shortest_str\nend", "def find_short(s)\n # your code here\n the_1st_array = s.split(\" \")\n this_counts = []\n i = 0\n while i < the_1st_array.count\n this_counts.push(the_1st_array[i].length)\n i+=1\n end\n l = this_counts.min\n return l # l: length of the shortest word\nend", "def shortest_string(list_of_words)\n list_of_words = list_of_words.sort_by {|x| x.length}\n short_string = list_of_words[0]\n return short_string\nend", "def shortest_string(list)\n\tshortest = list.first\n\tlist.each do |current_str|\n\t\tif current_str.length < shortest.length\n\t\t\tshortest = current_str\n\t\tend\n\tend\n\n\tshortest\nend", "def shortest_string(list_of_words)\n shortest = list_of_words[0]\n for word in 1...list_of_words.length\n if shortest.length > list_of_words[word].length then\n shortest = list_of_words[word]\n end\n end\n return shortest\nend", "def shortest_first(array_of_words)\n # TODO\nend", "def shortest_string(list_of_words)\n shortest = list_of_words[0]\n array_number = 1\n while array_number < list_of_words.length\n \tif list_of_words[array_number].length < shortest.length\n \t\tshortest = list_of_words[array_number]\n \tend\n \tarray_number += 1\n end\n return shortest\nend", "def shortest_string(list_of_words)\n\tif list_of_words==[]\n\t\treturn nil\n\telse\n\t\tshort_string=list_of_words[0]\n \t\tlist_of_words.each do |x|\n \t\t\tif x.length < short_string.length\n \t\t\t\tshort_string = x\n\t\t\tend\t\t\n\t\tend\n \t\treturn short_string\n \tend\nend", "def find_short(string)\n string.split.map(&:length).sort.first\nend", "def shortest_string(list_of_words)\n # Your code goes here!\n shortest = list_of_words[0]\n\n list_of_words.each { |word| \n if word.length < shortest.length\n shortest = word\n end\n }\n\n return shortest\nend", "def shortest_word_in_array(array)\n array.min{ | x, y | x.length <=> y.length }\nend", "def shortest_string(list_of_words)\n\tif list_of_words == []\n\t\treturn nil\n\telsif list_of_words == [\" \"]\n\t\treturn \" \"\n\telse\n\t\tstring_length = []\n\t\tlist_of_words.each do |string|\n\t\t\t string_length.push string.length\n\t\tend\n\t\tlist_of_words.each do |string|\n\t\t\tif string_length.min == string.length\n\t\t\t\treturn string\n\t\t\tend\n\t\tend\n\n\tend\n\nend", "def least_frequent_word(str)\n words = str.split\n frequency = words.length\n min_word = \"\"\n\n words.each_with_index do |word, idx|\n if words.count(word) < frequency\n frequency = words.count(word)\n min_word = words[idx]\n end\n end\n min_word\nend", "def shortest_string(list_of_words)\n if list_of_words.length == 0\n nil\n else\n index = 0\n shortest_word = list_of_words[0]\n while index < list_of_words.length do\n if list_of_words[index].length <= shortest_word.length\n shortest_word = list_of_words[index]\n end\n index+=1\n end\n shortest_word\n end\n end", "def shortest_string(list_of_words)\n if list_of_words.empty?\n return nil\n else\n shortest_length = list_of_words.first.length\n shortest_word = ''\n list_of_words.each do |word|\n if word.length <= shortest_length\n shortest_length = word.length\n shortest_word = word\n else\n shortest_word = shortest_word\n end\n end\n return shortest_word\n end\nend", "def common_prefix(words)\n smallest_string= words.min_by{|word| word.size}\n\n result = \"\"\n\n smallest_string.chars.each_with_index do |current_char, current_index|\n if words.all?{|word| word[current_index] == current_char}\n result << current_char\n else\n return result\n end\n end\n result\nend", "def shortest_string(list_of_words)\n\tif list_of_words.length == 0\n\t\treturn nil\n\tend\n\tlist_of_words.sort_by! {|i| i.length}\n\treturn list_of_words[0]\nend", "def smallest_word(array)\n smallest = array[0]\n array.each do |word|\n smallest = word if word.length < smallest.length\n end\n return smallest\nend", "def shortest_string(list_of_words)\n if list_of_words == []\n \treturn nil\n else\n \tcounter = 0\n \tshortest_word = ''\n \tshorest_word_length = list_of_words[0].length\n \twhile counter < list_of_words.length\n \t\tif shorest_word_length >= list_of_words[counter].length\n \t\t\tshortest_word = list_of_words[counter]\n \t\tend\n \tcounter += 1\n \tend\n end\n return shortest_word\nend", "def substrings_at_start(str)\n subs = []\n str.chars.each_with_index do |ch, i|\n subs << str.slice(0..i)\n end \n subs.sort {|a, b| a.length <=> b.length} \nend", "def for_cs_sake(string)\n words = string.delete(\"!.,?;:\").split(\" \")\n words = words.select { |word| word.include?(\"c\") }\n c_distances = []\n words.each do |word|\n c_distances << find_c_distance(word)\n end\n c_distances\n lowest_c_distance = c_distances.min\n p words.select { |word| find_c_distance(word) == lowest_c_distance }[0]\nend", "def substrings_at_start(string)\n strings_array = (1..(string.length)).map { |idx| string[0, idx] }\n strings_array.sort_by { |string| string.length }\nend", "def substrings_at_start(string)\n strings_array = (1..(string.length)).map { |idx| string[0, idx] }\n strings_array.sort_by { |string| string.length }\nend", "def shortest_string(list_of_words)\n\n#If presented with an array of mixed objects, maybe not all strings\n# strings = []\n# list_of_words.each do |i|\n# if i.is_a? String\n# strings.push(i)\n# end\n# end\n\n\n\n if list_of_words.length ==0\n return nil\n else\n i=0\n shorty = list_of_words[0]\n while i<list_of_words.length do\n if list_of_words[i].length <= shorty.length\n shorty = list_of_words[i]\n end\n i += 1\n end\n return shorty\n end\nend", "def get_the_shortest_word(str)\n str.split(\" \").sort! {|s, l| s.length <=> l.length}[0]\nend", "def shortest_string(list_of_words)\n\tmethod = 1\n\tcase method\n\twhen 1\n\t\tlist_of_words.min_by {|x| x.size} #The easy way\n\twhen 2\n\t\tshortest = list_of_words[0]\n \t\tlist_of_words.each do |element|\n \t\t\tshortest = element if element.size < shortest.size\n \t\tend\n \t\treturn shortest\n \twhen 3\n \t\tshortest = list_of_words[0]\n \t\tfor element in list_of_words\n \t\t\tshortest = element if element.size < shortest.size\n \t\tend\n \t\treturn shortest\n \tend\nend", "def shortest_string(list_of_words)\n if list_of_words.empty? == true\n return nil\n end\n word = 1\n list_of_words.each do |x|\n if x.length <= word.to_s.length\n word = x\n end\n end\n p word\nend", "def shortest_string(list_of_words)\n # Your code goes here!\n return nil if list_of_words.empty?\n\n shortest = list_of_words[0]\n i = 1\n while(i < list_of_words.length)\n \tshortest = list_of_words[i] if list_of_words[i].size < shortest.size\n \ti += 1\n end\n return shortest\nend", "def shortest_string(list_of_words)\n\tshortest_string.each {|x1| x1.length}\n\t\tshortest_string.each {|x2| x2.length.to_i} #iterrates over each string in array, counts the string's length \n\t\tif shortest_string|x1.length| > shortest_string|x2.length| #compares the 2 pulled string lenghts\n\t\t\tshortest_string|x1| , shortest_string|x2| = shortest_string|x2| > shortest_string|x1| #keeps putting the smallest one to the front\n\t\tend\n\t\treturn shortest_string[0] #returns the first stirng in the array which should be the smallest one\nend\n\n# was getting some errors I could not resolve in order to get this to run. ", "def longest_prefix(strings)\n index = 0 \n prefix = \"\"\n all_true = false \n st = strings.min_by(&:length) \n st.split(\"\").each do |char| \n strings.each do |string| #string.split.each do char???\n if string.split(\"\")[index] == char\n all_true = true \n else\n all_true = false\n end\n end\n\n if all_true == false \n return prefix\n end \n if all_true == true\n prefix += char\n end\n index += 1\n end \n return prefix\nend", "def shortest_string(list_of_words)\n shortest = list_of_words[0]\n list_of_words.each do |i|\n \tif shortest.length <= i.length\n \t\tshortest = shortest\n \telse\n \t\tshortest = i\n \tend\n end\n p shortest\nend", "def shortest_string(list_of_words)\n # Your code goes here!\n if list_of_words.empty?\n return nil\n end\n shortest_word = list_of_words[0]\n for word in list_of_words\n if word.length < shortest_word.length\n shortest_word = word\n end\n end\n return shortest_word\n\nend", "def shortest_string(list)\n # This is your job. :)\n shortest_so_far = list.first\n list.each do |item|\n if item.length < shortest_so_far.length\n shortest_so_far = item\n end\n end\n return shortest_so_far\nend", "def longest_prefix(strings)\n length = strings.min_by { |string| string.length }.length\n strings = strings.sort!\n substring = \"\"\n \n i = 0\n while i <= length\n if strings[0][0..i] == strings[-1][0..i]\n substring = strings[0][0..i]\n end\n i += 1\n end\n \n return substring\nend", "def find_shortest_words(str)\n words = str.downcase.split(/[^a-z0-9]/)\n words = words.sort_by {|word| word.size}\n shortest = []\n\n words = words.select {|word| word.size > 0}\n\n size = words[0].size\n words.each do |word|\n break if word.size > size\n shortest << word\n end\n shortest.sort\nend", "def shortest_word_in_array(array)\n array.min_by(&:length)\n # array.min_by { |x| x.length }\nend", "def shortest_string(list_of_words)\r\n\tif list_of_words[0].nil?\r\n\t\treturn nil\r\n\telse\r\n\t\tstring_length = Hash.new\r\n\t\tsorted = Hash.new\r\n\t\tlist_of_words.each do |words|\r\n\t\t\tstring_length[words] = words.length\r\n\t\tend\r\n\t\tsorted = string_length.sort_by{|x, y| y}\r\n\t\treturn sorted.first.first\r\n\tend\r\nend", "def closest_string_in_front(key_string, sub_string)\n\n\t\tpositions = []\n\t\tlast_pos = nil\n\t\tmy_string = \" \" + to_str\n\t\tkey_pos = my_string.index(key_string)\n\t\tif key_pos.nil?\n\t\t\t#puts \"WARNING: closest_string_in_front PASSED A string THAT DID NOT INCLUDE key_string\"\n\t\t\treturn nil\n\t\telse\n\t\t\tmy_string = my_string.slice(0..key_pos+1)\n\t\tend\n\n\t\twhile (last_pos = my_string.index(sub_string, (last_pos ? last_pos + 1 : 0)))\n\t\t\tpositions << last_pos\n\t\tend\n\n\t\tif positions != []\n\t\t\treturn_string = my_string[key_pos-positions.map{|p| (p-key_pos).abs}.min..key_pos-1]\n\t\t\treturn return_string.match(sub_string).to_s\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def longest_prefix(strings)\n return \"\" if strings.empty? \n index = 0\n min = strings.min_by{|s| s.length} # find the shortest string\n longest_prefix = \"\"\n while index < min.length # keep running based on the length of the sortest the string \n strings.each do |string|\n if min[index] != string[index] # if the it's not equal, return the \"\"\n return longest_prefix\n end\n end\n longest_prefix += min[index]\n index +=1\n end \n return longest_prefix\nend", "def substrings_at_start(str)\r\n chars = str.chars\r\n chars.each_with_object([]).with_index { |(el,memo), idx| memo << chars.take(idx+1).join('').to_s }\r\nend", "def leading_substrings(string)\n array = string.chars\n result = []\n loop do\n break if array.empty?\n result.unshift(array.join)\n array.pop\n end\n result\nend", "def substrings_at_start(string)\n string.chars.map.with_index { |_, index| string[0..index] }\nend", "def shortest_string(list_of_words)\n \n short_string = list_of_words[0]\n \n i = 0\n while i < list_of_words.length\n current_item = list_of_words[i]\n if current_item.length < short_string.length\n short_string = current_item\n end\n i = i + 1\n\n end\n short_string\nend", "def first_wa(strings)\n strings.find do |string|\n string[0] ==\"w\" && string[1] == \"a\"\n end\nend", "def first_uniq_char(s)\n checked_letters = []\n \n s.split(\"\").each_with_index do |letter, idx|\n unique = true\n if !checked_letters.include?(letter)\n checked_letters << letter\n for i in (idx+1)..(s.length-1) do\n if letter == s[i]\n unique = false\n break\n end\n end\n else\n unique = false\n end\n return idx if unique\n end\n -1\nend", "def longest_prefix(strings)\n min = strings.min \n max = strings.max\n string_pre = min.size.times do |i| \n break i if min[i] != max[i]\n end\n min[0...string_pre]\nend", "def leading_substrings(string)\n substring = []\n string.each_char.with_index { |_, index| substring << string[0..index] }\n substring\nend", "def get_the_shortest_word(str)\n words = str.split()\n return words.max\nend", "def shortest_string(list_of_words)\n\tif list_of_words.empty?\n\t\treturn nil\n\telse p list_of_words.sort_by {|x| x.length}.shift\n\tend\nend", "def longest_prefix(strings)\n strings_in_common = \"\"\n #checking if array is emptyh\n if strings.length == 0\n return strings_in_common\n end\n\n shortest_string = strings.min(){|a, b| a.length <=> b.length}.chars\n\n i = 0\n while i < shortest_string.length\n letter = shortest_string[i]\n strings.each do |string|\n if letter != string.chars[i]\n return strings_in_common\n end\n end\n strings_in_common += letter\n i += 1\n end\n return strings_in_common\nend", "def leading_substrings(str)\n substrings = []\n str.each_char.with_index do |char, idx|\n substrings << str[0..idx]\n end\n substrings\nend", "def find_start_good_section(iupac_concensus_string, min_length)\n good_char_count = 0\n char_index = 0\n iupac_concensus_string.each_char do |char|\n if char =~ /[^\\?\\-Nn]/\n good_char_count += 1\n if good_char_count >= min_length\n break\n end\n else\n good_char_count = 0\n end\n char_index += 1\n end\n char_index - (good_char_count - 1)\n end", "def substrings_at_start(str)\n str.chars.map.with_index { |_, idx| str[0, idx + 1] }\nend", "def longest_repeated_substring(string)\n\n size = string.length\n\n # put every possible suffix into an array\n suffixes = Array.new(size)\n size.times do |i|\n suffixes[i] = string.slice(i, size)\n end\n\n # sort the array of suffixes, so common substrings (i.e., prefixes\n # of suffixes) will be found in neighboring elements of the array\n suffixes.sort!\n\n best = \"\"\n at_least_size = 1 # the size to meet or exceed to be the new best\n distance = nil\n neighbors_to_check = 1\n\n # compare pairs of consecutive suffixes and see how much initial\n # commonality there is\n # (size - 1).times do |i|\n (1...size).each do |i|\n # p [i, neighbors_to_check]\n s1 = suffixes[i]\n\n # generally we will only need to compare the ith item and the one\n # preceding it; however if we were in a position to reject a long\n # enough common substring due to overlap issues, then we may have\n # to compare an ith item with additional preceding items;\n # neighbors_to_check tracks how many neighbors we need to check\n neighbors_to_check.downto(1) do |neighbor|\n s2 = suffixes[i - neighbor]\n\n # make sure that these to suffixes further apart than the size\n # of the current best; we don't explicitly track the index of\n # these suffixes, but since all suffixes go to the end of the\n # initial string, the size can be used as a proxy\n distance = (s1.size - s2.size).abs\n if distance < at_least_size\n if s1.size >= at_least_size &&\n s2.size >= at_least_size &&\n s1.slice(0, at_least_size) == s2.slice(0, at_least_size)\n neighbors_to_check = max(neighbors_to_check, neighbor + 1)\n else\n neighbors_to_check = neighbor\n end\n next\n end\n\n # if neighboring suffixes don't at least match as far as the best,\n # no need to check more carefully\n unless s1.slice(0, at_least_size) == s2.slice(0, at_least_size)\n neighbors_to_check = neighbor\n next\n end\n\n # get the longest common prefix that's no larger than distance,\n # since at that point the substrings overlap\n best = longest_common_prefix(s1, s2, distance)\n at_least_size = best.size + 1\n if best.size == distance\n neighbors_to_check = max(neighbors_to_check, neighbor + 1)\n else\n neighbors_to_check = neighbor\n end\n end\n end\n\n best.strip\n end", "def longest_prefix(strings)\n # raise NotImplementedError, \"Not implemented yet\"\n\n if strings.first.length == 0\n return strings\n end\n\n prefix = \"\"\n i = 0\n\n min = strings.min_by{|s| s.length}\n while i < min.length \n strings.each do |string|\n if min[i] != string[i] \n return prefix\n end\n end\n prefix += min[i]\n i +=1\n end \n return prefix\n end", "def leading_substrings(string)\n substrings = []\n string.each_char.with_index { |_, index| substrings << string[0..index] }\n substrings\nend", "def find(search_string)\n result = search(search_string)\n result.min\n end", "def substrings_at_start(str)\n str.chars.map.with_index do |_, i|\n str[0..i]\n end\nend", "def longest_prefix(strings)\n strings_in_common = \"\"\n #checking if array is emptyh\n if strings.length == 0\n return strings_in_common\n end\n shortest_string = strings.min(){|a, b| a.length <=> b.length}.chars\n i = 0\n while i < shortest_string.length\n letter = shortest_string[i]\n strings.each do |string|\n if letter != string.chars[i]\n return strings_in_common\n end\n end\n strings_in_common += letter\n i += 1\n end\n return strings_in_common\nend", "def first_wa(array)\n\n array.each do |word|\n temp = word.to_s\n return temp if temp.start_with?(\"wa\")\n end\n\nend", "def substrings_at_start(string)\n sub_arr = []\n start = 0\n while start < string.size\n string.chars.each_index do |idx|\n sub_arr << string.slice(start..idx)\n end\n start += 1\n end\n sub_arr.sort.reject(&:empty?)\nend", "def substrings_at_start(string)\n result = []\n string = string.chars\n string.size.times do\n result << string.join('')\n string.pop\n end\n\n result.sort\nend", "def shortest_string(list_of_words)\n # Your code goes here!\n list_of_words.sort! { |a , b| a.length <=> b.length }\n\t\treturn list_of_words[0]\nend", "def substrings_at_start(string)\n sub_arr = []\n string.chars.each_index do |idx|\n sub_arr << string.slice(0, idx + 1)\n end\n sub_arr.sort\nend", "def shortest a, b\n left = -1\n last = b.chars.map { |c| [c, -1] }.to_h\n bcount = 0\n min_length = a.length + 1\n min_left = min_right = -1\n a.chars.each_with_index do |c, right|\n if not last.has_key? c\n left = right\n bcount = 0\n else\n bcount += 1 if last[c] <= left\n last[c] = right\n while last[a[left + 1]] != left + 1\n left += 1\n end\n length = right - left\n if bcount == b.length and length < min_length\n min_length = length\n min_left = left\n min_right = right\n end\n end\n end\n if min_length < a.length + 1\n return a[(min_left + 1)..min_right]\n else\n return ''\n end\nend", "def substrings_at_start(str)\n str.each_char.map.with_index do |char, index|\n str[0..index]\n end\nend", "def longest_prefix(strings)\n common_string = \"\"\n if strings.length == 0\n return common_string\n end\n \n shortest_element = strings.min\n shortest_element_length = shortest_element.length\n i = 0\n while i < shortest_element_length\n char = shortest_element[i]\n strings.each do |string|\n if char != string[i]\n return common_string\n end\n end\n common_string += char\n i += 1\n end\n \n return common_string\nend", "def for_fs_sake(string)\n words = string.split\n min_f_distance = nil\n min_f_word = \"\"\n\n words.each do |word|\n current_f_distance = find_f_distance(word)\n if current_f_distance && (min_f_distance.nil? || current_f_distance < min_f_distance)\n min_f_distance = current_f_distance\n min_f_word = word\n end\n end\n\n min_f_word\nend", "def shortest_string(list)\n shortest_so_far = list.first\n list.each do |item|\n if shortest_so_far.length > item.length\n shortest_so_far = item\n end\n end\n shortest_so_far\nend", "def longest_prefix(strings)\n words = strings.length\n min_characters = (strings.min_by{|string|string.length}).length\n prefix = \"\"\n\n min_characters.times do |j|\n letter = strings[0][j]\n\n words.times do |i|\n return prefix if strings[i][j] != letter\n end\n\n prefix += letter\n end\n\n return prefix\nend", "def leading_substrings(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend" ]
[ "0.75384796", "0.7133405", "0.71118397", "0.70624894", "0.7019326", "0.6991536", "0.69448656", "0.69309896", "0.69285893", "0.6918347", "0.6918347", "0.6912162", "0.6883463", "0.6875524", "0.6865224", "0.6849213", "0.68350965", "0.6816007", "0.6801082", "0.67993903", "0.67703986", "0.6726304", "0.6676023", "0.6668902", "0.6661069", "0.66335446", "0.6627354", "0.66246706", "0.66058576", "0.6599696", "0.65806884", "0.656301", "0.65628904", "0.6557268", "0.6534116", "0.6514877", "0.6514797", "0.65139353", "0.6507701", "0.6501477", "0.6487376", "0.6485607", "0.64781654", "0.6471046", "0.64652675", "0.6450008", "0.6449014", "0.6412827", "0.6394091", "0.6393125", "0.6370325", "0.6370325", "0.6366786", "0.63595456", "0.63571644", "0.6349236", "0.6345669", "0.63443875", "0.63419914", "0.63049066", "0.6300847", "0.6292968", "0.6292668", "0.62748486", "0.6272888", "0.6270522", "0.62604773", "0.6245042", "0.62413335", "0.6236354", "0.62289774", "0.621888", "0.6217698", "0.6202958", "0.62015116", "0.62009895", "0.6193123", "0.6192838", "0.61898017", "0.6186827", "0.61807734", "0.6179546", "0.6176448", "0.61730486", "0.6172083", "0.6171866", "0.61504793", "0.6149741", "0.61409664", "0.6140083", "0.6134448", "0.61328775", "0.60961723", "0.60948056", "0.6086043", "0.6079654", "0.60685426", "0.6063881", "0.6062418", "0.6061417" ]
0.8336636
0
method is inherited from the superclass
def index list render('list') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def overrides; end", "def custom; end", "def custom; end", "def implementation; end", "def implementation; end", "def schubert; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def initialize\n super\n end", "def initialize\n super\n end", "def methods() end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend", "def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend", "def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end" ]
[ "0.76834434", "0.7112112", "0.6950881", "0.6950881", "0.6906725", "0.6906725", "0.6821159", "0.6815375", "0.6809549", "0.6809549", "0.6809549", "0.6809549", "0.67698467", "0.67698467", "0.67698467", "0.67698467", "0.67181605", "0.67181605", "0.6623702", "0.660279", "0.660279", "0.660279", "0.660279", "0.660279", "0.660279", "0.660279", "0.660279", "0.660279", "0.660279", "0.660279", "0.660279", "0.652625", "0.652625", "0.652625", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063", "0.652063" ]
0.0
-1
by default, rails escape all user input
def create #pull the position out of the params hash and store it in a variable new_position=params[:subject].delete(:position) # instantiate a new object using form parameters @subject= Subject.new(params[:subject]) #save the object if @subject.save #if save succeeds #once we saved the @subject, we can update its position @subject.move_to_position(new_position) flash[:notice]="Subject created." #flash hash stores messages, like a cookie #if save succeeds, redirect to the list action redirect_to(:action=> "list") #if save fails, redisplay the form so user can fix problems else @subject_count = Subject.count+1 render('new') #@subject will be prepopulated with previous entries end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape(value)\n end", "def cgi_escape(input); end", "def escape(string); end", "def escape(input); input.to_s.gsub('\"', '\\\\\"'); end", "def escape(str); end", "def escape(string)\n #This is a stub, used for indexing\n end", "def escape_text input\n escape input, text_regexp, text_mapping\n end", "def e(value)\n CGI.escape(value)\n end", "def escape(val)\n return val\n end", "def escape_text(text)\n text\n end", "def escape(str)\n CGI.escape(str)\n end", "def raw(input)\n Utils::Escape::SafeString.new(input)\n end", "def escape_html(input)\n Utils::Escape.html(input)\n end", "def escape_quotes(unfiltered)\n unfiltered.to_s.gsub(/'/, \"''\")\n end", "def erb_escape(text)\n # Do not only replace '<%' ! or <r:t>min</r:t>% ==> <% ...\n text.gsub(SECURE_REGEXP) {|code| SAFE_CODE[code]}\n end", "def check_and_escape(url)\n check url\n CGI.escape url\n end", "def escape(string)\n if backend.unsafe? || @unsafe\n Shellwords.escape(string)\n else\n string\n end\n end", "def escape(value)\n value.nil? ? nil : value.shellescape\n end", "def _raw(string)\n ::Hanami::Utils::Escape::SafeString.new(string)\n end", "def escape(query)\n @my.escape(query)\n end", "def safe *things\n\t\t\tappend! CGI.escapeHTML(things.map(&:to_s).join(\"\\n\"))\n\t\tend", "def consume_escaped; end", "def escape(s)\n dummy_conn.escape(s)\n end", "def escape_quotes input\n\t\tinput.gsub!(/([\\'\\\"])/,\"\\\\\\1\") #single quote\n\t\t\n\t\treturn input\n\tend", "def requires_like_escape?\n false\n end", "def escape(value)\n _escape(value.to_s.to_str)\n rescue ArgumentError\n _escape(value.to_s.to_str.force_encoding(Encoding::UTF_8))\n end", "def escape(text)\n text.gsub('\"', '\\\"')\nend", "def html_escape(s)\n CGI.escapeHTML(s.to_s)\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end", "def uri_escape(input); end", "def escape_attr input\n escape input, attr_regexp, attr_mapping\n end", "def xml_escape(input); end", "def sanitize(context,input)\n whitelist(input,Owasp::Esapi::Ecnoder::CHAR_ALPHANUMERIC)\n end", "def escape(str)\n return ActiveRecord::Base.connection.quote_string(str)\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "def escape(s)\n URI.encode_www_form_component(s)\n end", "def force_quotes?() @force_quotes end", "def escape(string)\n raise NotImplementedError, \"#{self.class}#escape\"\n end", "def escape(str)\n str.to_s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\").force_encoding('US-ASCII')\n end", "def html_escape\n return to_s\n end", "def html_escape\n return to_s\n end", "def escape_value(value)\n CGI.escape(value.to_s).gsub('%20', '+')\n end", "def smart_quotes(input)\n require 'rubypants'\n RubyPants.new(input).to_html\n end", "def _(data=\"\"); self.__ self.escape_html(data.to_s); end", "def escape(value)\n value.to_s.strip.gsub(/\\s/, '')\n end", "def escape_html(value)\n CGI.escapeHTML(value)\n end", "def escape(text)\n return text.gsub(/[\\`*_{}\\[\\]()#+\\-.!]/, \"\\\\\\\\\\\\0\")\n end", "def esc_ht str\n\t\treturn Escape.html str\n\tend", "def escape(s)\n s.gsub('\"', '\\\"')\nend", "def html_safe(input)\n input.respond_to?(:html_safe) ? input.html_safe : input\n end", "def haml_xss_html_escape(text)\n return text unless Hamlit::HamlUtil.rails_xss_safe? && haml_buffer.options[:escape_html]\n html_escape(text)\n end", "def validate_and_sanitize\n super\n end", "def clean_share_input(input) \n raw(input).gsub(/\"/, '\\'')\n end", "def safe_escape(uri); end", "def escape_body\n self.body = ERB::Util.html_escape(body)\n end", "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] }\n end", "def sanitize!; end", "def escape(stream = '')\n return stream if absent?(stream)\n\n stream.gsub(/\\e/, '\\\\e')\n end", "def sanitize_input(input_string)\n sanitized = Shellwords.shellescape(input_string)\n $logger.info(\"module or branch name #{sanitized} had to be escaped!\") unless input_string == sanitized\n sanitized\n end", "def create_escape_value(value)\n if value.is_a?(String) || value.is_a?(Symbol)\n \"#{sanitize_escape_sequences(value.to_s)}\"\n else\n value\n end\n end", "def escape(str)\n ERB::Util.h(str).gsub('&quot;', '\"').gsub('&#39;', \"'\")\n end", "def escape(string)\n return \"\" if string.nil?\n string = ':' + string.to_s if string.kind_of? Symbol\n string.gsub(\"\\\\\", \"\\\\\\\\\").gsub(\"&\", \"\\&\").gsub(\":\", \"\\:\").gsub(\"/\", \"\\/\")\n end", "def sanitize_input(input_string)\n sanitized = Shellwords.shellescape(input_string)\n $logger.info(\"branch name #{sanitized} had to be escaped!\") unless input_string == sanitized\n sanitized\n end" ]
[ "0.73058057", "0.7294034", "0.7084897", "0.6987313", "0.69075394", "0.68791115", "0.68633604", "0.66831464", "0.6659106", "0.66294634", "0.65568584", "0.65271634", "0.6507189", "0.647592", "0.6474997", "0.6465555", "0.6460189", "0.6450522", "0.6440561", "0.640173", "0.6394344", "0.6393353", "0.6376623", "0.63750625", "0.63593715", "0.631277", "0.631128", "0.62773204", "0.62662375", "0.62662375", "0.62662375", "0.62662375", "0.62662375", "0.62662375", "0.62662375", "0.62662375", "0.62662375", "0.62662375", "0.62662375", "0.6262065", "0.62574744", "0.62405974", "0.62229735", "0.62091744", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.61750984", "0.6152291", "0.61495686", "0.61464435", "0.6145319", "0.61365974", "0.61365974", "0.6125865", "0.6122009", "0.61008435", "0.60997707", "0.60996395", "0.60944235", "0.60824287", "0.60765696", "0.6074323", "0.6069798", "0.6068833", "0.6054257", "0.6047979", "0.6046343", "0.6042419", "0.6019542", "0.60191727", "0.60000646", "0.5998745", "0.59952796", "0.5978258", "0.5972469" ]
0.0
-1
The name of the current host (localhost, for example)
def current_host request.host end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hostname\n name + '.localhost'\n end", "def this_host_name\n if is_zz?\n return zz[:local_hostname]\n end\n\n return @this_host_name if @this_host_name != nil\n\n instances = ey['environment']['instances']\n # assume localhost if can't find\n @this_host_name = 'localhost'\n\n this_id = this_instance_id\n instances.each do |instance|\n if instance['id'] == this_id\n @this_host_name = instance['private_hostname']\n break\n end\n end\n @this_host_name\n end", "def hostname\n Socket.gethostname.split('.').first.strip\n end", "def hostname\n Socket.gethostname\n end", "def hostname\n Socket.gethostname\n end", "def current_host\n @current_host ||= \"#{request.protocol}#{request.host_with_port}\"\n end", "def hostname\n @hostname ||= `hostname`.strip\n end", "def hostname\n @hostname ||= `hostname`.chomp\n end", "def hostname\n Socket.gethostname\n end", "def hostname\n @hostname ||= ENV['HOSTNAME'] || `hostname`.chomp\n end", "def hostname\n @hostname ||= ENV['HOSTNAME'] || `hostname`.delete(\"\\n\")\n end", "def host\n Socket.gethostname\n end", "def host\n Socket.gethostname\n end", "def name\n ssh.exec!(\"hostname\").chomp\n end", "def hostname\n session.transport.socket.client_name\n end", "def get_server_hostname\n (`hostname`).strip\n end", "def name\n \"#{self[:host]}\"\n end", "def server_host\n Socket.gethostname\n end", "def hostname\n ssh.exec!(\"hostname\").chomp\n end", "def hostname\n v = self.host\n v&.start_with?('[') && v.end_with?(']') ? v[1..-2] : v\n end", "def hostname()\n unless @host.is_str?\n @host = ENV['HOSTNAME']\n @host = `/bin/hostname` unless @host.is_str?\n raise \"Failed to determine current HOSTNAME\" unless @host.is_str?\n\n @host = @host.downcase.sub(/\\..*$/, '').strip\n raise \"Failed to determine current HOSTNAME\" unless @host.is_str?\n end\n @host = @host.to_sym\n end", "def host\n\t\t\t# FIXME: This is both a hack and the best way I know to do this.\n\t\t\tSocket.getaddrinfo(Socket.gethostname, 0)[0][2]\n\t\tend", "def hostname\n hostname = nil\n run \"hostname\" do |channel, stream, data|\n hostname = data.chomp\n end\n hostname\n end", "def hostname\n return @hostname\n end", "def name\n return @name unless @name.nil?\n \"#{@name_prefix}host:#{Socket.gethostname} pid:#{Process.pid}\" rescue \"#{@name_prefix}pid:#{Process.pid}\"\n end", "def get_host\n @host\n end", "def hostname\n Rails.env.development? ? h.root_url(port: 3000).chomp!('/') : h.root_url.chomp!('/')\n end", "def host\n request.host\n end", "def full_host\n if(request.host =~ /^localhost/ && request.port != 80)\n \"#{request.host}:#{request.port}\"\n else\n request.host\n end\n end", "def local_host\n get('beef.http.host') || '0.0.0.0'\n end", "def hostname\n return 'unknown' unless available?\n @hostname ||= ssh_cmd('hostname').chomp\n end", "def hostname\n if @hostname.nil?\n @hostname = ENV[\"COMPUTERNAME\"]\n @hostname = ENV[\"HOSTNAME\"] if @hostname.blank?\n @hostname = `hostname` if @hostname.blank?\n @hostname = @hostname.gsub(/\\.terracotta\\.lan/, '').strip\n end\n \n @hostname\n end", "def hostname; end", "def hostname; end", "def hostname\n Rails.env.development? ? 'http://localhost:3000' : 'http://coderalert.com'\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 host\n @host\n end", "def host\r\n return for_context(nil, false) { |c| c.host }\r\n end", "def host\n 'localhost'\n end", "def host_id; 'localhost' end", "def hostname\n @options[:host][:name] if @options[:host]\n end", "def new_hostname\n host || incremented_hostname || local_host_name\n end", "def hostname\n if (host = @host.at('tag[name=host-fqdn]'))\n host.inner_text\n end\n end", "def name\n @config.db_name.gsub(/@thismachinehostname@/, Socket.gethostname).\n gsub(/@prefix@/, prefix)\n end", "def determine_hostname\n @info[:hostname] = @shell.query('HOST', 'hostname')\n end", "def host\n @request['Host']\n end", "def hostname\n host_hash['vmhostname'] || @name\n end", "def hostname\n protocol = request.headers['HTTP_X_FORWARDED_PROTO'] ||\n request.protocol ||\n 'http'\n protocol += '://' unless protocol.match?(%r{://})\n\n \"#{protocol}#{request.host}\"\n end", "def host\n return @host\n end", "def host\n return @host\n end", "def current_host_with_port\n uri = URI.parse(current_url)\n \"#{uri.scheme}://#{uri.host}:#{uri.port}\"\n end", "def hostname\n (request.env['HTTP_X_FORWARDED_SERVER'] =~ /[a-z]*/) ? request.env['HTTP_X_FORWARDED_SERVER'] : request.env['HTTP_HOST']\n end", "def host\n @host\n end", "def host\n @host\n end", "def current_host\n return nil unless agent && agent.current_page\n uri = agent.current_page.uri\n \"#{uri.scheme}://#{uri.host}\"\n end", "def name\n [host, port, user, password, ssl].collect { |p| p.to_s }.join(\"/\")\n end", "def local_name; connection_space.name end", "def hostinfo\n return self.host.to_s + (self.port ? ':' + self.port.to_s : '')\n end", "def host\n self.host\n end", "def get_public_hostname\n rpc_get_fact_direct('public_hostname')\n end", "def hostname\n Resolv.getname(ip_address) rescue nil\n end", "def hostname(node)\n \"#{node.to_s}.smartengine.local\"\nend", "def get_vm_host(_pool_name, _vm_name)\n\n #for v1 virtualbox support this is all local so the hostname will always be localhost\n return 'localhost'\n end", "def host\n @connection.host\n end", "def server_hostname\n @node['serverHostname']\n end", "def fqdn\n ssh.exec!(\"hostname --fqdn\").chomp\n end", "def client_name\n return @hostname if defined? @hostname\n\n sockaddr = @socket.getsockname\n begin\n @hostname =\n Socket.getnameinfo( sockaddr, Socket::NI_NAMEREQD ).first\n rescue\n begin\n @hostname = Socket.getnameinfo( sockaddr ).first\n rescue\n begin\n @hostname = Socket.gethostbyname( Socket.gethostname ).first\n rescue\n @logger.error \"the client ipaddr/name could not be determined\"\n end\n end\n end\n\n return @hostname\n end", "def host\n \"#{request.env['rack.url_scheme']}://#{request.host}:#{request.port}\".sub(':80','')# rescue 'http://locahost:3000'\n end", "def host\n @host ||= target.split(':',2).first\n end", "def current_server\n \"#{request.protocol}#{request.host_with_port}\"\n end", "def configured_hostname\n running_config.scan(/hostname\\s*(\\S+)/).flatten.first\n end", "def client_hostname\n @opts[:hostname]\n end", "def public_host\n get('beef.http.public.host')\n end", "def server_name\n return @server_name\n end", "def socket_host; end", "def hostname\n options[:hostname]\n end", "def ssh_hostname\n name = \"\"\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n name = ssh.exec! \"hostname -s\"\n end\n name.downcase.chomp\n end", "def host_as_string; end", "def getHost()\n return @uri.host\n end", "def getlocalname\n if [nil, '0.0.0.0', '::'].include?(self.localhost) && [nil, 0].include?(self.localport)\n _, self.localhost, self.localport = getsockname\n end\n\n family = Socket.is_ipv4?(self.localhost) ? ::Socket::AF_INET : ::Socket::AF_INET6\n [family, self.localhost, self.localport]\n end", "def get_hostname\n cmd_exec('uname -n').to_s\n rescue\n raise 'Unable to retrieve hostname'\n end", "def peer_hostname\n (error, name) = Cproton.pn_ssl_get_peer_hostname(@impl, 1024)\n raise SSLError.new if error < 0\n return name\n end", "def node\n @node ||= Socket.gethostname\n end", "def client_name\n sockname[0]\n end", "def host\n active_backend.host\n end", "def host\n '127.0.0.1'\n end", "def ServerName()\r\n ret = @dispatch._getproperty(1610743816, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def get_server_domain\n @hostname ||= Socket.gethostname\n end", "def hostname\n raise 'empty hostname, something wrong' if @in_hostname.empty?\n @in_hostname\n end", "def server_name\n self.setup\n @server_name ||= self.attributes[\"connection\"]||self.class::DEFAULT_SERVER_NAME\n end", "def hostname\n FFI::Libvirt.virConnectGetHostname(pointer)\n end", "def host\n attributes['host']\n end", "def default_host\n host_list.first\n end", "def fqdn\n exit_code, stdout = ssh.exec(\"hostname --fqdn\")\n (exit_code == 0) ? stdout.chomp : \"\"\n end", "def default_host\n primary_host = hosts.primary.first\n primary_host.blank? ? \"#{subdomain}.adaptapp.com\" : primary_host.hostname\n end", "def host_url\n proto = request.env['SERVER_PROTOCOL'].downcase.index(\"https\").nil? ? \"http\" : \"https\"\n return \"#{proto}://#{request.env['HTTP_HOST']}\"\n end", "def host\n HOSTS[locale]\n end", "def hostname(value)\n value || BASE_URI\n end", "def public_hostname\n get_proxy.get_public_hostname\n end", "def objname()\n machine = self.get_machine()\n profile = self.get_profile()\n (machine.nil? ? \"no machine\" : machine.hostname) + \": \" + (profile.nil? ? \"no profile\" : profile.name)\n end" ]
[ "0.8553182", "0.8275436", "0.81809926", "0.81391937", "0.81391937", "0.8119555", "0.80694807", "0.8069345", "0.7945337", "0.7904412", "0.7888484", "0.78743154", "0.7873891", "0.78717595", "0.78184223", "0.7805399", "0.7719257", "0.7698445", "0.769077", "0.7684536", "0.76639956", "0.76559633", "0.7630648", "0.7626607", "0.7609716", "0.7588307", "0.7584863", "0.7578974", "0.7523175", "0.75194836", "0.7509843", "0.75092477", "0.7459469", "0.7459469", "0.74272776", "0.74174446", "0.73658097", "0.73655856", "0.7337981", "0.7335511", "0.7331484", "0.7331375", "0.7317843", "0.7291752", "0.72640777", "0.72462523", "0.7236018", "0.7199183", "0.71987814", "0.71987814", "0.71821755", "0.71767527", "0.7174787", "0.7174787", "0.716764", "0.71640575", "0.71546453", "0.7139933", "0.71294653", "0.7112959", "0.7111701", "0.7105643", "0.7086764", "0.7078918", "0.7072483", "0.70524913", "0.70312774", "0.702943", "0.7028135", "0.7018361", "0.7011842", "0.7006033", "0.7001153", "0.6999673", "0.69993925", "0.69949406", "0.6992686", "0.6980012", "0.6976707", "0.6974457", "0.6965387", "0.69399774", "0.6930021", "0.6928456", "0.6916723", "0.6907505", "0.69074875", "0.68988186", "0.68918246", "0.68888605", "0.688389", "0.68757945", "0.68714064", "0.68659616", "0.6862484", "0.68566257", "0.6850674", "0.6848568", "0.6839108", "0.6836477" ]
0.8002826
8
Return the users's sytem information as a hash
def user_system_info { :system => NoPlanB::HttpHeaderUtils.extract_system_info(request.env['HTTP_USER_AGENT']), :browser => NoPlanB::HttpHeaderUtils.extract_browser_info(request.env['HTTP_USER_AGENT']), :ip_address => request.remote_ip } 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 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 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 hash\n [authentication_type, community_name, database, domain, enumerate_sids, notes_id_password, ntlm_hash, oracle_listener_password, password, pem_key, permission_elevation, permission_elevation_password, permission_elevation_username, privacy_password, privacy_type, private_key_password, realm, service, sid, use_windows_authentication, username].hash\n end", "def users\n result_hash['usr']\n end", "def collect_user_details\n cmd = 'lsuser -a ALL' # get all user names\n result ||= inspec.backend.run_command(cmd)\n return [] if result.exit_status.to_i != 0\n names = result.stdout.split(\"\\n\")\n users_cache = []\n names.sort.uniq.each do |n|\n users_cache << AixUser(inspec, n)\n end\n users_cache\n end", "def system_keys\n @_system_keys ||= {}\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 ps_to_hash(ps)\n result = {}\n\n ps.each_pair do |k,v|\n if k == :uid\n begin\n result[:username] = Etc.getpwuid(v).name\n rescue Exception => e\n logger.debug(\"Could not get username for #{v}: #{e}\")\n result[:username] = v\n end\n end\n\n result[k] = v\n end\n\n result\n end", "def enum_users\n\tos = @client.sys.config.sysinfo['OS']\n\tusers = []\n\tuser = @client.sys.config.getuid\n\tpath4users = \"\"\n\tsysdrv = @client.fs.file.expand_path(\"%SystemDrive%\")\n\n\tif os =~ /7|Vista|2008/\n\t\tpath4users = sysdrv + \"\\\\users\\\\\"\n\t\tprofilepath = \"\\\\AppData\\\\Local\\\\VMware\\\\\"\n\telse\n\t\tpath4users = sysdrv + \"\\\\Documents and Settings\\\\\"\n\t\tprofilepath = \"\\\\Application Data\\\\VMware\\\\\"\n\tend\n\n\tif user == \"NT AUTHORITY\\\\SYSTEM\"\n\t\tprint_status(\"Running as SYSTEM extracting user list..\")\n\t\[email protected](path4users) do |u|\n\t\t\tuserinfo = {}\n\t\t\tnext if u =~ /^(\\.|\\.\\.|All Users|Default|Default User|Public|desktop.ini|LocalService|NetworkService)$/\n\t\t\tuserinfo['username'] = u\n\t\t\tuserinfo['userappdata'] = path4users + u + profilepath\n\t\t\tusers << userinfo\n\t\tend\n\telse\n\t\tuserinfo = {}\n\t\tuservar = @client.fs.file.expand_path(\"%USERNAME%\")\n\t\tuserinfo['username'] = uservar\n\t\tuserinfo['userappdata'] = path4users + uservar + profilepath\n\t\tusers << userinfo\n\tend\n\treturn users\nend", "def ps_to_hash(ps)\n result = {}\n\n ps.each_pair do |k,v|\n if k == :uid\n begin\n result[:username] = Etc.getpwuid(v).name\n rescue Exception => e\n logger.debug(\"Could not get username for #{v}: #{e}\")\n result[:username] = v\n end\n end\n\n result[k] = v\n end\n\n result\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 hash\n [allow_privilege_escalation, capabilities, privileged, proc_mount, read_only_root_filesystem, run_as_group, run_as_non_root, run_as_user, se_linux_options].hash\n end", "def gen_unix_attributes(ad,domain,entry)\n ua = Hash.new\n ua[:uidnumber] = ad.find_next_uid(domain)\n ua[:mssfu30name] = entry[:samaccountname][0]\n ua[:mssfu30nisdomain] = domain.split(\".\").first\n ua[:gidnumber] = \"100\"\n ua[:unixhomedirectory] = \"/home/\" + entry[:samaccountname][0]\n ua[:loginshell] = \"/bin/bash\"\n return ua\n end", "def users()\n\t\t\tusers = {}\n\t\t\[email protected](:type => 'USER').each do |user_row|\n\t\t\t\tusers[user_row.attributes[:user_name]] = ServerUser.new(user_row.attributes[:user_name], @dynamo_table, user_row, @metadata, self)\n\t\t\tend\n\t\t\treturn users\n\t\tend", "def user_data(hsh={})\n @settings[:user_data].merge!(hsh.to_hash) unless hsh.empty?\n @settings[:user_data]\n end", "def hash\n [class_id, object_type, description, name, type, system].hash\n end", "def get_user(name)\n @file = \"/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/users/#{name}.plist\"\n NSMutableDictionary.dictionaryWithContentsOfFile(@file)\n end", "def credential_hsh\n h = {s: \"Seal\", l: \"Letter\", c: \"Certificate\", p: \"PSA/DNA\", o: \"Official Seal\"}\n end", "def _io_user_data(username)\n (node['etc'] && node['etc']['passwd'] && node['etc']['passwd'][username]) || {\n 'uid' => username,\n 'gid' => username,\n 'dir' => \"/home/#{username}\"\n }\nend", "def user_info\n {\n 'nickname' => user_hash['NickName'],\n 'name' => user_hash['NickName']\n }\n end", "def raw_userids\n users = {}\n cmd = \"find /data/log/ctr -name 'ctr*.gz' -mtime -2 | xargs zcat\" \n IO.popen(cmd) do |io|\n while line = io.gets\n r = get_uid(line)\n #users[r[0]] = true # from cookie\n users[r[1]] = true # from sifi param\n end \n end\n users\nend", "def hash\n [private_widget_share, saml, saml_autocreate_access_role, saml_autocreate_users_domains, saml_can_be_enabled, saml_idp_endpoint, saml_idp_initiated_login, saml_idp_metadata_uploaded, saml_login_url, saml_strict_mode].hash\n end", "def user_hash\n @user_hash ||= MultiJson.decode(@access_token.get('https://api.trademe.co.nz/v1/MyTradeMe/Summary.json').body)\n end", "def select_all_user_info()\n return get_db_as_hash().execute(\"SELECT * FROM user\")\n end", "def user_data(filename)\n user_data = CSV.read Dir.pwd + filename\n descriptor = user_data.shift\n descriptor = descriptor.map { |key| key.to_sym }\n user_data.map { |user| Hash[ descriptor.zip(user) ] }\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 get_hash_sha512(user)\n begin\n shadowhashdata = user['ShadowHashData'][0]\n embedded_bplist = NSPropertyListSerialization.objc_send(\n :propertyListFromData, shadowhashdata,\n :mutabilityOption, NSPropertyListMutableContainersAndLeaves,\n :format, nil,\n :errorDescription, nil\n )\n hash = embedded_bplist['SALTED-SHA512'].to_s.gsub(/<|>/,\"\").split\n hash.join\n rescue\n return String.new\n end\n end", "def auth_info_from_file\n os = Config::CONFIG[\"host_os\"]\n if os =~ /darwin/\n info = YAML.load_file(\"/Users/#{ENV[\"USER\"]}/.dhl_info.yml\")\n else \n info = YAML.load_file(\"/home/#{ENV[\"USER\"]}/.dhl_info.yml\")\n end\n info\n end", "def get_hash_sha512_pbkdf2(user)\n begin\n shadowhashdata = user['ShadowHashData'][0]\n embedded_bplist = NSPropertyListSerialization.objc_send(\n :propertyListFromData, shadowhashdata,\n :mutabilityOption, NSPropertyListMutableContainersAndLeaves,\n :format, nil,\n :errorDescription, nil\n )\n plist = embedded_bplist.values[0].to_ruby\n resource = {}\n resource['iterations'] = plist['iterations'].to_s\n resource['salt'] = plist['salt'].description.to_ruby.gsub!(/<|>/,\"\").split.join\n resource['entropy'] = plist['entropy'].description.to_ruby.gsub!(/<|>/,\"\").split.join\n resource\n rescue\n return Hash.new\n end\n end", "def get_connected_user_info\n session[:sos_note_usr_info]\n end", "def system_information\n mappings = {}\n \n mappings['SystemID'] =\n if (!self.repo_settings[:aeon_external_system_id].blank?)\n self.repo_settings[:aeon_external_system_id]\n else\n \"ArchivesSpace\"\n end\n\n return_url =\n if (!AppConfig[:public_proxy_url].blank?)\n AppConfig[:public_proxy_url]\n elsif (!AppConfig[:public_url].blank?)\n AppConfig[:public_url]\n else\n \"\"\n end\n\n mappings['ReturnLinkURL'] = \"#{return_url}#{self.record['uri']}\"\n\n mappings['ReturnLinkSystemName'] =\n if (!self.repo_settings[:aeon_return_link_label].blank?)\n self.repo_settings[:aeon_return_link_label]\n else\n \"ArchivesSpace\"\n end\n\n mappings['Site'] = self.repo_settings[:aeon_site_code] if self.repo_settings.has_key?(:aeon_site_code)\n\n return mappings\n end", "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 get_mounts\n mount_hash = {}\n mounts = File.open(\"/etc/mtab\", \"r\").read.split(\"\\n\").map{|l| l.split(/\\s+/)}\n mounts.each{|m| mount_hash[m[1]] = m[0] unless %w[devpts udev sysfs tmpfs none proc].include?(m[0])}\n mount_hash\nend", "def hash\n [access_key_id, address, arn, aws_session_name, connection_type, event_source, exchange_server_hostname, exchange_user, folder_path, id, ldap_server, links, name, port, protocol, region, scan_engine_is_inside_aws, secret_access_key, status, username, win_rm_server].hash\n end", "def cluster_info\n @os_aws.to_os_hash\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_keys\n self.whitelists.map{|whitelist| whitelist.user_key}.uniq\n end", "def gethash(session)\n\tprint_status(\"Dumping password hashes...\")\n\tbegin\n\t\thash = ''\n\t\tsession.core.use(\"priv\")\n\t\thashes = session.priv.sam_hashes\n\t\thash << \"****************************\\n\"\n\t\thash << \" Dumped Password Hashes\\n\"\n\t\thash << \"****************************\\n\\n\"\n\t\thashes.each do |h|\n\t\t\thash << h.to_s+\"\\n\"\n\t\tend\n\t\thash << \"\\n\\n\\n\"\n\t\tprint_status(\"Hashes Dumped\")\n\trescue ::Exception => e\n\t\tprint_status(\"\\tError dumping hashes: #{e.class} #{e}\")\n\t\tprint_status(\"\\tPayload may be running with insuficient privileges!\")\n\tend\n\thash\n\nend", "def enum_users(os)\n\tusers = []\n\tuser = @client.sys.config.getuid\n\tpath4users = \"\"\n\tsysdrv = @client.fs.file.expand_path(\"%SystemDrive%\")\n\n\tif os =~ /Windows 7|Vista|2008/\n\t\tpath4users = sysdrv + \"\\\\users\\\\\"\n\t\tpath2purple = \"\\\\AppData\\\\Roaming\\\\\"\n\telse\n\t\tpath4users = sysdrv + \"\\\\Documents and Settings\\\\\"\n\t\tpath2purple = \"\\\\Application Data\\\\\"\n\tend\n\n\tif user == \"NT AUTHORITY\\\\SYSTEM\"\n\t\tprint_status(\"Running as SYSTEM extracting user list..\")\n\t\[email protected](path4users) do |u|\n\t\t\tuserinfo = {}\n\t\t\tnext if u =~ /^(\\.|\\.\\.|All Users|Default|Default User|Public|desktop.ini|LocalService|NetworkService)$/\n\t\t\tuserinfo['username'] = u\n\t\t\tuserinfo['userappdata'] = path4users + u + path2purple\n\t\t\tusers << userinfo\n\t\tend\n\telse\n\t\tuserinfo = {}\n\t\tuservar = @client.fs.file.expand_path(\"%USERNAME%\")\n\t\tuserinfo['username'] = uservar\n\t\tuserinfo['userappdata'] = path4users + uservar + path2purple\n\t\tusers << userinfo\n\tend\n\treturn users\nend", "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 system_information\n mappings = {}\n\n mappings['SystemID'] =\n if (!self.repo_settings[:aeon_external_system_id].blank?)\n self.repo_settings[:aeon_external_system_id]\n else\n \"ArchivesSpace\"\n end\n\n return_url =\n if (!AppConfig[:public_proxy_url].blank?)\n AppConfig[:public_proxy_url]\n elsif (!AppConfig[:public_url].blank?)\n AppConfig[:public_url]\n else\n \"\"\n end\n\n mappings['ReturnLinkURL'] = \"#{return_url}#{self.record['uri']}\"\n\n mappings['ReturnLinkSystemName'] =\n if (!self.repo_settings[:aeon_return_link_label].blank?)\n self.repo_settings[:aeon_return_link_label]\n else\n \"ArchivesSpace\"\n end\n\n mappings['Site'] = self.repo_settings[:aeon_site_code] if self.repo_settings.has_key?(:aeon_site_code)\n\n mappings\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 hash\n [status, area, days_on_market, originating_system_name].hash\n end", "def getuid\n\t\trequest = Packet.create_request('stdapi_sys_config_getuid')\n\t\tresponse = client.send_request(request)\n\t\treturn response.get_tlv_value(TLV_TYPE_USER_NAME)\n\tend", "def hash\n [domain, register_server, transport_protocol, proxy_server, register_server2, transport_protocol2, proxy_server2, register_server3, transport_protocol3, proxy_server3, registration_expire_time, user_name, password, authorization_name, user_email, voice_mail].hash\n end", "def user_info\n auth_hash['user_info']\n end", "def userinfo\n unless defined?(@userinfo)\n @userinfo = solr_url.userinfo if solr_url\n user = user_configuration_from_key('solr', 'user')\n pass = user_configuration_from_key('solr', 'pass')\n @userinfo ||= [ user, pass ].compact.join(\":\") if user && pass\n @userinfo ||= default_userinfo\n end\n @userinfo\n end", "def distribution_names\n\t\tunless @distribution\n\t\t\t@distribution = account.usernames.map{|username| {username: username, sql_username: sql_username(username)}}\n\t\tend\n\n @distribution.map{|u| u[:username]}.compact\n\tend", "def key\n return \"#{user}\"\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 student_data_hash\n\n # turn data into 2 Dim array containing arrays of eles where delimiter is colon :\n clean_user_account_data = ruby_class_user_accounts.map { |x| x.split(/:/) }\n\n # turn data into a hash using 2 arrays for keys and values\n keys = %w[user_name password uid gid gcos_field home_directory login_shell]\n final_array_of_hashes = []\n\n clean_user_account_data.each do |account_data|\n hash = Hash.new\n keys.each_with_index { |item, index| hash[item] = account_data[index] }\n final_array_of_hashes << hash\n end\n final_array_of_hashes\n end", "def storages\n storage_list = CopyStaging::RestoreWork::ORIGINALS_STORAGE + CopyStaging::RestoreWork::DERIVATIVES_STORAGE\n Hash[ storage_list.collect { |shrine_storage_key| [shrine_storage_key.to_s, shrine_config(shrine_storage_key) ] } ]\n end", "def info\n { 'stemcell_formats' => ['openstack-raw', 'openstack-qcow2', 'openstack-light'] }\n end", "def get_linux_stemcells\n products = Uhuru::BoshCommander::Versioning::Product.get_products\n current_product = products[@form.product_name]\n stemcells = {}\n current_product.versions[@form.product_version.to_s].dependencies.each do |dependency|\n products_dependency = products[dependency[\"dependency\"]]\n products_dependency_name = products_dependency.name\n products_dependency.local_versions.each do |version|\n first_version = version[0]\n if products_dependency.type == Uhuru::BoshCommander::Versioning::Product::TYPE_STEMCELL\n unless products_dependency_name.downcase.include? \"windows\"\n if dependency[\"version\"].include? first_version\n stemcells[\"#{products_dependency.label} v. #{first_version}\"] = \"name:#{products_dependency_name},version:#{first_version}\"\n end\n end\n end\n end\n end\n stemcells\n end", "def login_info\n # Uncomment and replace with your details if you don't use shell-fm.\n #return ['username', 'md5 of password']\n\n return shellfm_login_info\nend", "def get_user_secrets(namespace)\n `kubectl --namespace=#{namespace} get secrets | grep vault | cut -f1 -d \" \"`.split(\"\\n\").map { |u| u.chomp \"-vault\" }\n end", "def fetch_symids\n doc = exec_doc('syminq -sym -symmids -wwn')\n symids = []\n doc.elements.each('SymCLI_ML/Inquiry/symid') do |ele|\n symids << ele.text\n end\n puts symids.uniq!\n end", "def hash_domains\n\t\t# TODO : do we really want that?\n\t\tif self.domains.nil? or self.domains.empty? or self.domains.length < 1\n\t\t\tself.domains = {'USERS' => 1}\n\t\tend\n\t\twrite_attribute \"domains\", User.domain2str(self.domains)\n\tend", "def get_database_information(secret)\n tree = { :table => @creds[\"table\"], :replication => @creds[\"replication\"],\n :keyname => @creds[\"keyname\"] }\n return JSON.dump(tree)\n end", "def print_storage_info()\n # cloning the database configuration\n storage_info = @db_config.clone()\n\n # hiding database password\n storage_info['password'] = 'PRIVATE'\n\n # printing information\n storage_info.each{ |key| puts(\"#{key}#{storage_info[key] }\") }\n end", "def user_info\n @user_info ||= raw_info\n end", "def get_sys_info(server)\n server_id = server['id']\n conn_path = @connection.call('system.get_connection_path', @sid, server_id)\n puts conn_path\n end", "def raw_system_properties(addr, user, password)\n http_get(\n addr,\n '/system/console/status-System%20Properties.txt',\n user,\n password\n ).body\n end", "def to_s\n user_key\n end", "def to_s\n user_key\n end", "def userinfo\n object.fetch(:userinfo) {\n @object[:userinfo] = (format_userinfo(\"\") if @object[:user])\n }\n end", "def meta\n { iss: 'issuer_name', aud: 'user' }\n end", "def user_key\n uid\n end", "def getxattrs\n # # file: Scissor_Sisters_-_Invisible_Light.flv\n # user.m.options=\"-c\"\n\n cmd = %w[getfattr -d -m - -e base64] + [realpath.to_s]\n\n attrs = {}\n\n IO.popen(cmd, \"rb\", :err=>[:child, :out]) do |io|\n io.each_line do |line|\n if line =~ /^([^=]+)=0s(.+)/\n key = $1\n value = $2.from_base64 # unpack base64 string\n # value = value.encode(\"UTF-8\", \"UTF-8\") # set string's encoding to UTF-8\n value = value.force_encoding(\"UTF-8\").scrub # set string's encoding to UTF-8\n # value = value.encode(\"UTF-8\", \"UTF-8\") # set string's encoding to UTF-8\n\n attrs[key] = value\n end\n end\n end\n\n attrs\n end", "def synonym_dictionaries\r\n @@synonym_dictionaries\r\n end", "def hash\n fullname.hash\n end", "def getUserDetails\n\t\tuser = java.util.HashMap.new()\n\t\t# user name\n\t\tuser.put(KEY_NAME, @pref.getString(KEY_NAME, nil))\n\t\t\n\t\t# user email id\n\t\tuser.put(KEY_EMAIL, @pref.getString(KEY_EMAIL, nil))\n\t\t\n\t\t# return user\n\t\treturn user;\n\tend", "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 info()\n _params = {}\n return @master.call 'users/info', _params\n end", "def keys\n JSON.parse get('/users/ssh_keys', :accept => 'json').to_s\n end", "def hash\n [ name, database, password ].hash\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 user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n [self.class, dimension, system, name].hash\n end", "def keys_and_usernames\n keys.map do |key|\n [key[0], key[1]].join(' ')\n end\n end", "def user_info\n response = from_server \"api/user.json\"\n response.data\n end", "def hash\n [schema, name].hash\n end", "def get_machine_kerberos_salt\n host = simple.client.default_name\n return ''.b if host.nil? || host.empty?\n domain = simple.client.dns_domain_name\n \"#{domain.upcase}host#{host.downcase}.#{domain.downcase}\".b\n end", "def user_hash(user_id)\n secret = APP_CONFIG.admin_intercom_secure_mode_secret\n OpenSSL::HMAC.hexdigest('sha256', secret, user_id) if secret.present?\n end", "def user_sid\n return @user_sid\n end", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def type_to_form_ready_hash_site\n {\n username: resource[:username],\n password: resource[:password],\n configStoreConnection: JSON.generate(type_to_form_ready_hash_configstore),\n settings: JSON.generate(type_to_form_ready_hash_logsettings),\n runAsync: false,\n }\n end", "def system_identifiers\n @system_identifiers ||= begin\n skip_key = false\n data = run \"#{utility(:gpg)} #{base_options} \" \\\n \"--with-colons --fixed-list-mode --fingerprint\"\n data.lines.map do |line|\n line.strip!\n\n # process public key record\n if line =~ %r{^pub:}\n validity, keyid, capabilities = line.split(\":\").values_at(1, 4, 11)\n # skip keys marked as revoked ('r'), expired ('e'),\n # invalid ('i') or disabled ('D')\n if validity[0, 1] =~ %r{(r|e|i)} || capabilities =~ %r{D}\n skip_key = true\n next nil\n else\n skip_key = false\n # return both the long and short id\n next [keyid[-8..-1], keyid]\n end\n else\n # wait for the next valid public key record\n next if skip_key\n\n # process UID records for the current public key\n if line =~ %r{^uid:}\n validity, userid = line.split(\":\").values_at(1, 9)\n # skip records marked as revoked ('r'), expired ('e')\n # or invalid ('i')\n if validity !~ %r{(r|e|i)}\n # return the last email found in user id string,\n # since this includes user supplied comments.\n # return nil if no email found.\n email = nil\n str = userid\n while (match = str.match(%r{<.+?@.+?>}))\n email = match[0]\n str = match.post_match\n end\n next email\n end\n # return public key's fingerprint\n elsif line =~ %r{^fpr:}\n next line.split(\":\")[9]\n end\n\n nil # ignore any other lines\n end\n end.flatten.compact\n end\n end", "def to_s\n Psych.dump to_hash\n end", "def get(context)\n res = context.transport.get_request(context, 'security/users')\n\n context.err(res.body) unless res.success?\n\n Puppet::Util::Json.load(res.body).map do |user|\n keys_to_snake_case(user.merge({ 'ensure' => 'present' }))\n end\n end", "def hash\n\t\treturn self.name.to_s.hash\n\tend", "def hash\n [system_id, policy, registration_type, name, acronym, system_owner, organization_name, version_release_no, system_type, authorization_status, authorization_date, authorization_termination_date, confidentiality, integrity, availability, ditpr_id, ditpr_don_id, mac, dod_confidentiality, contingency_plan_tested, contingency_plan_test_date, security_review_date, has_open_poam_item, has_open_poam_item90to120_past_scheduled_completion_date, has_open_poam_item120_plus_past_scheudled_completion_date].hash\n end", "def whoami\n self.class.to_s\n end", "def hash\n name.hash\n end", "def hash\n name.hash\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 get_all_info_from_user()\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"SELECT * FROM users\")\n end" ]
[ "0.64183915", "0.57973886", "0.5750404", "0.5722617", "0.55965203", "0.55174446", "0.54820746", "0.5453869", "0.54414773", "0.5435998", "0.5395313", "0.5321904", "0.5319565", "0.53152806", "0.5296854", "0.52829486", "0.52786267", "0.5278059", "0.5275649", "0.52735764", "0.52726734", "0.52573353", "0.5245563", "0.5233429", "0.52266955", "0.52025235", "0.5198891", "0.51947737", "0.5194207", "0.51566714", "0.5147591", "0.5136376", "0.51333433", "0.5130568", "0.5120502", "0.5116988", "0.5115446", "0.5111836", "0.51099306", "0.51098317", "0.5106068", "0.5102533", "0.50872743", "0.50773454", "0.507704", "0.5068446", "0.5065641", "0.505884", "0.50568545", "0.50560296", "0.5046806", "0.50254697", "0.50223154", "0.5019886", "0.5019589", "0.50154996", "0.50105727", "0.500811", "0.49999413", "0.49945945", "0.4990801", "0.49881166", "0.49861512", "0.4983719", "0.49746993", "0.49746993", "0.49731496", "0.49679914", "0.4963944", "0.49605256", "0.49308243", "0.4929133", "0.49266878", "0.4917334", "0.4917334", "0.4911965", "0.4911194", "0.49097538", "0.49029776", "0.48959932", "0.4890545", "0.48897532", "0.48885664", "0.48742786", "0.48737267", "0.48723093", "0.4870661", "0.48661909", "0.48592204", "0.48584235", "0.4856642", "0.48531377", "0.48506305", "0.48416576", "0.4840715", "0.48385364", "0.48381472", "0.48375", "0.48368824", "0.48343506" ]
0.5099999
42
Return the referer information if it was via search, return the search terms used
def referer_info { :url => request.env["HTTP_REFERER"], :host => NoPlanB::UrlUtils.hostname(request.env["HTTP_REFERER"]), :search_engine => NoPlanB::UrlUtils.is_search_engine?(request.env["HTTP_REFERER"]), :search_terms => NoPlanB::UrlUtils.extract_search_terms(request.env["HTTP_REFERER"]) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def searchterm\r\n @@st.get_searchterm(referer)\r\n end", "def referer; end", "def referer\n @request[FREFERER]\n end", "def referer_from_request request\n if referer = attribute_from_request(request, :referer)\n TingYun::Agent::HTTPClients::URIUtil.strip_query_string referer.to_s\n end\n end", "def request_referer(request, uri, referer); end", "def referer_from_request(request)\n if referer = attribute_from_request(request, :referer)\n HTTPClients::URIUtil.strip_query_string(referer.to_s)\n end\n end", "def referer\n @headers[\"HTTP_REFERER\"] || \"/\"\n end", "def index\n\n if (params[:query] != nil)\n q = \"%#{params[:query]}%\";\n\n @queryParam = params[:query];\n #find referents that have fields fuzzilly matching the query\n #works for all the fields inside the referents. doesn't work with telephone or organisme since those aren't field\n #in Referents\n\n result = Referent.where(\"LOWER(prenom) LIKE ? OR LOWER(nom) LIKE ? OR LOWER(courriel) LIKE ? OR LOWER(fax) LIKE ? OR LOWER(title) LIKE ? OR LOWER(departement) LIKE ? OR refid LIKE ?\",q.downcase,q.downcase,q.downcase,q.downcase,q.downcase,q.downcase,q)\n resultTelephone = Telephone.where(\"number LIKE ?\",q)\n\n resultTelephone.each do |telephone|\n result = result + Referent.find(telephone.referent_id)\n end\n\n @referents = result\n\n else\n @queryParam = nil;\n @referents = Referent.all;\n end\n\n end", "def search_terms\n return @search_terms\n end", "def referrer\n if Settings.hostname.ends_with?('.gov')\n \"https://#{Settings.hostname}\".gsub('vets', 'va')\n else\n 'https://review-instance.va.gov' # VAMF rejects Referer that is not valid; such as those of review instances\n end\n end", "def referrers(input)\n get_single_method(:referrers, input)\n end", "def get_urls(proxy=nil)\n query = SETTINGS.extract_query!\n payloads = SETTINGS.create_payloads(PAYLOAD_TEMPLATE_PATH)\n File.read(\"#{QUERY_BLACKLIST_PATH}\").each_line do |black| # check if the search query is black listed\n if query == black\n FORMAT.warning(\"Query: #{query} is blacklisted, defaulting to random query\")\n query = File.readlines(\"#{PATH}/lib/lists/search_query.txt\").sample # Retry if it is\n end\n end\n\n FORMAT.info(\"I'm searching for possible SQL vulnerable sites, using search query #{query.chomp}\")\n agent = Mechanize.new\n if proxy\n agent.set_proxy(proxy.split(\":\").first, proxy.split(\":\").last) # Set your proxy if used\n end\n correct_agent = SETTINGS.random_agent?\n agent.user_agent = correct_agent\n\n correct_agent == DEFAULT_USER_AGENT ? FORMAT.info(\"Using default user agent\") :\n FORMAT.info(\"Grabbed random agent from #{RAND_AGENT_PATH}\")\n\n google_page = agent.get(\"http://google.com\")\n google_form = google_page.form('f')\n\n FORMAT.info(\"Verifying search query...\")\n unless SETTINGS.test_query(query, correct_agent, proxy)\n query = File.readlines(\"#{PATH}/lib/lists/search_query.txt\").sample\n LOGGER.info(\"Query changed to: #{query}\")\n end\n\n google_form.q = \"#{query}\" # Search Google for the query\n url = agent.submit(google_form, google_form.buttons.first)\n\n url.links.each do |link|\n if link.href.to_s =~ /url.q/ # Pull the links from the search\n str = link.href.to_s\n str_list = str.split(%r{=|&})\n urls = str_list[1]\n if urls.split(\"/\")[2].start_with?(*SKIP) # Skip all the bad URLs\n next\n end\n urls_to_log = URI.decode(urls)\n FORMAT.success(\"Site found: #{urls_to_log}\")\n sleep(0.3)\n payloads.each { |payload|\n File.open(\"#{SITES_TO_CHECK_PATH}\", \"a+\") { |to_check| to_check.puts(\"#{urls_to_log}#{payload}\")}\n }\n end\n end\n FORMAT.info(\"I've dumped possible vulnerable sites into #{SITES_TO_CHECK_PATH}\")\n end", "def referrers(input)\n get_single_method('referrers', input)\n end", "def http_referer\n uri_path(request.env['HTTP_REFERER']) rescue '/'\n end", "def referer(referer)\n @request.env['HTTP_REFERER'] = referer\n end", "def referrer_code\n if referrer\n referrer.referral_code\n else\n nil\n end\n end", "def search\n url = @@url\n url.query = Addressable::URI.form_encode(\n 'v' => '1.0',\n 'q' => (@args[:site]) ? @query + \" site:#{ @args[:site] }\" : @query ,\n 'key' => @google_api_key,\n 'userip' => @ip_number\n )\n results = JSON.parse(open(url, 'Referer' => @referrer_site).read) rescue {}\n \n @response_details = results['responseDetails'] # => nil,\n @response_status = results['responseStatus' ] # => 200\n \n @cursor = Cursor.new(results['responseData']['cursor'])\n \n results['responseData']['results']\n end", "def go\n captured = query_by_referrer\n return captured if captured.found?\n\n default_ordered_query\n end", "def related_posts_search_query\n \"source:#{canonical_url}\"\n end", "def referers type, field\n ::Card.search type: type, limit: 10, right_plus: [field, refer_to: object.card_id]\n end", "def referer_params\n params.require(:referer)\n end", "def url_search_terms\n if openbis?\n []\n else\n super\n end\n end", "def search_terms(resource)\n return nil unless resources.include? resource\n @data[resource][0].keys\n end", "def google_search(query, sitelink)\n s = Google::Search::Web.new\n s.query = \"#{query}\" + \" site:#{sitelink}\"\n s.get_response\n end", "def headers\n { 'Referer' => 'http://www.google.com' }\n end", "def search_terms\n return self.broadcast_list\n end", "def research_sites(search_str)\n search_sites = link_to \"Google\", 'http://www.google.com/search?q=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Yahoo\", 'http://search.yahoo.com/search?p=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Technorati\", 'http://www.technorati.com/search' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Wikipedia\", 'http://en.wikipedia.org/w/wiki.phtml?search=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"del.icio.us\", 'http://del.icio.us/search/?all=' + search_str, :target => '_blank'\n end", "def get_with_ref(agent, url, params, referer = nil)\n if referer\n agent.get(url, params, referer)\n else\n agent.get(url, params)\n end\nend", "def scopus_search(request)\n \n if (doi = get_doi(request.referent))\n return CGI.escape( \"DOI(#{phrase(doi)})\" )\n elsif (pmid = get_pmid(request.referent))\n return CGI.escape( \"PMID(#{phrase(pmid)})\" )\n elsif (isbn = get_isbn(request.referent))\n # I don't think scopus has a lot of ISBN-holding citations, but\n # it allows search so we might as well try. \n return CGI.escape( \"ISBN(#{phrase(isbn)})\" )\n else \n # Okay, we're going to try to do it on issn/vol/issue/page.\n # If we don't have issn, we'll reluctantly use journal title\n # (damn you google scholar).\n metadata = request.referent.metadata\n issn = request.referent.issn\n if ( (issn || ! metadata['jtitle'].blank? ) &&\n ! metadata['volume'].blank? &&\n ! metadata['issue'].blank? &&\n ! metadata['spage'].blank? )\n query = \"VOLUME(#{phrase(metadata['volume'])}) AND ISSUE(#{phrase(metadata['issue'])}) AND PAGEFIRST(#{phrase(metadata['spage'])}) \"\n if ( issn )\n query += \" AND (ISSN(#{phrase(issn)}) OR EISSN(#{phrase(issn)}))\"\n else\n query += \" AND EXACTSRCTITLE(#{phrase(metadata['jtitle'])})\"\n end\n return CGI.escape(query)\n end\n \n end\n end", "def kitties_search( q )\r\n \"https://www.cryptokitties.co/search?include=sale,sire,other&search=#{q}\"\r\nend", "def referrers\n logs.take(DEFAUTLS[:top_x_referrers]).map{ |log| Struct::ReferrerReport.new(log.referrer, log[:visits]) }\n end", "def gather_search\n local_search = Search.search @query\n unless local_search.nil?\n local_search = FoodItem.fetch_local_items local_search['food_items']\n return local_search unless local_search.nil?\n end\n\n remote_search = search_apis @query # adds searches remote end for elements\n unless remote_search.nil?\n Search.add @query, remote_search # adds elements to search\n remote_search = add_multiple_food_items remote_search unless remote_search.nil?\n return remote_search unless remote_search.nil?\n end\n\n nil # fallback\n end", "def index\n @referrers = Referrer.all\n end", "def referred_by?(agent)\n self.referred? && agent.to_s == self.referrer.to_s\n end", "def text_search_terms\n @text_search_terms ||=\n [first_name_query, middle_name_query].flatten.compact_blank.uniq\n end", "def arches\n @arches ||= lipo.info\n end", "def autocomplete_known_uri_search\n @known_uris = params[:term].blank? ? [] : search_known_uris_by_name_or_uri(params[:term])\n render_autocomplete_results\n end", "def referrer\n if self.contributions.first.try(:referrer_id) &&\n self.contributions.first.try(:contributor_id) &&\n self.contributions.first.referrer_id == self.contributions.first.contributor_id\n self.contributions.first.referrer\n .slice(:id, :first_name, :last_name, :email, :title, :phone, :linkedin_url)\n .merge(previous_changes: self.contributions.first.referrer.previous_changes)\n else\n nil\n end\n end", "def referral_hit(referring_user_or_code=nil,viewing_user_id=0)\n if referring_user_or_code.is_a?(String)\n if (ref_code = referrals.find_by_code(referring_user_or_code))\n hit(ref_code.code, viewing_user_id)\n else\n referral_hit(nil, viewing_user_id)\n end\n else\n ref_code = referral_code(referring_user_or_code)\n hit(ref_code, viewing_user_id) \n end\n end", "def external_search_urls\n {\n Google_Maps: \"https://maps.google.com/maps?q=\",\n Google_Search: \"https://www.google.com/search?q=\",\n Wikipedia: \"https://en.wikipedia.org/w/index.php?search=\"\n }.freeze\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 extract_uris( graph ) \n graph.terms.map{|t| t.to_s if t.uri?}.compact\nend", "def referer(utmr)\n @utmr = utmr\n self\n end", "def further_details \n {\n 'referer_host' => 'referer_path',\n 'referer_path' => 'referer_params',\n \n 'agent.name' => 'agent.major_version',\n 'agent.os' => 'agent.name',\n 'agent.major_version' => 'agent.full_version',\n 'agent.engine_name' => 'agent.engine_version', \n }\n end", "def get_search_terms(string)\n\treturn \"q=\"+string.join(\"+\")\nend", "def search\n if params[:keyword].nil? or params[:keyword].empty?\n redirect_back :fallback_location => root_path, :alert => \"Unrecognized user input. \"\n else\n keyword = params[:keyword].downcase.strip\n end\n @domain = Domain.find_by(name: keyword)\n if @domain.present?\n site_header=[\"Primary Website\",\"Primary IP\",\"Port\",\"Hosting Status\",\"Server\",\"Response Code\",\"MD5 Fingerprint\",\"Detected Redirection\",\"Timestamp\"]\n @prime_site = site_header.zip(site_lookup(@domain.name)).to_h\n else\n @prime_site = nil\n end\n end", "def references\n (headers['References']||'').scan(/(<[^<]+?>)/).flatten\n end", "def referer\n\t\t#referer = User.find_by(id: params[:referer].to_i)\n\t\tredirect_to '/auth/facebook?referer=' + params[:referer]\n\tend", "def google(query)\n url = \"http://www.google.com/search?q=#{CGI.escape(query)}\"\n res = Nokogiri::HTML(open(url)).at(\"h3.r\")\n\n title = res.text\n link = res.at('a')[:href]\n desc = res.at(\"./following::div\").children.first.text \nrescue \n \"No results found\"\nelse\n CGI.unescape_html \"#{title} - #{desc} (#{link})\"\nend", "def suggest_location\n return @suggest_location\n end", "def search_anchor\n {}\nend", "def conceptwiki_ep_search\n\t\tOPS_API_FREETEXT_SEARCH_URL\n\tend", "def index\n\n if params[:source] == \"external\"\n @referrer_urls = ReferrerUrl.all(:conditions => \"url NOT LIKE '%http://www.onshutters.com%'\")\n elsif params[:source] == \"internal\"\n @referrer_urls = ReferrerUrl.all(:conditions => \"url LIKE '%http://www.onshutters.com%'\")\n else\n @referrer_urls = ReferrerUrl.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @referrer_urls }\n end\n end", "def suggest_results\n Blacklight.default_index.connection.send_and_receive(suggest_handler_path, params: request_params)['suggest']\n end", "def lookup_text\n\t\t$app.data_controller.search_matching_links_to @search_text\n\tend", "def search_results search\n search = normalize search\n @searches[search.to_s]\n end", "def index\n if !params[:cuisine]\n query = params[:search][:term].split(\",\")\n result = Restaurant.get_results_from_google_places(query, current_user)\n @restaurants = result\n else\n query = params[:cuisine]\n result = Restaurant.get_results_from_google_places(query, current_user, true)\n @restaurants = result\n end\n\n # so that we render the links only when we have recommendations from friends\n @found_recommendations = []\n @restaurants.each do |restaurant|\n recommendations = Recommendation.get_friend_recommedation_by_restaurant(restaurant[\"id\"], @registered_friends)\n if recommendations.empty?\n @found_recommendations << false\n else\n @found_recommendations << true\n end\n end\n end", "def searchauthor\n end", "def recur_referrers\n if referrer_id.blank?\n []\n else\n [referrer] + referrer.recur_referrers\n end\n end", "def related params = {}\n request(params.merge(:report_type => :phrase_related))\n end", "def store_referer\n store_referer_except\n end", "def names\n @searches.names\n end", "def url\n resource.url + '/referrer_filters'\n end", "def search\n @user = current_user\n temp_revs = []\n unless params[:search_terms].nil?\n tags = tags_from_string(params[:search_terms])\n temp_revs = filter_reviews(temp_revs, tags)\n end\n @user.friends.each do |friend|\n temp_revs += friend.reviews\n end\n tags = tags_from_string(params[:search_terms])\n temp_revs = filter_reviews(temp_revs, tags)\n @reviews = temp_revs.sort_by(&:post_date).reverse\n end", "def stored_location_for *args\n referer = params[:referer] || request.referer\n\n if referer && (referer =~ %r|^https?://#{request.host}#{root_path}| ||\n referer =~ %r|^https?://#{request.host}:#{request.port}#{root_path}|)\n #self-referencing absolute url, make it relative\n referer.sub!(%r|^https?://#{request.host}(:#{request.port})?|, '')\n elsif referer && referer =~ %r|^(\\w+:)?//|\n referer = nil\n end\n \n if referer && referer_blacklist.any? {|blacklisted| referer.starts_with?(blacklisted) }\n referer = nil\n elsif referer && referer[0,1] != '/'\n referer = nil\n end\n\n if referer and request.xhr?\n referer += (referer =~ /\\?/ ? \"&\" : \"?\")\n referer += \"no_layout=true\" \n end\n \n return referer || super(*args)\n end", "def directors_hash\n search_by_itemprop_hash 'director'\n end", "def search_for_company(search, cookies)\n companies = []\n search = search.gsub(/ /, '+')\n searchpage = '/FreeTextSearch.xhtml?opCode=search&autoSuggested=true&freeText='\n result = request_page(\"#{searchpage}#{search}\", cookies)\n if result.body.include?('Contacts at this Company')\n id = result.body.split('id=\"companyGuid\" name=\"companyGuid\" value=\"')[1].split('\"')[0].to_i\n elsif result.body.include?('Contacts Search Results')\n return parse_multiple_search_results_employee(result)\n elsif result.body.include?('did not match any results')\n return nil\n elsif result['Location']\n id = result['Location'].split('/')[5].to_i\n else\n return parse_multiple_search_results(result)\n end\n return id\nend", "def get_search_terms(array_of_terms)\n\t\treturn \"q=\"+array_of_terms.join(\"+\")\n\tend", "def referred?\n !self.referrer.blank?\n end", "def before_GET(req)\n super\n @term = term(req)\n @title = \"Search for #{term(req)}\"\n end", "def searches\n Boundary.get(@url)\n end", "def check_referer\n referer = request.env['HTTP_REFERER'] || \"\"\n if (referer.match(start_url) || referer.match('blog.collectic.us')) && !referer.match(session_url) && !referer.match(login_url)\n store_location(request.env['HTTP_REFERER'])\n end\n end", "def single_searcher\n searcher_name = params[:searcher_name]\n\n searcher_cfg = searcher_config(searcher_name)\n if searcher_cfg and searcher_cfg.has_key? 'loaded_searches'\n additional_services = Array.new(searcher_cfg['loaded_searches'])\n else\n additional_services = []\n end\n loaded_searches(additional_services)\n\n @common_searches = []\n if searcher_cfg and searcher_cfg.has_key? 'common_searches'\n @common_searches = searcher_cfg['common_searches']\n end\n\n #TODO: maybe a default template for single-searcher searches?\n http_search(searcher_name, \"quick_search/search/#{searcher_name}_search\")\n end", "def search_args\n [params[:query], current_user]\n end", "def setup_search\n if current_user\n @segment_search = current_user.segments.search(params[:search])\n @terms_search = current_user.translations.search(params[:search])\n else\n @terms_search = nil\n @segment_search = nil\n end\n end", "def go_terms\n go_db_id = ExternalDb.find_by_db_name('GO').id\n return self.all_xrefs.select{|x| x.external_db_id == go_db_id}.collect{|x| x.dbprimary_acc}.uniq\n end", "def search_query(search_terms)\n resource_handler.searchable_attributes.map do |attribute|\n if relation = attribute[:relation]\n \"LOWER(#{relation[:model_association].klass.table_name}.#{relation[:attr_method]}) LIKE #{search_terms}\"\n else\n \"LOWER(#{resource_handler.model.table_name}.#{attribute[:name]}) LIKE #{search_terms}\"\n end\n end.join(\" OR \")\n end", "def get_last_request\n\t\tsearch = {phrase: \"\", thumbnail: nil}\n\t\tsearch = searched.pop if @searched != []\n\t\tsearch\n\tend", "def referrer\n if params[:code]\n wechat_api_connect_solver = WechatApi::ConnectSolver.new(params[:code]).resolve\n\n # this is taken from application controller\n if wechat_api_connect_solver.success?\n user = wechat_api_connect_solver.data[:customer]\n\n # we turn him into a real referrer\n ReferrerMaker.new(user).convert!(group_token: params[:token])\n SlackDispatcher.new.message(\"ReferrerMaker was called for user `#{user&.id}`\")\n\n # is it a new user ?\n handle_after_sign_up! user\n\n # we force him to have a landing on package sets\n session[:landing] = :package_sets\n # we finally sign him in\n sign_in_user user\n return\n\n end\n end\n redirect_to root_path\n end", "def data\n what = searched_for(@term)\n where = searched_in(@filter)\n {\n term: @term,\n title: (what + where).sub(/\\sin\\s|\\sfor\\s/, ''), # strip out opening ' in ' or ' for '\n cpvs: @cpvs,\n keywords: @term,\n countries: @filter.countries,\n what: what,\n where: where,\n }\n end", "def refused_docs\n data['refusedDocs']\n end", "def similars\n uri = URI(site.home)\n if match = uri.host.match( /\\b\\w*\\.\\w*$/)\n Site.joins(:reference).\n where(\"type = 'SiteReference' and url ILIKE ?\", \"%#{match[0]}%\").\n uniq.\n keep_if { |other| other.id != site.id }\n else\n []\n end\n end", "def search_ex_url(ex)\n \"http://www.google.com/search?q=#{URI.escape ex.message}\"\nend", "def person_relator_terms\n {\n \"aut\" => \"Author\",\n \"cre\" => \"Creator\",\n \"edt\" => \"Editor\",\n \"phg\" => \"Photographer\", \n \"mdl\" => \"Module leader\",\n \"spr\" => \"Sponsor\",\n \"sup\" => \"Supervisor\" \n }\n end", "def parse_search(q)\n # TODO continue\n end", "def safe_search(search_terms, doc)\n search_terms.map do |term|\n begin\n result = doc.search(term)\n if result.empty? or result.nil?\n next\n else\n return result\n end\n rescue Nokogiri::XML::XPath::SyntaxError\n next\n rescue Exception => e\n puts e.full_message\n end\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 location\n recommendations 'location'\n end", "def parse_search; end", "def search2(doc)\n doc.search('.subtext > a:nth-child(3)').map {|link| link['href'] }\n end", "def terms\n @locations.map(&:term).uniq\n end", "def find_term_references(doc, terms)\n logger.info(\"+ Finding references to terms\")\n\n i = 0\n\n # sort terms by the length of the defined term, desc,\n # so that we don't find short terms inside longer\n # terms\n terms = terms.to_a.sort_by { |pair| -pair[1].size }\n\n # look for each term\n for term_id, term in terms\n doc.xpath('//a:body//text()', a: NS).each do |text|\n # replace all occurrences in this text node\n\n # unless we're already inside a def or term element\n next if ([\"def\", \"term\"].include?(text.parent.name))\n\n # don't link to a term inside its own definition\n owner = find_up(text, 'subsection')\n next if owner and owner.at_xpath(\".//a:def[@refersTo='##{term_id}']\", a: NS)\n\n while posn = (text.content =~ /\\b#{Regexp::escape(term)}\\b/)\n # <p>A delegation under subsection (1) shall not prevent the <term refersTo=\"#term-Minister\" id=\"trm357\">Minister</term> from exercising the power himself or herself.</p>\n node = doc.create_element('term', term, refersTo: \"##{term_id}\", id: \"trm#{i}\")\n\n pre = (posn > 0) ? text.content[0..posn-1] : nil\n post = text.content[posn+term.length..-1]\n\n text.before(node)\n node.before(doc.create_text_node(pre)) if pre\n text.content = post\n\n i += 1\n end\n end\n end\n end", "def legal_forward_references(identification_phrases)\n identification_phrases.map do |phrase|\n phrase.is_a?(NounPhrase) ? phrase.term : nil\n end.compact.uniq\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 referrer_params\n params.require(:referrer).permit(:name)\n end", "def lucky(bot, search_term = \"\")\n # Make the google search\n uri = Google::Search::Web.new(:query => search_term.to_s).first\n return if not uri\n uri = uri.uri.to_s\n\n # Return if the url is too short\n return if uri.length < @config[:min_length]\n \n # Give the reply\n bot.say(\"#{@config[:prompt]} #{uri}\")\n end", "def set_search_terms\n if relevent_dish\n self.search_terms = self.name_translations.collect do |key,value|\n next value\n end.join(\" \")\n if self.restaurant\n self.restaurant_name = self.restaurant.name\n end\n if img = self.image.first\n self.top_image = img.img_url_medium\n end\n else\n self.search_terms = nil\n end\n save\n end", "def author_details_goodreads_library\n client = Goodreads::Client.new(Goodreads.configuration)\n results = client.author_by_name(params[:q]) \n return results\n end", "def validate_http_referer(ref)\n # This expects 'ref' to be a valid (or at least mostly valid) url. It may through an exception if it isn't\n ref_uri = Addressable::URI.heuristic_parse(ref, :scheme => 'http')\n address_uri = address_as_uri\n \n schemes_match?(ref_uri.scheme, address_uri.scheme) && hosts_match?(ref_uri.host, address_uri.host) && paths_match?(ref_uri.path, address_uri.path)\n# schemes_match?(ref_uri.scheme) && hosts_match?(ref_uri.host) && paths_match?(ref_uri.path)\n end" ]
[ "0.69649386", "0.64264566", "0.6320683", "0.6199506", "0.6028654", "0.58727735", "0.584195", "0.5787574", "0.56166077", "0.5594525", "0.5562957", "0.55564165", "0.5523787", "0.5522118", "0.5482786", "0.5435953", "0.54346365", "0.5345462", "0.5341624", "0.53237164", "0.5307201", "0.526888", "0.5242197", "0.5235473", "0.52341163", "0.52335364", "0.52309537", "0.5227511", "0.51991284", "0.5198709", "0.51964885", "0.51523906", "0.514052", "0.51301265", "0.5123231", "0.5097459", "0.5090048", "0.50852525", "0.5083107", "0.507732", "0.5076226", "0.5059236", "0.5049603", "0.5024148", "0.5020278", "0.500614", "0.50035703", "0.50033593", "0.4989104", "0.49622324", "0.49481985", "0.493741", "0.49306267", "0.49295878", "0.4928514", "0.48853225", "0.4885223", "0.48812392", "0.48761484", "0.48685786", "0.4864605", "0.48638657", "0.48593494", "0.48574957", "0.48525703", "0.48402354", "0.4827699", "0.48194402", "0.48164764", "0.48153055", "0.48011583", "0.47954333", "0.47929332", "0.4791248", "0.4776101", "0.47751477", "0.47722226", "0.47661123", "0.4763108", "0.47629866", "0.47601423", "0.47562587", "0.47559613", "0.47532904", "0.475087", "0.47503918", "0.4735614", "0.47342944", "0.47318345", "0.4730753", "0.47294188", "0.47288746", "0.4728207", "0.4725632", "0.4725632", "0.47252658", "0.4724063", "0.4723332", "0.47214988", "0.47173715" ]
0.7557255
0
Move player with the WSAD buttons
def move(char) case char.downcase when 'w', 'k' map.move_player(:north) when 's', 'j' map.move_player(:south) when 'a', 'h' map.move_player(:west) when 'd', 'l' map.move_player(:east) when 'r' map.reset when 'x' exit else raise MoveNotPermitted end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_player_movement\r\n # Move player in the direction the directional button is being pressed\r\n case Input.dir4\r\n when 2\r\n move_down\r\n when 4\r\n move_left\r\n when 6\r\n move_right\r\n when 8\r\n move_up\r\n end\r\n end", "def Move(player, start, stop)\r\n end", "def move(player, x, y)\n\n end", "def change_turn\n if @player_to_move == \"w\"\n @player_to_move = \"b\"\n else\n @player_to_move = \"w\"\n end\n end", "def turn_to_player\n diffx = @x - $game.player.x\n diffy = @y - $game.player.y\n down = diffy < 0\n left = diffx > 0\n right = diffx < 0\n up = diffy > 0\n if down\n @direction = 2\n elsif up\n @direction = 8\n elsif left\n @direction = 4\n elsif right\n @direction = 6\n end\n end", "def do_player_turn\n eval_popup_queue\n start_player_turn if !@player_turn_init\n tbs_unit_selection \n \n map = $game_map\n show_unit_hud(map.events[map.tbu_id_xy($game_player.x,$game_player.y)])\n update_all_sh_acts_win\n update_hl_follow if TM.selecting_target?\n hide_skill_disp_win\n preview_effect_tb\n end", "def move_away_from_player\n move_away_from_character($game_player)\n end", "def move\n if me\n turn_left if window.button_down? Gosu::KbLeft\n turn_right if window.button_down? Gosu::KbRight\n run if window.button_down? Gosu::KbUp\n run_with_ball\n end\n end", "def second_players_move(current_player)\n player = second_player(current_player)\n player_move(player)\n end", "def switch_player\n @current_player = (@current_player == 'x' ? 'o' : 'x')\n end", "def play_turn\n move = @current_player.get_move\n switch_players!\n @board.place_mark(move, :X)\n end", "def move_player1 (choice_case)\n symbole_player1 = @player1.symbole\n @board.move_player1(choice_case, symbole_player1)\n @@game_count+=1\n end", "def move\n \n end", "def move\n \n end", "def move\n if $window.button_down?(Gosu::KbD)\n @facing = :right\n @x += speed unless out_of_bounds?(@x + speed, @y)\n end\n \n if $window.button_down?(Gosu::KbA)\n @facing = :left\n @x -= speed unless out_of_bounds?(@x - speed, @y)\n end\n \n if $window.button_down?(Gosu::KbW)\n @facing = :up\n @y -= speed unless out_of_bounds?(@x, @y - speed)\n end\n \n if $window.button_down?(Gosu::KbS)\n @facing = :down\n @y += speed unless out_of_bounds?(@x, @y + speed)\n end\n \n sprinting?\n end", "def move\n\n end", "def move\r\n @x += @velx\r\n @y += @vely\r\n\r\n #To introduce friction to the player so that it can slow down\r\n @velx *= FRICTION\r\n @vely *= FRICTION\r\n\r\n #To stop the player from moving out of the left of the window\r\n if @x > @window.width - @radius\r\n @velx = 0\r\n @x = @window.width - @radius\r\n end\r\n\r\n #To stop the player from moving out of the right of the window\r\n if @x < @radius\r\n @velx = 0\r\n @x = @radius\r\n end\r\n\r\n #To stop the player from moving out of the bottom of the window\r\n if @y > @window.height - @radius\r\n @vely = 0\r\n @y = @window.height - @radius\r\n end\r\n end", "def update\n @player.shape.body.reset_forces\n\n 6.times do\n if button_down? Gosu::KbLeft or button_down? Gosu::GpLeft then\n @player.move_left\n end\n if button_down? Gosu::KbRight or button_down? Gosu::GpRight then\n @player.move_right\n end\n #if button_down? Gosu::KbUp or button_down? Gosu::GpRight then\n # @player.shape.body.a += 0.1\n #\n # puts @player.shape.body.a.inspect\n #end\n #if button_down? Gosu::KbDown or button_down? Gosu::GpRight then\n # @player.shape.body.a -= 0.1\n # puts @player.shape.body.a.inspect\n #end\n\n\n @space.step 1.0/10.0\n end\n end", "def current_player_moves\r\n current_player.play(board)\r\n end", "def playMove _obj, _args\n \"_obj playMove _args;\" \n end", "def update_two_player\n # if moving up\n if Input.press?(Input::SHIFT)\n self.y -= 4 unless self.y <= 0\n end\n # if moving down\n if Input.press?(Input::CTRL)\n self.y += 4 unless self.ey >= 480\n end\n end", "def change_player\n\n end", "def play_turn\n @board.place_mark(@current_player.get_move, @current_player.mark)\n switch_players!\n end", "def switch_current_player\n\t\tif @playerx\n\t\t\t@playerx = false\n\t\t\t@current_player.set_text(\"Player: O\")\n\t\telse\n\t\t\t@playerx = true\n\t\t\t@current_player.set_text(\"Player: X\")\n\t\tend\t\t\n\tend", "def move_to(id, x, y, w=false, no_t = false)\n RME::deprecated_command(\"move_to\", \"use 'event_move_to' or 'player_move_to'\")\n event(id).move_to_position(x, y, w, no_t)\n end", "def switch_player_position\n if @position == 1\n @symbol = \"\\u{274C}\"\n @position = 2\n elsif @position == 2\n @symbol = \"\\u{2705}\"\n @position = 1\n end\n end", "def move_toward_player\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n return if sx == 0 && sy == 0\n\n abs_sx = sx.abs\n abs_sy = sy.abs\n if abs_sx == abs_sy\n rand(2) == 0 ? abs_sx += 1 : abs_sy += 1\n end\n\n if abs_sx > abs_sy\n sx > 0 ? move_left : move_right\n unless moving? || sy == 0\n sy > 0 ? move_up : move_down\n end\n else\n sy > 0 ? move_up : move_down\n unless moving? || sx == 0\n sx > 0 ? move_left : move_right\n end\n end\n end", "def turn\n current_move = current_player.move(@board)\n current_token = current_player.token\n if self.board.valid_move?(current_move)\n self.board.update(current_move, current_player)\n self.board.display\n # binding.pry\n else\n turn\n end\n end", "def play\n p_arr = randomize_players(@player_1, @player_2)\n current_player = p_arr[0]\n next_player = p_arr[1]\n current_player.piece = 'X'\n next_player.piece = 'O'\n puts \"Player #{current_player.id.to_s} goes first!\"\n\n end_message = \"\"\n loop do\n set_cell(current_player.move(self))\n if check_win?\n end_message = current_player.win_message\n break\n elsif check_draw?\n end_message = \"It's a draw.\"\n break\n end\n current_player, next_player = next_player, current_player\n end\n\n display_board\n end_message\n end", "def move_player2 (choice_case)\n symbole_player2 = @player2.symbole\n @board.move_player2(choice_case, symbole_player2) \n @@game_count+=1\n end", "def switch_player(player_sym)\n check_full_board\n player_sym == PLAYER1_SYM ? player_sym = PLAYER2_SYM : player_sym = PLAYER1_SYM\n make_move(player_sym)\n end", "def button_up(id)\n\t\tcase id\n\t\twhen 44 then @player_one.fire\n\t\twhen 225 then @player_two.fire\n\t\twhen 41 then exit\n\t\tend\n\tend", "def move(direction)\n \n end", "def moving!\n end", "def move\n puts \"The computer is playing...\".cyan\n sleep(0.5) #computer \"thinks\" for half a second, this seemed more realistic\n return if @game.game_over?\n space = (@game.available_moves & [1,3,5,7,9]).first\n if space.nil? \n space = @game.available_moves.first\n end\n @game.place_piece(space, @piece)\n end", "def winning_move\n simulate_move(@player_num)\n end", "def move_player (start, stop, piece)\r\n $board[stop[0]][stop[1]] = piece\r\n $board[start[0]][start[1]] = nil \r\n $board[stop[0]][stop[1]].turn += 1\r\n @prev_coord= [stop[0], stop[1]]\r\n @prev_delta_y = (stop[1] - start[1]).abs\r\n if piece.class == Pawn and (stop[1] == 7 or stop[1] == 0)\r\n promotion(stop, piece)\r\n end \r\n end", "def turn\n input = current_player.move(board)\n\n if board.valid_move?(input)\n board.update(input, current_player)\n board.display\n else\n turn\n end\n end", "def turn_away_from_player\n # Get difference in player coordinates\n sx = @x - $player.x\n sy = @y - $player.y\n # If coordinates are equal\n if sx == 0 and sy == 0\n return\n end\n # If horizontal distance is longer\n if sx.abs > sy.abs\n # Turn to the right or left away from player\n sx > 0 ? turn_right : turn_left\n # If vertical distance is longer\n else\n # Turn up or down away from player\n sy > 0 ? turn_down : turn_up\n end\n end", "def update_one_player\n # if moving up\n if Input.press?(Input::UP)\n self.y -= 4 unless self.y <= 0\n end\n # if moving down\n if Input.press?(Input::DOWN)\n self.y += 4 unless self.ey >= 480\n end\n end", "def move\n\t\tif @direction == \"N\"\n\t\t\t@y += 1\n\t\telsif @direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif @direction == \"E\"\n\t\t\t@x += 1\n\t\telsif @direction == \"S\"\n\t\t\t@y -= 1\n\t\tend\n\tend", "def move\n frm.button(:value=>\"Move\").click\n end", "def switch_player\n @current_player = if @current_player == @player_o\n @player_x\n else\n @player_o\n end\n\n @number_of_turns += 1\n end", "def update_control\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # reset move speed\n player.move_speed = player.normal_speed\n # reset spriteset name\n player.character_name = player.character_name_org\n # if allowed to change speed\n unless $game_system.map_interpreter.running? ||\n player.move_route_forcing || $game_temp.message_window_showing\n # if run button works and running\n if $game_system.running_button && Input.press?(Input::Run)\n # set running speed\n player.move_speed = Config::RUN_SPEED\n # if sneak button works and sneaking\n elsif $game_system.sneaking_button && Input.press?(Input::Sneak) ||\n Config::SNEAK_SPEED > 0 && Config::SNEAK_ON_CHARGE && player.charging?\n # set sneaking speed\n player.move_speed = Config::SNEAK_SPEED\n end\n end\n # if battler exists and either dead or select triggered\n if player.battler != nil && ($game_system.select_button &&\n Input.trigger?(Input::Select) || player.battler.dead?)\n # switch to next valid actor\n switch_leader\n end \n # setup sprite animation\n player.sprite_animation_setup\n # update action\n player.update_action\n # if allowed to turn and pressed turning button or defending\n if ((player.ai.act.defend? && player.attacked == 0) ||\n $game_system.turn_button && Input.press?(Input::Turn)) &&\n !player.moving? && !$game_system.map_interpreter.running? &&\n !player.move_route_forcing && !$game_temp.message_window_showing\n # get input depending on confusion\n input = (player.restriction == 3 ? 10 - Input.dir4 : Input.dir4)\n # depending on input turn\n case input\n when 2 then player.turn_down\n when 4 then player.turn_left\n when 6 then player.turn_right\n when 8 then player.turn_up\n end\n # updates any attacked action\n player.update_attacked\n # abort method\n return nil\n end\n # updates any attacked action\n player.update_attacked\n # if acting\n if player.in_action > 0\n # decrease action counter if in_action is greater than 0\n player.in_action -= 1 if player.in_action > 0\n # return data\n return [player.moving?, player.real_x, player.real_y]\n end\n # if allowed to move\n unless $game_system.map_interpreter.running? ||\n player.move_route_forcing || $game_temp.message_window_showing\n # if jump button was pressed and not already jumping\n if $game_system.jumping_button && Input.trigger?(Input::Jump) &&\n !player.jumping? && player.restriction < 4\n # set to jump\n @memory_jump = true\n end\n # if not moving\n unless player.moving?\n # get jumping range\n range = Config::JUMPING\n # if jumping turned on and not jumping and jumped\n if range > 0 && !player.jumping? && @memory_jump\n # if sneaking or running is possible\n if Config::RUN_SPEED > 0 || Config::SNEAK_SPEED > 0\n # get difference between current speed and normal speed\n dplus = player.move_speed - player.normal_speed\n else\n # difference is 0\n dplus = 0\n end\n # get direction\n direction = $game_system._8_way ? Input.dir8 : Input.dir4\n # set jumping direction\n x, y = Cache::DirOffsets[direction]\n # jump into direction with considering running/sneaking\n player.jump(x*range + x*dplus, y*range + y*dplus, direction)\n # if not already jumping\n elsif !player.jumping?\n # move\n move($game_system._8_way ? Input.dir8 : Input.dir4)\n # allow idle if no movement\n player.idle_allowed = !player.moving?\n end\n # not jumping anymore\n @memory_jump = false\n end\n end\n # return data\n return [player.moving?, player.real_x, player.real_y]\n end", "def movePlayer(x, y)\n # makes sure you dont move it while the game\n # is in a pause state\n if (!paused && !resuming)\n # makes sure the player doesn't move past the game window\n # both horizontally and vertically\n x = 0 if x < 0\n x = SCREEN_W - playerWidth if x > SCREEN_W - playerWidth\n\n y = 0 if y < 0\n y = SCREEN_H - playerHeight if y > SCREEN_H - playerHeight\n\n # updates the x and y coordinates for the sprite\n @playerX = x\n @playerY = y\n # updates the player plane position in the internal game\n player.updatePlayer(playerX, playerY)\n end\n end", "def button_up(key)\n close if key == Gosu::KbEscape\n\n # reset the game\n if @state == :end && key == Gosu::MsLeft\n @board = Board.new(self, 22, @root_dir)\n @state = :game\n return\n end\n\n @player_b.ai_inc if key == Gosu::KbS\n @player_b.ai_dec if key == Gosu::KbD\n\n if @player_on_turn.class == HotseatPlayer && key == Gosu::MsLeft\n if @board.cell_clicked(mouse_x, mouse_y, @player_on_turn.sym)\n\n return if @state == :end\n\n switch_players\n\n if @player_on_turn.class == AIPlayer\n @player_on_turn.make_move(@board)\n switch_players\n end\n end\n end\n end", "def switch_player\nif @player == PIECE[:x]\n@player = PIECE[:o]\nelse\n@player = PIECE[:x]\nend\nend", "def turn\n input = current_player.move(board)\n if board.valid_move?(input)\n board.update(input, current_player)\n board.display\n else\n board.display\n turn\n end\n end", "def player_move(client, action)\n # Send the update request to all connected clients\n $clients_list.values.each do |c|\n unless c == client then\n send_player_move(c, action['x'], action['y'], action['z'])\n end\n end\n end", "def switch_player!\n return @player = 'X' unless @player == 'X'\n @player = 'O'\n end", "def move_up\n\t\tunless @y_player <= 0\n\t\t\t@y_player -= 4\n\t\tend\n\tend", "def set_player\n\n end", "def switch_player_or_play_show\n puts \"\"\n puts \"Souhaites tu intervertir \\u{1F504} la position des joueurs ? y - n\"\n gets.chomp\n end", "def update\n if @lefts .any? {|k| @window.button_down? k}\n move_left\n end\n\n if @rights.any? {|k| @window.button_down? k}\n (@window.button_down? Gosu::GpRight)\n move_right\n end\n end", "def play_turn\n move_info = FileReader.get_move(\"#{@turn}#{@player_to_move}\", @data) \n @cur_board.move_piece(move_info)\n end", "def turn\n \n choice = current_player.move(board)\n if board.valid_move?(choice)\n board.update(choice, current_player)\n else\n turn\n end\n end", "def player_push_button(event)\n if ((event.x - 180)**2 + (event.y - 810)**2).abs <= 8100\n @player_playing = 0\n elsif ((event.x - 1180)**2 + (event.y - 810)**2).abs <= 8100\n @player_playing = 1\n \n else\n @player_playing = -1\n end\n end", "def update(params)\n params[:player][:id].to_i == player1.id ? player = player1 : player = player2 # identify player\n space = params[:space]\n\n if self.game_type == 'hvh'\n self.make_human_move(player, space)\n self.switch_player(player) # sends next 'current player' to front end\n elsif self.game_type == 'hvc'\n if player == player1\n # This will be true every time except for when player2 (computer), starts the game\n self.make_human_move(player, space)\n end\n unless self.game_is_over(self.board)\n # in hvc gameplay, unless human move ends the game:\n # computer move is made every time human player makes a move\n self.make_computer_move(player2)\n self.switch_player(player2) # switch back to player 1\n end\n elsif self.game_type == 'cvc'\n self.make_computer_move(player)\n self.switch_player(player) # sends next 'current player' to front end\n end\n end", "def button_down(id)\n\t\t\n\t\t# Exit on escape\n\t\tif id == Gosu::KbEscape\n\t\t\tclose\n\t\tend\n\t\t\n\t\t# Cursor Movement\n\t\t# NSEW = 0123\n\t\tif id == Gosu::KbUp\n\t\t\[email protected](0)\n\t\tend\n\t\tif id == Gosu::KbDown\n\t\t\[email protected](1)\n\t\tend\n\t\tif id == Gosu::KbRight\n\t\t\[email protected](2)\n\t\tend\n\t\tif id == Gosu::KbLeft\n\t\t\[email protected](3)\n\t\tend\n\t\t\n\t\t# Camera Movement\n\t\t# These should probably be farther from the load/save keys heh\n\t\tif id == Gosu::KbI\n\t\t\tif @zoom\n\t\t\t\t@camera_y -= 16 * 4\n\t\t\telse\n\t\t\t\t@camera_y -= 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbK\n\t\t\tif @zoom\n\t\t\t\t@camera_y += 16 * 4\n\t\t\telse\n\t\t\t\t@camera_y += 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbJ\n\t\t\tif @zoom\n\t\t\t\t@camera_x -= 16 * 4\n\t\t\telse\n\t\t\t\t@camera_x -= 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbL\n\t\t\tif @zoom\n\t\t\t\t@camera_x += 16 * 4\n\t\t\telse\n\t\t\t\t@camera_x += 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbM # Toggle lame, janky zoom\n\t\t\t@zoom = !@zoom\n\n\t\t\t# If we're turning zoom on, set the camera so it zooms\n\t\t\t# to the area the cursor is at, if we're turning zoom off\n\t\t\t# then just reset the camera to show the full editor field.\n\t\t\tif @zoom\n\t\t\t\t@camera_x = @player.x\n\t\t\t\t@camera_y = @player.y\n\t\t\telse\n\t\t\t\t@camera_x = 0\n\t\t\t\t@camera_y = 0\n\t\t\tend\n\t\tend\n\t\t\n\t\t\n\t\t# Editor Functions\n\t\tif id == Gosu::KbQ # Scroll left through sprites\n\t\t\[email protected](1)\n\t\tend\n\t\tif id == Gosu::KbW # Scroll right through sprites\n\t\t\[email protected](2)\n\t\tend\n\t\tif id == Gosu::KbA # Place a tile as a world tile\n\t\t\[email protected](1)\n\t\tend\n\t\tif id == Gosu::KbS # Place a tile as a prop, draw above world tiles\n\t\t\[email protected](2)\n\t\tend\n\t\tif id == Gosu::KbD # Clear a tiles world/prop/collision info, setting it to nil\n\t\t\[email protected](3)\n\t\tend\n\t\tif id == Gosu::KbZ # Mark a tile for collision, only drawn in the editor\n\t\t\[email protected](4)\n\t\tend\n\t\tif id == Gosu::KbX # Turn on/off drawing of the red cross-circle that shows where colliders are\n\t\t\[email protected]_colliders?\n\t\tend\n\t\t\n\t\t# Save / Load Functions (Still Experimental, but working)\n\t\t# Make sure that the file you're trying to load was made\n\t\t# by the same version of Tyle you're using now, else oddness.\n\t\tif id == Gosu::KbO and DEBUG\n\t\t\[email protected](FILENAME)\n\t\tend\n\t\tif id == Gosu::KbP and DEBUG\n\t\t\[email protected](FILENAME)\n\t\tend\n\t\t\n\tend", "def do_move x,y\n return unless is_valid_move(x,y)\n @field[x][y].player = @player\n unless (w = check_winner).nil?\n on_game_won w.first.player, w\n end\n\n @player = @player == 1 ? 2 : 1\n if gameover?\n @player = 0\n on_gameover\n end\n end", "def move; end", "def move; end", "def playMoveNow _obj, _args\n \"_obj playMoveNow _args;\" \n end", "def increment_game\n change_turn\n @turn += 1 if @player_to_move == \"w\"\n end", "def next_player!\n end", "def turn\n choice = current_player.move(board)\n if board.valid_move?(choice)\n board.update(choice, current_player)\n end\n end", "def update\n\t\tif Gosu::button_down? Gosu::KbLeft or Gosu::button_down? Gosu::GpLeft then @player.turn_left\n\t\tend\n\t\tif Gosu::button_down? Gosu::KbRight or Gosu::button_down? Gosu::GpRight then @player.turn_right\n\t\tend\n\t\tif Gosu::button_down? Gosu::KbUp or Gosu::button_down? Gosu::GpButton0 then @player.accelerate\n\t\tend\n\t\t\n\t\[email protected]\n\t\[email protected]_stars(@stars)\n\n\t\tif rand(100) < 4 and @stars.size < 25 then\n\t\t\[email protected](Star.new(@star_anim))\n\t\tend\n\tend", "def go!\n send_position_to_engine\n move_piece(bestmove)\n end", "def player_move(player)\n if player_one == player\n player_one_move\n elsif player_two == player\n player_two_move\n else\n nil\n end\n end", "def move\n case @direction\n when \"NORTH\" then move_north\n when \"SOUTH\" then move_south\n when \"EAST\" then move_east\n when \"WEST\" then move_west\n end\n end", "def action_move_current_pokemon\n return if @party.size <= 1\n @team_buttons[@move = @index].selected = true\n @intern_mode = :move_pokemon\n @base_ui.show_win_text(text_get(23, 21))\n end", "def process_player_turn\n\t\tself.current_player = \"Computer\"\n\t\tindicate_player_turn\n\t\tplayer_good_move= self.get_good_move\n\t\tchange_state(player_symbol, player_good_move)\n\t\tplayer_good_move\n\tend", "def turn_away_from_player\n turn_away_from_character($game_player)\n end", "def switch_player()\n\t\tif $current_player == @player1\n\t\t\t$current_player = @player2\n\t\telse \n\t\t\t$current_player = @player1\n\t\tend \n\tend", "def change_player \n if @current_player == 0\n @current_player = 1\n elsif @current_player == 1\n @current_player = 0\n end\n end", "def play\n outcome = ''\n [1, 2].each {|ix| _select_players(ix)}\n c_player, o_player = _init_players\n o_player.set_other!(c_player) if o_player.is_IA_S?\n c_player.set_other!(o_player) if c_player.is_IA_S?\n #\n move_already_played = []\n #\n loop do\n STDOUT.print(\"#{@board.to_s}\\n#==> #{c_player.name}/#{c_player.type}'s TURN:\\n\")\n loop do\n m, sym = _get_move_from(c_player, move_already_played) # current player do his move\n v = @board.set_cell(m, sym.to_s)\n if m == -1 || v == sym # if sym not valid symbol, set_cell(m, sym != sym\n move_already_played << m.to_i\n break\n end\n STDERR.print \"! cell[#{m}] already set, try something else - v was: #{v.inspect} // #{v.class}\\n\"\n end\n move_already_played.sort!\n outcome = @board.game_over?\n break if outcome == :draw || outcome == :winner\n c_player, o_player = _switch_players(c_player, o_player)\n end\n _conclusion(outcome, c_player)\n end", "def play_turn\n @players.each do |p|\n dice = @dice.roll\n move_player p, dice\n @board.landed_by p\n end\n end", "def turn\n choice = current_player.move(board)\n if board.valid_move?(choice)\n board.update(choice, current_player)\n else\n turn\n end\n end", "def turn\n choice = current_player.move(board)\n if board.valid_move?(choice)\n board.update(choice, current_player)\n else\n turn\n end\n end", "def update_player\n @player.update\n update_player_actions\n end", "def switch_player\n if @current_player == @players[0]\n @current_player = @players[1]\n else\n @current_player = @players[0]\n end\n end", "def move pos\n new_board = nil\n next_player = @current_player == :x ? :o : :x\n new_board = @board.make_move @current_player, pos\n State.new new_board, next_player, @computer_player\n end", "def add_first_mate\n @player3 = Cruiser.new self, 0x990000ff\n @player3.warp_to 400, 400\n \n @controls << Controls.new(self, @player3,\n Gosu::Button::KbLeft => :left,\n Gosu::Button::KbRight => :right,\n Gosu::Button::KbUp => :full_speed_ahead,\n Gosu::Button::KbDown => :reverse,\n Gosu::Button::Kb0 => :revive\n )\n \n @players << @player3\n \n register @player3\n end", "def play\n until @board.winner?(@player_1.token) || @board.winner?(@player_2.token)\n @board.print\n self.play_turn\n p \"--------------------\"\n end\n\n self.switch_players!\n @board.print\n p @current_player.token + \" has won!\"\n end", "def play\n until @board.winner?(@player_1.token) || @board.winner?(@player_2.token)\n @board.print\n self.play_turn\n p \"--------------------\"\n end\n\n self.switch_players!\n @board.print\n p @current_player.token + \" has won!\"\n end", "def update\n\t\tif @player_moved\n\t\t\[email protected] = true\n\t\telse\n\t\t\tdrift \n\t\t\[email protected] = false\n\t\tend\n\n\t\tif !@moved_y_axis && !is_plane\n\t\t\tstabilise\n\t\t\t@has_moved = true\n\t\tend\n\n\t\tcheck_bounds\n\n\t\[email protected]\n\t\t@player_moved = @moved_y_axis = false\n\tend", "def move_away_from_player\n # Get difference in player coordinates\n sx = @x - $player.x\n sy = @y - $player.y\n # If coordinates are equal\n if sx == 0 and sy == 0\n return\n end\n # Get absolute value of difference\n abs_sx = sx.abs\n abs_sy = sy.abs\n # If horizontal and vertical distances are equal\n if abs_sx == abs_sy\n # Increase one of them randomly by 1\n rand(2) == 0 ? abs_sx += 1 : abs_sy += 1\n end\n # If horizontal distance is longer\n if abs_sx > abs_sy\n # Move away from player, prioritize left and right directions\n sx > 0 ? move_right : move_left\n if not moving? and sy != 0\n sy > 0 ? move_down : move_up\n end\n # If vertical distance is longer\n else\n # Move away from player, prioritize up and down directions\n sy > 0 ? move_down : move_up\n if not moving? and sx != 0\n sx > 0 ? move_right : move_left\n end\n end\n end", "def moves\n end", "def unit_move_tb(x,y)\n @tb_event.flash_soft_tb = false if @tb_event\n give_move_command(@tb_event)\n @tb_event.tb_unit.used_action(:move, @tb_event.tb_unit.move)\n @showing_temp_hls = false\n end", "def play\n\t\t# This will return the move that the player will take. This will come\n\t\t# from a move generator for the AI\n\t\t# The ai player will require the ai_type to be passed through\n\t\t# TODO: To be changed possibly based off of the main gameplay code. Look\n\t\t# \t\tinto the player_lobby code\n\n\t\tai_type = Settings.instance.game_mode\n\t\tif ai_type == :Connect4\n\t\t\t@ai_object = AI_Connect4.new(@game, 2, @current_chip)\n\t\telsif ai_type == :TOOT\n\t\t\t# make it that otto object\n\t\t\t@ai_object = AI_OTTO.new(@game, 1, @current_chip)\n\t\t\t@ai_object.player_goal = @goal\n\t\tend\n\n\t\t#pre\n\t\tassert game.is_a?(Game)\n\n\t\t# AI will get the next position, will be determined based on the difficulty setting\n\t\t@current_column = @ai_object.getBestScore()\n\t\tif @ai_object.is_a?(AI_OTTO)\n\t\t\t# random value\n\t\t\ttemp_num = rand(2)\n\t\t\tif temp_num == 0\n\t\t\t\tup()\n\t\t\tend\n\t\tend\n\t\tdrop()\n\t\tfinished()\n\n\t\t#post\n\t\tassert @current_column.is_a?(Numeric)\n\tend", "def moves\n\n end", "def moveToggle()\n @moveToggle_duration = @w_moveToggle.animationSpeed\n if (@w_moveToggle.x != 300 && @w_moveToggle.y != 250)\n @w_moveToggle.moveTo(300, 250)\n else\n @w_moveToggle.moveTo(350, 300)\n end\n end", "def play(move, peice = @current_player.peice)\n @board[move] = peice\n change_turns\n end", "def controller(action ,platform)\n\n case action\n when \"M\"\n move(platform)\n when \"L\"\n turn_left\n when \"R\"\n turn_right\n end\n end", "def switch_player\n @current_player = @current_player == @players.first ? @players.last : @players.first\n end", "def switch_player\n if @active_player == @player1\n @active_player = @player2\n else\n @active_player = @player1\n end\n end", "def play\r\n display_welcome_message\r\n human_choose_move\r\n computer_choose_move\r\n display_winner\r\n display_goodbye_message\r\nend", "def make_move(left,top)\n # get destination selected\n dest = get_clicked_box(left,top)\n # try to make the move on the board; @game.user_move returns false if move is not allowed\n if @game.user_move(@selected_piece, dest)\n # move the piece on the GUI boars\n move_piece(@selected_piece,dest)\n de_highlight(@selected_piece)\n deselect_piece\n # switch player turn after the move\n @game.switch_turn\n else\n # if move not allowed deselect and de highlight the piece\n de_highlight(@selected_piece)\n deselect_piece\n end\nend", "def move_for_keypress(window, pressed_buttons)\n # Generated once for each keypress\n until pressed_buttons.empty?\n button = pressed_buttons.shift\n case button\n when Gosu::KbUp then return :flip\n when Gosu::KbP then @conn.send_ping; return nil\n when Gosu::KbLeft, Gosu::KbRight # nothing\n else puts \"Ignoring key #{button}\"\n end\n end\n\n # Continuously-generated when key held down\n case\n when window.button_down?(Gosu::KbLeft) then :slide_left\n when window.button_down?(Gosu::KbRight) then :slide_right\n end\n end", "def moves\n # overridden in slideable/stepable modules\n end" ]
[ "0.7159028", "0.6981592", "0.68961", "0.6568368", "0.6521871", "0.6520447", "0.65121025", "0.6511944", "0.6480536", "0.6441577", "0.6434692", "0.6425564", "0.63888067", "0.63888067", "0.63793147", "0.63711643", "0.6351329", "0.631678", "0.6302136", "0.62883", "0.62497365", "0.62313765", "0.62216294", "0.6220489", "0.6153516", "0.61533976", "0.6153257", "0.61501163", "0.6135357", "0.61161506", "0.6111749", "0.6105633", "0.6100552", "0.6089093", "0.6086693", "0.60803705", "0.60775197", "0.6068872", "0.6056068", "0.6052906", "0.6052703", "0.6051049", "0.6046995", "0.60365087", "0.60334915", "0.6023647", "0.60187817", "0.60164064", "0.60107094", "0.6000899", "0.59990704", "0.5998845", "0.5988303", "0.59765595", "0.597285", "0.5970957", "0.5961848", "0.5960729", "0.59589255", "0.5952081", "0.5947209", "0.5947209", "0.5945732", "0.59448385", "0.5923847", "0.5919264", "0.5898813", "0.58957815", "0.5893313", "0.5892905", "0.5892284", "0.58886576", "0.5879984", "0.5875035", "0.5863172", "0.58610463", "0.5860138", "0.5850438", "0.5850438", "0.5850299", "0.58428717", "0.5839855", "0.5830225", "0.58295804", "0.58295804", "0.58289814", "0.5828787", "0.5825565", "0.5824163", "0.58204937", "0.58164823", "0.5811258", "0.58086246", "0.5791854", "0.5790723", "0.5789814", "0.578744", "0.5782776", "0.5764321", "0.5761727" ]
0.5915981
66
It works a lot like Bundler. We provide some core modules by default. This ensures at least the ability to construct a basic environment.
def github(name, version, options = nil) options ||= {} options[:repo] ||= "boxen/puppet-#{name}" mod name, version, :github_tarball => options[:repo] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_environment; end", "def setup_context\n self['console'] = Console.new\n load RUNTIME_PATH\n\n opal = self['opal']\n opal['loader'] = Loader.new opal, self\n opal['fs'] = FileSystem.new opal, self\n opal['platform']['engine'] = 'opal-gem'\n\n # eval \"opal.require('core');\", \"(opal)\"\n require_file 'core'\n end", "def bootstrap!\n reset!\n require_relative 'kernel'\n end", "def initialize_environment\n env = ws.env\n\n config = ws.config\n\n env.add_path 'PATH', File.join(ws.prefix_dir, 'gems', 'bin')\n env.add_path 'PATH', File.join(config.bundler_gem_home, 'bin')\n env.add_path 'PATH', File.join(ws.dot_autoproj_dir, 'autoproj', 'bin')\n env.set 'GEM_HOME', config.gems_gem_home\n env.set 'GEM_PATH', config.bundler_gem_home\n\n root_dir = File.join(ws.prefix_dir, 'gems')\n gemfile_path = File.join(root_dir, 'Gemfile')\n if File.file?(gemfile_path)\n env.set('BUNDLE_GEMFILE', gemfile_path)\n end\n\n if !config.private_bundler? || !config.private_autoproj? || !config.private_gems?\n env.set('GEM_PATH', *Gem.default_path)\n end\n Autobuild.programs['bundler'] = File.join(ws.dot_autoproj_dir, 'bin', 'bundler')\n\n if config.private_bundler?\n env.add_path 'GEM_PATH', config.bundler_gem_home\n end\n\n env.init_from_env 'RUBYLIB'\n env.inherit 'RUBYLIB'\n # Sanitize the rubylib we get from the environment by removing\n # anything that comes from Gem or Bundler\n original_rubylib =\n (env['RUBYLIB'] || \"\").split(File::PATH_SEPARATOR).find_all do |p|\n !p.start_with?(Bundler.rubygems.gem_dir) &&\n !Bundler.rubygems.gem_path.any? { |gem_p| p.start_with?(p) }\n end\n # And discover the system's rubylib\n if system_rubylib = discover_rubylib\n # Do not explicitely add the system rubylib to the\n # environment, the interpreter will do it for us.\n #\n # This allows to use a binstub generated for one of ruby\n # interpreter version on our workspace\n env.system_env['RUBYLIB'] = []\n env.original_env['RUBYLIB'] = (original_rubylib - system_rubylib).join(File::PATH_SEPARATOR)\n end\n\n ws.config.each_reused_autoproj_installation do |p|\n reused_w = ws.new(p)\n reused_c = reused_w.load_config\n env.add_path 'PATH', File.join(reused_w.prefix_dir, 'gems', 'bin')\n end\n\n prefix_gems = File.join(ws.prefix_dir, \"gems\")\n FileUtils.mkdir_p prefix_gems\n gemfile = File.join(prefix_gems, 'Gemfile')\n if !File.exists?(gemfile)\n File.open(gemfile, 'w') do |io|\n io.puts \"eval_gemfile \\\"#{File.join(ws.dot_autoproj_dir, 'autoproj', 'Gemfile')}\\\"\"\n end\n end\n\n if bundle_rubylib = discover_bundle_rubylib(silent_errors: true)\n update_env_rubylib(bundle_rubylib, system_rubylib)\n end\n end", "def setup_ruby_environment\n return false unless ruby?\n working_dir do\n cmd 'bundle', 'install', '--path', '.bundle', '--deployment'\n end\n end", "def bootstrap!\n reset!\n require_relative 'kernel'\n end", "def initialize_environment\n env = ws.env\n\n config = ws.config\n\n env.add_path \"PATH\", File.join(ws.prefix_dir, \"gems\", \"bin\")\n env.add_path \"PATH\", File.join(ws.dot_autoproj_dir, \"bin\")\n env.set \"GEM_HOME\", config.gems_gem_home\n env.clear \"GEM_PATH\"\n if (bundler_version = config.bundler_version)\n env.set \"BUNDLER_VERSION\", bundler_version\n else\n env.clear \"BUNDLER_VERSION\"\n end\n\n gemfile_path = File.join(ws.prefix_dir, \"gems\", \"Gemfile\")\n env.set(\"BUNDLE_GEMFILE\", gemfile_path) if File.file?(gemfile_path)\n\n if cache_dir && File.exist?(cache_dir)\n vendor_dir = File.join(File.dirname(gemfile_path), \"vendor\")\n FileUtils.mkdir_p vendor_dir\n bundler_cache_dir = File.join(vendor_dir, \"cache\")\n if File.writable?(cache_dir)\n create_cache_symlink(cache_dir, bundler_cache_dir)\n else\n Autoproj.warn \"BundlerManager: #{cache_dir} is read-only \"\\\n \"copying the cache instead of symlinking it\"\n create_cache_copy(cache_dir, bundler_cache_dir)\n end\n end\n\n Autobuild.programs[\"bundler\"] =\n Autobuild.programs[\"bundle\"] =\n File.join(ws.dot_autoproj_dir, \"bin\", \"bundle\")\n\n env.init_from_env \"RUBYLIB\"\n env.inherit \"RUBYLIB\"\n # Sanitize the rubylib we get from the environment by removing\n # anything that comes from Gem or Bundler\n original_rubylib =\n (env[\"RUBYLIB\"] || \"\").split(File::PATH_SEPARATOR).find_all do |p|\n !p.start_with?(Bundler.rubygems.gem_dir) &&\n Bundler.rubygems.gem_path\n .none? { |gem_p| p.start_with?(gem_p) }\n end\n\n # And discover the system's rubylib\n if (system_rubylib = discover_rubylib)\n # Do not explicitely add the system rubylib to the\n # environment, the interpreter will do it for us.\n #\n # This allows to use a binstub generated for one of ruby\n # interpreter version on our workspace\n env.system_env[\"RUBYLIB\"] = []\n env.original_env[\"RUBYLIB\"] = (original_rubylib - system_rubylib)\n .join(File::PATH_SEPARATOR)\n end\n\n ws.config.each_reused_autoproj_installation do |p|\n reused_w = ws.new(p)\n env.add_path \"PATH\", File.join(reused_w.prefix_dir, \"gems\", \"bin\")\n end\n\n prefix_gems = File.join(ws.prefix_dir, \"gems\")\n FileUtils.mkdir_p prefix_gems\n gemfile = File.join(prefix_gems, \"Gemfile\")\n unless File.exist?(gemfile)\n Ops.atomic_write(gemfile) do |io|\n dot_autoproj_gemfile = File.join(ws.dot_autoproj_dir, \"Gemfile\")\n io.puts \"eval_gemfile \\\"#{dot_autoproj_gemfile}\\\"\"\n end\n end\n\n if (bundle_rubylib = discover_bundle_rubylib(silent_errors: true))\n update_env_rubylib(bundle_rubylib, system_rubylib)\n end\n end", "def environment_for(bundle_name=nil)\n\n # If no bundle name is provided, then just return the base environment.\n return base_environment if bundle_name.nil?\n \n # Get the bundle location info. This will return nil if the bundle\n # is not found anywhere. In that case, return nil to indicate bundle\n # does not exist.\n bundle_location = bundle_location_for(bundle_name)\n return nil if bundle_location.nil?\n\n # A bundle was found, so collect the base environment and any bundle-\n # specific configs provided by the developer.\n base_env = base_environment\n config_env = bundle_environment_for(bundle_name)\n\n # Now we have the relevant pieces. Join them together. Start with the\n # base environment and fill in some useful defaults...\n ret = base_env.dup.merge(config_env).merge(bundle_location)\n ret[:required] = [:sproutcore] if ret[:required].nil?\n\n # Add local library so we get proper deployment paths, etc.\n ret[:library] = self\n\n # Done! return...\n return ret\n end", "def default_environment; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def load_environment!\n raise NotImplementedError\n end", "def env\n %w[INSTALLATION=1] + extra_env\n end", "def base_environment\n environment[:all] || (next_library.nil? ? {} : next_library.base_environment)\n end", "def environment; end", "def with_environment(env); end", "def environment\n Mash.new.tap do |environment|\n environment.update(new_resource.parent_ruby.ruby_environment) if new_resource.parent_ruby\n environment['BUNDLE_GEMFILE'] = new_resource.parent_bundle.gemfile_path if new_resource.parent_bundle\n environment.update(new_resource.environment) if new_resource.environment\n end\n end", "def setup_python_environment\n return false unless python?\n working_dir do\n cmd 'virtualenv', '.virtualenv'\n cmd './.virtualenv/bin/pip', '-r', 'requirements.txt'\n end\n end", "def setup_env\n # use the correct ruby bin\n path = ENV[\"PATH\"].dup\n ruby_dir = RbConfig::CONFIG['bindir']\n if !path.include? ruby_dir then\n ENV[\"PATH\"] = \"#{ruby_dir}:#{path}\"\n end\n\n # stick ourselves in RUBYLIB to speedup exec time\n ENV[\"RUBYLIB\"] = File.expand_path(\"../../../..\", __FILE__)\n\n # load helper script\n ENV[\"RUBYOPT\"] = '-rbixby-client/script'\n end", "def setup\n install_latest_ruby\n\n install_global_gems\n end", "def install(env); end", "def initialize(path = '.', env: {}, logger: nil)\n # save the working directory\n self.working_dir = File.expand_path(path.to_s)\n # Load whitelisted environment variables\n self.env = ENV.select { |k, _| ALLOWED_ENV.include? k }\n # Set some defaults\n self.env['SHELL'] = '/bin/bash'\n # Since this is likely to be running within a `bundle exec` context, we\n # expect any original GEM_PATH has been unset, and the ENV is configured\n # such that we only use what is within this bundle, which probably\n # doesn't include bundler itself, although we'll actually need to\n # 'bundle install' in working directories. To keep things sane, just\n # carry over the _ORIGINAL_GEM_PATH so that bundler is available\n if !ENV['_ORIGINAL_GEM_PATH'].nil? &&\n ENV['_ORIGINAL_GEM_PATH'].strip.length > 0 &&\n (env['GEM_PATH'].nil? || env['GEM_PATH'].strip.length == 0)\n self.env['GEM_PATH'] = ENV['_ORIGINAL_GEM_PATH']\n end\n # Update environment variables from option\n self.env.update env\n # did we get a logger to use?\n self.logger = logger if logger\n end", "def require_unit_environment\n require \"active_support\"\n require \"active_support/dependencies\"\n %w{ extensions helpers mailers models presenters }.each do |dir|\n ActiveSupport::Dependencies.autoload_paths <<\n File.expand_path(\"app/#{dir}\", app_path)\n end\n end", "def start\n require 'irbtools'\n end", "def init\n require File.expand_path( '../irbtools.rb', File.dirname(__FILE__) )\n end", "def require_env\n ENV['RACK_ENV'] = ENV['RAILS_ENV'] = Hadooken.configuration.environment.to_s\n\n # Which means we want to require an environment\n # other than rails.\n if Hadooken.configuration.require_env\n require File.expand_path(Hadooken.configuration.require_env)\n else\n require \"rails\"\n\n if ::Rails::VERSION::MAJOR == 4\n require File.expand_path(\"config/application.rb\")\n ::Rails::Application.initializer \"hadooken.eager_load\" do\n ::Rails.application.config.eager_load = true\n end\n require File.expand_path(\"config/environment.rb\")\n else\n require File.expand_path(\"config/environment.rb\")\n end\n end\n end", "def initialize(environment_name = \"default\", options = {})\n merge_config! options\n @environment_name = environment_name\n @shell_wrapper = Shell.default_wrapper.new\n @shell_wrapper.setup do |s|\n source_rvm_environment\n use_rvm_environment\n end\n end", "def call\n $LOAD_PATH.prepend(bundler_lib_path.to_s)\n\n require 'bundler'\n self\n end", "def initialize(*args, &block)\n @id = self.class.get_id\n if args.first.is_a?(String)\n base_name = args.slice!(0)\n else\n base_name = \"e.#{@id}\"\n end\n variant_keys = (Rscons.application.active_variants || []).map do |variant|\n variant[:key]\n end.compact\n @name = [base_name, *variant_keys].join(\"-\")\n options = args.first || {}\n unless Cache.instance[\"configuration_data\"][\"configured\"]\n raise \"Project must be configured before creating an Environment\"\n end\n super(options)\n # Hash of Thread object => {Command} or {Builder}.\n @threads = {}\n @registered_build_dependencies = {}\n # Set of side-effect files that have not yet been built.\n @side_effects = Set.new\n @builder_sets = []\n @build_targets = {}\n @user_deps = {}\n # Hash of builder name (String) => builder class (Class).\n @builders = {}\n @build_hooks = {pre: [], post: []}\n unless options[:exclude_builders]\n DEFAULT_BUILDERS.each do |builder_class_name|\n builder_class = Builders.const_get(builder_class_name)\n builder_class or raise \"Could not find builder class #{builder_class_name}\"\n add_builder(builder_class)\n end\n end\n @echo =\n if options[:echo]\n options[:echo]\n elsif Rscons.application.verbose\n :command\n else\n :short\n end\n @build_root = \"#{Rscons.application.build_dir}/#{@name}\"\n @n_threads = Rscons.application.n_threads\n @build_steps = 0\n self.class.register(self)\n if block\n Environment.running_environment = self\n block[self]\n Environment.running_environment = nil\n end\n end", "def bundle\n return unless File.exist?(\"Gemfile\")\n\n # Only need bundler/setup to get our paths right--we don't need to\n # actually require the gems, since we find the generate-backend.rb's\n # and just require them directly.\n require 'bundler/setup'\n end", "def with_clean_env(&block)\n if defined?(Bundler)\n Bundler.with_clean_env(&block)\n else\n yield\n end\nend", "def with_clean_env(&block)\n if defined?(Bundler)\n Bundler.with_clean_env(&block)\n else\n yield\n end\nend", "def bundle\n return unless File.exists?(\"Gemfile\")\n\n # Only need bundler/setup to get our paths right--we don't need to\n # actually require the gems, since we find the generate-backend.rb's\n # and just require them directly.\n require 'bundler/setup'\n end", "def initialize_environment\n end", "def initialize_environment\n end", "def bundle\n return unless File.exist?(\"Gemfile\")\n\n # Only need bundler/setup to get our paths right--we don't need to\n # actually require the gems, since we find the generate_backend.rb's\n # and just require them directly.\n require 'bundler/setup'\n end", "def with_clean_env &block\n if defined? Bundler\n # copy the Bundler env vars into a hash\n dev_env = ENV.select {|k, v|\n k.start_with?(\"BUNDLE_\") ||\n [\n 'GEM_HOME',\n 'GEM_PATH',\n 'MANPATH',\n 'RUBYOPT',\n 'RUBYLIB',\n ].include?(k)\n }\n \n qb_env = ENV.select {|k, v| k.start_with? 'QB_'}\n \n Bundler.with_clean_env do\n # now that we're in a clean env, copy the Bundler env vars into \n # 'QB_DEV_ENV_<NAME>' vars.\n dev_env.each {|k, v| ENV[\"QB_DEV_ENV_#{ k }\"] = v}\n \n # set the flag that will be used by modules to know to restore the \n # variables\n ENV['QB_DEV_ENV'] = 'true'\n \n qb_env.each {|k, v| ENV[k] = v}\n \n # invoke the block\n block.call\n end\n else\n # bundler isn't loaded, so no env var silliness to deal with \n block.call\n end\nend", "def env(arguments, options)\n puts \"Versions:\",\n \"* executable: #{Version}\",\n \"* library: #{BareTest::VERSION}\",\n \"* ruby #{RUBY_VERSION}\",\n \"\"\n end", "def extended_modules; end", "def generate_environment(options)\n modulepath = options[:modulepath]\n manifestpath = options[:manifestpath]\n env_name = options[:env_name]\n\n environment = <<-MANIFEST_SNIPPET\n file {\n ###################################################\n # #{env_name}\n #{generate_module(\"testing_mod\", env_name, modulepath)}\n\n \"#{manifestpath}\":;\n \"#{manifestpath}/site.pp\":\n ensure => file,\n content => '\n notify { \"in #{env_name} site.pp\": }\n include testing_mod\n '\n ;\n }\n MANIFEST_SNIPPET\n end", "def load_enviroment\n file = ResqueMaster.config['environment'] || '.'\n\n if File.directory?(file) && File.exist?(File.expand_path(\"#{file}/config/environment.rb\"))\n require 'rails'\n require File.expand_path(\"#{file}/config/environment.rb\")\n\n if defined?(::Rails) && ::Rails.respond_to?(:application)\n # Rails 3\n ::Rails.application.eager_load!\n end\n elsif File.file?(file)\n require File.expand_path(file)\n end\n end", "def env\n @_env ||= ActiveSupport::EnvironmentInquirer.new(ENV[\"RAILS_ENV\"].presence || ENV[\"RACK_ENV\"].presence || \"development\")\n end", "def environment?\n dir?('.bundle') || dir?('.virtualenv') || dir?('node_modules')\n end", "def require_project_environment\n require project_config.to_s\n end", "def standard_dependencies\n gem 'yard'\n gem 'ffi'\n\n group :development, :testing do\n gem 'jruby-openssl', platforms: :jruby\n gem 'json', platforms: :jruby\n gem 'rspec', '~> 3.12'\n gem 'activesupport', '<7.1'\n gem 'rake'\n gem 'webrick'\n\n gem 'byebug', platforms: :mri\n gem 'ruby-debug', platforms: :jruby\n\n gem 'aws-sdk-core', '~> 3'\n gem 'aws-sdk-cloudwatchlogs'\n gem 'aws-sdk-ec2'\n gem 'aws-sdk-ecs'\n gem 'aws-sdk-iam'\n gem 'aws-sdk-sts'\n gem 'paint'\n\n # for benchmark tests\n gem 'yajl-ruby', platforms: :mri, require: false\n gem 'celluloid', platforms: :mri, require: false\n\n # for static analysis -- ignore ruby < 2.6 because of rubocop\n # version incompatibilities\n if RUBY_VERSION > '2.5.99'\n gem 'rubocop', '~> 1.45.1'\n gem 'rubocop-performance', '~> 1.16.0'\n gem 'rubocop-rake', '~> 0.6.0'\n gem 'rubocop-rspec', '~> 2.18.1'\n end\n\n platform :mri do\n # Debugger for VSCode.\n if !ENV['CI'] && !ENV['DOCKER'] && RUBY_VERSION < '3.0'\n gem 'debase'\n gem 'ruby-debug-ide'\n end\n end\n end\n\n group :testing do\n gem 'timecop'\n gem 'ice_nine'\n gem 'rubydns', platforms: :mri\n gem 'rspec-retry'\n gem 'rfc', '~> 0.2.0'\n gem 'fuubar'\n gem 'timeout-interrupt', platforms: :mri\n gem 'concurrent-ruby', platforms: :jruby\n gem 'dotenv'\n gem 'childprocess'\n end\n\n group :development do\n gem 'ruby-prof', platforms: :mri\n gem 'erubi'\n gem 'tilt'\n # solargraph depends on rbs, which won't build on jruby for some reason\n gem 'solargraph', platforms: :mri\n end\n\n gem 'libmongocrypt-helper', '~> 1.8.0' if ENV['FLE'] == 'helper'\nend", "def setup\n # NOTE: We do not yet assume any contents of the depot. When we do,\n # I have some code for populating test fixtures, although it leans a bit\n # toward Rails' conventions. We can probably 'derail' it. :)\n\n # Specify the environment, e.g. development vs. test, etc. It is assumed to be\n # test. This is done mainly so that the right configuration is used for connecting to\n # Perforce. This should probably be moved to a generic 'test_helper' which is\n # included in all tests.\n ENV['APP_ENV'] ||= 'test'\n end", "def environment(environment); end", "def env_config; end", "def env_config; end", "def env_config; end", "def env_config; end", "def dev_gems\n\n # Dev mode has to explicitly include every needed gem dependency in the project in order to\n # be properly (i.e. recursively) loaded from source by Bundler\n gem 'task_runner', :path => 'gems/task_runner'\n gem 'tef-worker', :path => 'gems/tef-worker'\n gem 'tef-core', :path => 'gems/tef-core'\n gem 'res_man', git: 'https://github.com/grange-insurance/res_man.git', branch: 'master'\n gem 'tef-manager', :path => 'gems/tef-manager'\n gem 'tef-keeper', :path => 'gems/tef-keeper'\n gem 'tef', :path => '.'\n gem 'tef-development', :path => 'gems/tef-development'\nend", "def environment\n @environment ||= ActiveSupport::StringInquirer.new(app.environment.to_s)\n end", "def integration_env\n {\n \"PATH\" => [bin_dir.to_s, ENV[\"PATH\"]].compact.join(':'),\n \"RUBYLIB\" => [lib_dir.to_s, ENV[\"RUBYLIB\"]].compact.join(':')\n }\n end", "def initialize\n # Load configuration file\n require 'yaml'\n @env = HashWithIndifferentAccess.new(YAML.load_file(File.join(File.dirname(__FILE__), '..', 'config', 'environments', \"#{ENV['RACK_ENV']}.yml\")))\n end", "def initialize(env)\n @home = env[\"GEM_HOME\"] || Gem.default_dir\n\n if File::ALT_SEPARATOR\n @home = @home.gsub(File::ALT_SEPARATOR, File::SEPARATOR)\n end\n\n @home = expand(@home)\n\n @path = split_gem_path env[\"GEM_PATH\"], @home\n\n @spec_cache_dir = env[\"GEM_SPEC_CACHE\"] || Gem.default_spec_cache_dir\n\n @spec_cache_dir = @spec_cache_dir.dup.tap(&Gem::UNTAINT)\n end", "def setup_test_app\n gemfile_path = if CORE_GEMS.include?(self.name)\n ROOT_GEMFILE\n else\n './Gemfile'\n end\n\n system(\"bundle exec --gemfile=#{gemfile_path} rake test_app \") || raise('Failed to setup the test app')\n end", "def exec_bundle\n ENV_EXPORTERS.each do |exporter|\n ENV[\"VER_#{exporter.upcase}\"] = ENV[\"TM_#{exporter.upcase}\"] =\n send(\"exec_env_#{exporter}\").to_s\n end\n\n yield if block_given?\n end", "def initialize modname, lang\n require 'rubygems'\n require 'platform'\n\n @cpu = Platform::ARCH\n @os = Platform::OS\n\n if @os == :unix then # we need to be more specific\n @os = Platform::IMPL\n end\n\n @vars = Hash.new\n setup_toolset\n setup_paths modname\n setup_conf lang, modname\n end", "def initialize!\n load_passenger\n initialize_ush_api\n initialize_debugging\n undo_bundler\n end", "def setup_clean_env\n # user may be running gem binary directly without bundler.\n if defined?(::Bundler)\n # a little revisionist history music...\n ::ENV.each do |key, value|\n if key.start_with?('GEM_') || key.start_with?('BUNDLER_')\n ::Bundler::ORIGINAL_ENV[key] = nil\n elsif Bundler::ORIGINAL_ENV[key].nil?\n ::Bundler::ORIGINAL_ENV[key] = value\n end\n end\n ::Bundler.with_clean_env do\n # now the ENV is clean and not missing any right-hand args so replace\n # the ORIGINAL_ENV.\n ::Bundler::ORIGINAL_ENV.replace(ENV)\n end\n end\n true\n end", "def bundler_with_clean_env(&block)\n if defined?(Bundler)\n begin\n orig_env = ENV.to_hash\n ENV.delete_if { |k,_| k[0,7] == 'BUNDLE_' }\n if ENV.has_key? 'RUBYOPT'\n ENV['RUBYOPT'] = ENV['RUBYOPT'].sub '-rbundler/setup', ''\n end\n %w[RUBYLIB GEM_HOME].each {|key| ENV.delete(key) }\n yield\n ensure\n ENV.replace(orig_env)\n end\n else\n yield\n end\n end", "def execute(*args)\n if Puppet.features.bundled_environment?\n Bundler.with_clean_env do\n super\n end\n else\n super\n end\n end", "def execute(*args)\n if Puppet.features.bundled_environment?\n Bundler.with_clean_env do\n super\n end\n else\n super\n end\n end", "def execute(*args)\n if Puppet.features.bundled_environment?\n Bundler.with_clean_env do\n super\n end\n else\n super\n end\n end", "def environment\n env = DbAgile::Environment.new \n env.repository_path = repository_path(:basics)\n env.output_buffer = StringIO.new\n env.message_buffer = StringIO.new\n env.interactive = true\n env.console_width = 10\n env\n end", "def build_environment\n env = MiniCamel::Environment.new\n env.register_route_builder(HelloWorldRoutes.new)\n env.finalize\n end", "def initialize(name, run_context = nil)\n super\n @provider = Chef::Provider::Package::Rubygems\n end", "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/puppet/modules/#{name}\"\nend", "def bundle args = []\n\t\t\tputs \"Starting to bunlde gemfile for modules ...\"\n\t\t\targs = Smods.keys if args.empty?\n\n\t\t\targs.each do | module_name |\n\t\t\t\tpath = \"#{Smods[module_name]}#{Spath[:gemfile]}\"\n\t\t\t\tif File.exist? path\n\t\t\t\t\t`bundle install --gemfile=#{path}`\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"Successfully implemented\"\n\t\tend", "def prerequisites\n\tKitchenplan::Application.fatal! \"Don't run this as root!\" if running_as_superuser?\n\tKitchenplan::Log.warn \"Platform version too low. Your version: #{self.version}\" unless version_supported?\n\tinstall_bundler\n\t# needed for proper librarian usage\n\tinstall_git\n\tkitchenplan_bundle_install\n end", "def initialize(context)\n @logger = LibertyBuildpack::Diagnostics::LoggerFactory.get_logger\n @app_dir = context[:app_dir]\n @java_home = context[:java_home]\n @java_opts = context[:java_opts]\n @lib_directory = context[:lib_directory]\n @common_paths = context[:common_paths] || CommonPaths.new\n @configuration = context[:configuration]\n @vcap_services = Heroku.heroku? ? Heroku.new.generate_vcap_services(ENV) : context[:vcap_services]\n @vcap_application = context[:vcap_application]\n @license_id = context[:license_ids]['IBM_LIBERTY_LICENSE']\n @environment = context[:environment]\n unpack_apps\n end", "def do_bundler_extending\n vputs \"[**:#{@name}] #do_bundler_extending: #{@libraries}\"\n\n if defined?(::Bundler)\n vputs \"[**:#{@name}] #do_bundler_extending: Libraries: #{@libraries}\"\n\n all_global_gem_paths = Dir.glob(\"#{Gem.dir}/gems/*\")\n\n all_global_gem_paths.each do |p|\n next unless @libraries.any? { |l| p.include?(l) }\n gem_path = \"#{p}/lib\"\n # rubocop:disable Metrics/LineLength\n vputs \"[**:#{@name}] #do_bundler_extending: Adding to $LOAD_PATH: #{gem_path}\"\n # rubocop:enable\n $LOAD_PATH.unshift(gem_path)\n end\n else\n vputs %([**:#{@name}] #do_bundler_extending: Bundler not defined. Skipping.)\n end\n end", "def initialize_environment(args, options, config)\n raise Errors::CLIMissingEnvironment.new if !config[:env]\n @env = config[:env]\n @env.ui = UI::Shell.new(@env, shell) if [email protected]_a?(UI::Shell)\n end", "def initialize\n super\n \n run_hook :before_configuration\n \n # Search the root of the project for required files\n $LOAD_PATH.unshift(root)\n \n # Check for and evaluate local configuration\n local_config = File.join(root, \"config.rb\")\n if File.exists? local_config\n puts \"== Reading: Local config\" if logging?\n instance_eval File.read(local_config)\n end\n \n run_hook :build_config if build?\n run_hook :development_config if development?\n \n run_hook :after_configuration\n \n # Add in defaults\n default_extensions.each do |ext|\n activate ext\n end\n \n if logging?\n self.class.extensions.each do |ext|\n puts \"== Extension: #{ext}\"\n end\n end\n end", "def env=(environment); end", "def env=(environment); end", "def load_enviroment(file = nil)\n file ||= \".\"\n\n if File.directory?(file) && File.exists?(File.expand_path(\"#{file}/config/environment.rb\"))\n require 'rails'\n require File.expand_path(\"#{file}/config/environment.rb\")\n if defined?(::Rails) && ::Rails.respond_to?(:application)\n # Rails 3\n ::Rails.application.eager_load!\n elsif defined?(::Rails::Initializer)\n # Rails 2.3\n $rails_rake_task = false\n ::Rails::Initializer.run :load_application_classes\n end\n elsif File.file?(file)\n require File.expand_path(file)\n end\n end", "def initialize(environment)\n @environment = environment\n @found = false\n @force_parse = false\n\n @additional_modules = []\n end", "def setup_project_python_environment\n if not has_valid_virtualenv?\n return false\n end\n if should_do_requirements_install\n action \"Installing user defined python dependencies\" do\n unless install_user_python_dependencies()\n return false\n end\n note_install(\"pythonenv\")\n end\n end\n if should_install_python_dependencies?\n unless install_python_dependencies()\n return false\n end\n end\n return true\n end", "def with_environment\n old_gem_home = ENV[\"GEM_HOME\"]\n old_gem_path = ENV[\"GEM_PATH\"]\n ENV[\"GEM_HOME\"] = @gem_home\n ENV[\"GEM_PATH\"] = @gem_home\n @logger.debug(\"Set GEM_* to: #{ENV[\"GEM_HOME\"]}\")\n\n # Clear paths so that it reads the new GEM_HOME setting\n Gem.paths = ENV\n\n # Clear the sources so that installation uses custom sources\n old_sources = Gem.sources\n Gem.sources = Gem.default_sources\n Gem.sources << \"http://gems.hashicorp.com\"\n\n # Use a silent UI so that we have no output\n Gem::DefaultUserInteraction.use_ui(Gem::SilentUI.new) do\n return yield\n end\n ensure\n # Restore the old GEM_* settings\n ENV[\"GEM_HOME\"] = old_gem_home\n ENV[\"GEM_PATH\"] = old_gem_path\n\n # Reset everything\n Gem.paths = ENV\n Gem.sources = old_sources.to_a\n end" ]
[ "0.6607848", "0.62972605", "0.6268261", "0.6249248", "0.618101", "0.60742056", "0.6032821", "0.60235703", "0.6010405", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.5958946", "0.59339535", "0.59068674", "0.58860826", "0.5865051", "0.5836118", "0.58307105", "0.5796515", "0.57917356", "0.5784237", "0.57829213", "0.57627547", "0.5701407", "0.56867427", "0.56560045", "0.5621986", "0.56091386", "0.55946106", "0.5589751", "0.55772144", "0.55772144", "0.5572683", "0.5570161", "0.5570161", "0.55542195", "0.5537313", "0.5534476", "0.55241805", "0.5517362", "0.5510599", "0.5495931", "0.54896224", "0.5469589", "0.5463223", "0.5452756", "0.5445886", "0.54230815", "0.54230815", "0.54230815", "0.54230815", "0.542261", "0.539845", "0.53921336", "0.53756315", "0.5370037", "0.53660446", "0.53531367", "0.5342232", "0.5324023", "0.5314692", "0.53125256", "0.530958", "0.530958", "0.530958", "0.5307049", "0.5296877", "0.5289316", "0.52825344", "0.5275709", "0.5269987", "0.52645296", "0.5261862", "0.5257015", "0.5248396", "0.5242121", "0.5242121", "0.5237114", "0.522611", "0.52249366", "0.52228713" ]
0.0
-1
Build a service from a service description. The service description can either be a string giving the project name, or it can be a record describing the service. If it's a simple string, it will be interpreted as though it were a record containing only the project name. The project record has these fields: NAME DESCRIPTION service project name for a service (either this or library are required) library project name for a library (either this or service are required) downstream OPTIONAL list of projects that directly depend on this one archive OPTIONAL name of the generated WAR file (default = $project.war) wlp OPTIONAL name of the WLP instance to deploy to (default = $normalized_project.war) The 'normalized project' is the project name with any recognized suffix removed. The only recognized suffix is 'service' (e.g. project 'ariservice' has a default service name of 'ari').
def initialize_project(project_desc) project_name = extract_project(project_desc) repo_name = extract_repository(project_desc) repo_path = File.expand_path(repo_name, $project_dir) repo = initialize_repo(project_desc, repo_path) if project_desc[:library] Project::Library.new( repository: repo, sub_project: (project_name == repo_name) ? nil : project_name, auto_reset: $options[:auto_reset], mvn_flags: project_desc[:mvn_flags], pull_branches: $pull_branches, rebase_branches: $rebase_branches, local_branches: $local_branches, basis_branch: project_desc[:basis_branch] || $global_basis_branch, always_build: project_desc[:always_build] ) else Project::Service.new( repository: repo, sub_project: (project_name == repo_name) ? nil : project_name, archive: project_desc[:archive], service: project_desc[:wlp], restart: project_desc[:restart], auto_reset: $options[:auto_reset], mvn_flags: project_desc[:mvn_flags], pull_branches: $pull_branches, rebase_branches: $rebase_branches, local_branches: $local_branches, basis_branch: project_desc[:basis_branch] || $global_basis_branch ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_service(name, description)\n response = @client.post(\"/api/v1/services\", { \"name\" => name, \"description\" => description })\n return JSON.parse(response.body)\n end", "def parse_service_yaml service_yaml_text\n return nil unless service_yaml_text && !service_yaml_text.empty?\n service_yaml = YAML.safe_load service_yaml_text\n service = Google::Api::Service.new\n\n if service_yaml.key? CONFIG_VERSION_KEY\n config_ver = Google::Protobuf::UInt32Value.new\n config_ver.value = service_yaml[CONFIG_VERSION_KEY]\n service.config_version = config_ver\n end\n\n service.name = service_yaml[NAME_KEY] if service_yaml.key? NAME_KEY\n service.id = service_yaml[ID_KEY] if service_yaml.key? ID_KEY\n service.title = service_yaml[TITLE_KEY] if service_yaml.key? TITLE_KEY\n\n service.apis = parse_apis service_yaml[APIS_KEY] if service_yaml.key? APIS_KEY\n service.http = parse_http service_yaml[HTTP_KEY] if service_yaml.key? HTTP_KEY\n service\n end", "def build(configurator:, name:, service: nil, **service_config) # :nodoc:\n new(**service_config).tap do |service_instance|\n service_instance.name = name\n end\n end", "def build_service\n {'Code' => SERVICE_TYPES[@opts[:service_type]]}\n end", "def service_naming(service, new_service_name=nil, new_service_description)\n log(:info, \"Processing service_naming...\", true)\n unless new_service_name.blank?\n log(:info, \"Changing Service name: #{service.name} to #{new_service_name}\")\n else\n new_service_name = \"#{service.name}-#{Time.now.strftime('%Y%m%d-%H%M%S')}\"\n log(:info, \"Changing Service name: #{service.name} to #{new_service_name}\")\n end\n service.name = new_service_name\n unless new_service_description.blank?\n log(:info, \"Changing Service description from #{service.description} to #{new_service_description}\")\n service.description = new_service_description\n end\n log(:info, \"Processing service_naming...Complete\", true)\n end", "def service_named(service_name, service_options = {})\n raise ArgumentError,\"Please provide a service name\" if service_name.nil? || service_name.empty?\n\n # Strip whitespace from service_name and ensure that it starts with \"SoftLayer_\".\n # If it does not, then add the prefix.\n full_name = service_name.to_s.strip\n if not full_name =~ /\\ASoftLayer_/\n full_name = \"SoftLayer_#{service_name}\"\n end\n\n # if we've already created this service, just return it\n # otherwise create a new service\n service_key = full_name.to_sym\n if [email protected]_key?(service_key)\n @services[service_key] = SoftLayer::Service.new(full_name, {:client => self}.merge(service_options))\n end\n\n @services[service_key]\n end", "def changeservicedescription(svc_handle, service_description)\n svc_status = nil\n stubdata =\n svc_handle +\n NDR.long(SERVICE_CONFIG_DESCRIPTION) +\n NDR.long(1) + # lpInfo -> *SERVICE_DESCRIPTION\n NDR.long(0x0200) + # SERVICE_DESCRIPTION struct\n NDR.long(0x04000200) +\n NDR.wstring(service_description)\n begin\n response = dcerpc_client.call(CHANGE_SERVICE_CONFIG2_W, stubdata) # ChangeServiceConfig2\n svc_status = error_code(response)\n rescue Rex::Proto::DCERPC::Exceptions::Fault => e\n elog('Error changing service description', error: e)\n end\n\n svc_status\n end", "def build(document)\n services.each do |service|\n service.build(document)\n end\n end", "def service_named(service_name, service_options = {})\n raise ArgumentError,\"Please provide a service name\" if service_name.nil? || service_name.empty?\n\n # strip whitespace from service_name and\n # ensure that it start with \"SoftLayer_\".\n #\n # if it does not, then add it\n service_name.strip!\n if not service_name =~ /\\ASoftLayer_/\n service_name = \"SoftLayer_#{service_name}\"\n end\n\n # if we've already created this service, just return it\n # otherwise create a new service\n service_key = service_name.to_sym\n if [email protected]_key?(service_key)\n @services[service_key] = SoftLayer::Service.new(service_name, {:client => self}.merge(service_options))\n end\n\n @services[service_key]\n end", "def create_service(data=nil)\n if (!data.blank? && data.is_a?(Hash))\n @service = Service.create(data)\n else\n @service = Service.create(:name => \"Test Service #{rand(1..1000)}\", :description => \"Test service description.\", :active => true, :probe => \"dummy\", :probe_config => {:value => 1}, :interval => 60, :clean_interval => 86400, :priority => Service::PRIORITY_NORMAL, :resume => :mean_value)\n end\n end", "def dot_service( shortname )\n shortname + \".service\"\n end", "def service(name)\n \"#{SERVICE_NAME} #{name}\"\n end", "def service_description\n Umakadata::Measurement.new(name: MEASUREMENT_NAMES[__method__]).safe do |m|\n activity = endpoint.service_description\n\n m.value = (r = activity.result).is_a?(::RDF::Enumerable) &&\n r.any? { |stmt| stmt.predicate.to_s.start_with?('http://www.w3.org/ns/sparql-service-description#') } ?\n activity.response.body : nil\n m.comment = if (200..299).include?(activity.response&.status) && m.value.present?\n 'The endpoint provides Service Description.'\n else\n 'The endpoint does not provide Service Description.'\n end\n m.activities << activity\n end\n end", "def create\n @project = Project.new(params[:project])\n @project.rating=0\n Service.all.each do |service|\n if defined? params[:services][service.id]\n @Project.services << service\n end\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to administration_project_path(@project), notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_service(service)\n \tOrder.new(\n \t\torderNumber: 37592,\n \t\tservice: service,\n\t\t\torderType: \"установка розетки\",\n\t\t\tnameOrFIO: \"Нибелунг Зигфрид Беовульфыч\",\n\t\t\tstreet: \"бул. Амурский\",\n\t\t\thouse: 10,\n\t\t\tresponsiblePerson: \"Витя Кабан\",\n\t\t\tpersonType: \"Физ лицо\",\n\t\t\tformingDate: \"2013-11-13\")\n end", "def service(name)\n name = name.to_sym\n\n service_info = SERVICES[name]\n if service_info.nil?\n raise ArgumentError, sprintf('No service found with name %s', name)\n end\n\n require_path = sprintf(SERVICE_PATH, @path_version,\n service_info.first)\n require require_path\n\n class_path = sprintf(SERVICE_CLASS_PATH, @version, service_info.last)\n return class_for_path(class_path)\n end", "def service(service_name, api_client)\n klazz = service_class(service_name)\n\n # raise an error unless the class inherits from Service\n unless klazz < Core::ServiceLayer::Service\n raise ServiceParentError,\n \"service #{klazz.name} is not a subclass of \\\n Core::ServiceLayer::Service\"\n end\n\n # create an instance of the service class\n klazz.try(:new, api_client)\n end", "def service(uri, &block)\n service = ServiceBuilder.new(context())\n service.uri = uri\n __builders.push(service)\n service.instance_eval(&block) if block_given?\n return service\n end", "def service_description_for_host(host)\n response = self.class.get(@base_uri + \"config/host/#{host}?format=json\",\n basic_auth: @auth, verify: false)\n raise ApiError unless response.code == 200\n host_config = JSON.parse!(response.body)\n if host_config['services'].nil?\n services = []\n else\n services = host_config['services'].map { |s| s['service_description'] }\n end\n host_config['hostgroups'].each do |hg|\n services += hostgroup_services(hg)\n end\n services.nil? ? [] : services\n end", "def create_service_by_names(name, space_guid, service_plan_name, service_type_name)\n service = @client.services.select{ |srv| srv.label == service_type_name }\n\n if service != []\n service_plan_id = @client.service_plans_by_service_guid(service.first.guid).each.find { |current_plan| current_plan.name == service_plan_name }.guid\n create_service_instance(name, space_guid, service_plan_id)\n else\n return false\n end\n end", "def parse_vcap_services(element, instance)\n properties = Utils.parse_compliant_vcap_service(element, instance)\n @service_name = properties['service_name']\n # extract the db_name, host, port, user and password from the properties. Since we are using cloud variables for substitution into server.xml,\n # this means we're actually using the keys in the props, not the values. We could use the values for direct substitution.\n conn_prefix = \"cloud.services.#{@service_name}.connection.\"\n\n # uri is the only property portable between Pivotal, BlueMix, and Heroku\n conn_uri = properties[\"#{conn_prefix}uri\"]\n if conn_uri.nil?\n raise \"Resource #{@service_name} does not contain a #{conn_prefix}uri property\"\n end\n uri = URI.parse(conn_uri)\n\n @db_name = get_cloud_property(properties, element, \"#{conn_prefix}name\", uri.path[1..-1])\n @host = get_cloud_property(properties, element, \"#{conn_prefix}host\", uri.host)\n @port = get_cloud_property(properties, element, \"#{conn_prefix}port\", uri.port)\n @user = get_cloud_property(properties, element, \"#{conn_prefix}user\", uri.user)\n @password = get_cloud_property(properties, element, \"#{conn_prefix}password\", uri.password)\n\n # ensure all the cloud properties are always set\n get_cloud_property(properties, element, \"#{conn_prefix}hostname\", uri.host)\n get_cloud_property(properties, element, \"#{conn_prefix}username\", uri.user)\n\n # default JNDI name for DB is jdbc/service_name\n @jndi_name = \"jdbc/#{@service_name}\"\n # create standard configuration ids.\n @datasource_id = \"#{@config_type}-#{@service_name}\"\n @connection_manager_id = \"#{@config_type}-#{@service_name}-conMgr\"\n @properties_id = \"#{@config_type}-#{@service_name}-props\"\n @jdbc_driver_id = \"#{@config_type}-driver\"\n @lib_id = \"#{@config_type}-library\"\n @fileset_id = \"#{@config_type}-fileset\"\n end", "def instantiate_service!(service, request)\n definition = service.kind_of?(Hash) ? service : service_definition_for(service.to_s)\n raise NoSuchService.new(\"Service '#{service}'' does not exist in umlaut-services.yml\") if definition.nil?\n className = definition[\"type\"] || definition[\"service_id\"]\n classConst = Kernel.const_get(className)\n service = classConst.new(definition)\n service.request = request\n return service\n end", "def parse_service_description\n description = Nokogiri::XML open(@scpd_url)\n\n validate_scpd description\n\n parse_actions description.at('scpd > actionList')\n\n service_state_table = description.at 'scpd > serviceStateTable'\n parse_service_state_table service_state_table\n rescue OpenURI::HTTPError\n raise Error, \"Unable to open SCPD at #{@scpd_url.inspect} from device #{@url.inspect}\"\n end", "def new\n @service = Service.new\n end", "def service_name(name)\n verify_subclass!\n key_name = name.to_sym\n raise DuplicateNameError, \"The service #{self.name} is trying to define a service_name of #{name} when it has already been defined by #{all_services[key_name].klass.name}\" if all_services.has_key?(key_name)\n\n # remove the old entry\n all_services.delete(service_description.name) if service_description.present?\n\n self.service_description ||= ServiceDescription.new\n service_description.update(key_name, self)\n\n # save off reference\n all_services[service_description.name] = service_description\n end", "def create_service_plan(opts = {})\n data, _status_code, _headers = create_service_plan_with_http_info(opts)\n data\n end", "def createProject(description) \n project = Project.new \n project.Description = description \n @Projects.push(project) \n end", "def add_to_services(name, type, description)\n data = {\n 'OS-KSADM:service' => {\n 'name' => name,\n 'type' => type,\n 'description' => description\n }\n }\n return post_request(address(\"/OS-KSADM/services\"), data, token())\n end", "def create_service_instance(name, space_guid, service_plan_id)\n service_plan_instance = CFoundry::V2::ServicePlan.new(service_plan_id, @client)\n service_instance = @client.managed_service_instance\n service_instance.name = name\n service_instance.service_plan = service_plan_instance\n service_instance.space = @client.space(space_guid)\n service_instance.create!\n service_instance\n end", "def from_s(str)\n # Get rid of whitespace\n str.strip!\n\n # Parse into lines\n lines = str.split /\\n/\n\n # Remove comments and get rid of empty lines\n lines.each do |line|\n line.lstrip!\n line.sub!(/#.*$/, '')\n line.rstrip!\n end\n lines.delete_if { |line| line.empty? }\n raise \"System definition empty\" if lines.empty?\n\n # Parse system declaration\n parse_system_decl lines\n raise \"Unexpected end of system declaration\" if lines.empty?\n\n while !lines.empty?\n # Get the next property string\n curline = lines.first\n tokens = curline.split\n property = tokens.first\n\n # Check if we're all done\n if property == '}'\n if lines.size > 1\n raise \"Unexpected tokens after final '}' in project definition\"\n end\n return\n end\n\n # Parse each property\n begin\n case property\n when 'build'\n build = Build.new\n Utils::parse_named_block(lines, build.name, build.projects)\n @builds[build.name] = build\n else\n raise \"Unknown system property\"\n end\n rescue => e\n raise \"Error parsing property '#{property}': \" + e.message\n end\n\n # Make sure we haven't reached a premature end of the definition\n raise \"Unexpected end of project declaration\" if lines.empty?\n end\n end", "def create_service_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceApi.create_service ...'\n end\n # unbox the parameters from the hash\n allowable_values = [\"vcl\", \"wasm\"]\n if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['customer_id'] = opts[:'customer_id'] if !opts[:'customer_id'].nil?\n form_params['type'] = opts[:'type'] if !opts[:'type'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ServiceResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"ServiceApi.create_service\",\n :header_params => 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: ServiceApi#create_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def service_description\n resp = http.resource(service_descriptor_href).get(:accept => 'application/vnd.absolute-performance.sysshep+json')\n JSON.parse(resp.body)\n end", "def services(building_data, uvals, rates, rate_card = nil, supplier_name = nil)\n sum_uom = 0.0\n sum_benchmark = 0.0\n\n copy_params building_data, uvals\n\n uvals.each do |v|\n # puts service.code\n # puts service.name\n # puts service.mandatory\n # puts service.mandatory?\n # puts service.work_package\n # puts service.work_package.code\n # puts service.work_package.name\n\n uom_value = v['uom_value'].to_f\n\n # occupants = occupants(v['service_code'], building_data)\n if v['service_code'] == 'G.3' || (v['service_code'] == 'G.1')\n occupants = v['uom_value'].to_i\n uom_value = building_data['gia']\n else\n occupants = 0\n end\n\n # code = v['service_code'].remove('.')\n calc_fm = FMCalculator::Calculator.new(@contract_length_years,\n v['service_code'],\n uom_value,\n occupants,\n @tupe_flag,\n @london_flag,\n @cafm_flag,\n @helpdesk_flag,\n rates,\n rate_card,\n supplier_name,\n building_data,)\n sum_uom += calc_fm.sumunitofmeasure\n sum_benchmark += calc_fm.benchmarkedcostssum if supplier_name.nil?\n end\n { sum_uom: sum_uom,\n sum_benchmark: sum_benchmark }\n rescue StandardError => e\n raise e\n ensure\n { sum_uom: sum_uom,\n sum_benchmark: sum_benchmark }\n end", "def load_service(file, source_code)\r\n begin\r\n _info(\"Loading service definitions from #{file}.\")\r\n precompiler = ServicePrecompiler.new(file, source_code)\r\n precompiler.precompile()\r\n clean_source_code = precompiler.get_modified_source_code()\r\n class_def = define_class(classname=\"#{file}ServiceBuilder\", superclazz=ServiceConfigurationBuilder)\r\n class_def.add_method_def(methodname='configure',sourcecode=clean_source_code)\r\n service_builder = class_def.compile()\r\n resolved = service_builder.build(self.context())\r\n services.push(service_builder)\r\n return resolved\r\n rescue Exception => ex\r\n _debug(ex.message, ex)\r\n end\r\n end", "def create_service(opts = {})\n data, _status_code, _headers = create_service_with_http_info(opts)\n data\n end", "def merge_services(s)\n if service = $services[s] then\n# return if @services[s]; # all ready included \n# @services[s] = service\n else\n error(\"unknown service '#{s}' referenced in host/service #{@name} \")\n return\n end\n # merge in the file items\n\n service.file.each { |name, val|\n if val.class == Regexp\n @file[name]['re'] = val\n elsif !@file[name]\n @file[name] = val\n elsif (!@file[name]['logtype'] && val['logtype']&&\n val['logtype'].name != 'default')\n @file[name]['logtype'] = val['logtype']\n elsif (@file[name]['logtype'].name == 'default' &&\n val['logtype'].name != 'default')\n @file[name]['logtype'] = val['logtype']\n end\n }\n\n service.real_time.each { |key, value|\n if @real_time[key] then\n @real_time[key] << value\n else\n @real_time[key] = MyList.new(value)\n end\n }\n service.periodic.each { |key, value|\n if @periodic[key] then\n @periodic[key] << value\n else\n @periodic[key] = MyList.new(value)\n end\n }\n # merge in default actions\n if @kind == 'host' then\n @actions.merge_actions($global.actions, $run_type)\n end\n end", "def services(format: '{{.Names}}', status: :running, **filters); end", "def service_name=(_arg0); end", "def generate_service_name\n service_module = ret_service_module\n assembly_name = request_params(:assembly_name)\n\n if version = request_params(:version)\n version = nil if BASE_VERSION_STRING.include?(version)\n else\n version = compute_latest_version(service_module)\n end\n\n assembly_template = service_module.assembly_template(assembly_name: assembly_name, version: version)\n rest_ok_response generate_new_service_name(assembly_template, service_module)\n end", "def service_given\n if (md = SERVICE_GIVEN_REGEXP.match(self.text))\n md[1]\n end\n end", "def service_naming(service, dialogs_tags_hash, dialogs_options_hash)\n log(:info, \"Processing service_naming...\", true)\n new_service_name = dialogs_options_hash[0][:dialog_service_name] rescue nil\n new_service_description = dialogs_options_hash[0][:dialog_service_description] rescue nil\n\n if new_service_name.blank?\n new_service_name = \"#{service.name}-#{Time.now.strftime('%Y%m%d-%H%M%S')}\"\n end\n log(:info, \"Service name: #{new_service_name}\")\n service.name = new_service_name\n\n unless new_service_description.blank?\n log(:info, \"Service description #{new_service_description}\")\n service.description = new_service_description\n end\n log(:info, \"Processing service_naming...Complete\", true)\nend", "def service_name\n @service_name ||= InchCI::ProjectUID.new(uid).service\n end", "def translate_service(service_id)\n if config[:translate]\n\n # Check if Service ID was already translated\n if @fastly_services[service_id]\n\n result = @fastly_services[service_id]\n\n else\n\n request = Net::HTTP::Get.new(\"/service/#{service_id}\")\n request['Content-Type'] = 'application/json'\n request = login_headers(request)\n\n response = @http.request(request)\n service_data = JSON.parse(response.body)\n\n if service_data['name']\n result = service_data['name'].tr('.\\ ', '_')\n @fastly_services['service_id'] = result\n else\n result = service_id\n end\n end\n\n if result == ''\n service_id\n else\n result\n end\n else\n service_id\n end\n end", "def create_service\n # Check signals here to be nice and abort early if possible.\n check_signals!\n # Enable automatically creates the service with Runit.\n directory \"/var/log/#{new_resource.service_name}\" do\n owner 'root'\n group 'root'\n mode '700'\n end\n end", "def initialize(name, domain)\n raise Exception.new(\"#{name} is not a valid service name\") unless valid_directory_name(name.to_s)\n \n @name = name\n @booted = false\n @domain = domain\n @full_name = \"#{domain.name}::#{@name}\"\n @path = \"#{SERVICES_PATH}/#{domain.name}/#{@name}\"\n @port_in = $port_start+=1\n @port_out = $port_start+=1\n @status = \"stopped\"\n @runtime = JJRuby.newInstance()\n \n # Create the domain directory if not present\n FileUtils.mkdir_p(@path, :mode => 0755)\n \n # And finally set the meta-data for the service\n @meta_data = ServiceMetaData.new(self)\n ContainerLogger.debug \"Service added #{domain.name}::#{name}\" \n end", "def services(building_data, uvals, rates, rate_card = nil, supplier_name = nil, results = nil, remove_cafm_help = true)\n sum_uom = 0.0\n sum_benchmark = 0.0\n\n copy_params building_data, uvals\n\n # TODO : Validation must be put in the front end to NOT allow just CAFM or HELP services otherwise an exception be ge generated below in .max\n uvals_remove_cafm_help = if remove_cafm_help == true\n uvals.reject { |x| x[:service_code] == 'M.1' || x[:service_code] == 'N.1' }\n else\n uvals\n end\n uvals_remove_cafm_help.each do |v|\n uom_value = calculate_uom_value(v)\n\n if v[:service_code] == 'G.3' || (v[:service_code] == 'G.1')\n occupants = v[:uom_value].to_i\n uom_value = (building_data[:gia] || building_data['gia']).to_f\n else\n occupants = 0\n end\n\n calc_fm = FMCalculator::Calculator.new(@contract_length_years,\n v[:service_code],\n uom_value,\n occupants,\n @tupe_flag,\n @london_flag,\n @cafm_flag,\n @helpdesk_flag,\n rates,\n rate_card,\n supplier_name,\n building_data)\n\n results2 = nil\n results2 = results[v[:service_code]] = {} if results\n results2[:spreadsheet_label] = v[:spreadsheet_label] if results2\n sum_uom += calc_fm.sumunitofmeasure results2\n sum_benchmark += calc_fm.benchmarkedcostssum if supplier_name.nil?\n end\n return { sum_uom: sum_uom } if supplier_name\n\n { sum_uom: sum_uom,\n sum_benchmark: sum_benchmark }\n rescue StandardError => e\n raise e\n ensure\n { sum_uom: sum_uom,\n sum_benchmark: sum_benchmark }\n end", "def get_service(context, host, proto, port, state=ServiceState::Up)\n\t\trec = Service.find(:first, :conditions => [ \"host_id = ? and proto = ? and port = ?\", host.id, proto, port])\n\t\tif (not rec)\n\t\t\trec = Service.create(\n\t\t\t\t:host_id => host.id,\n\t\t\t\t:proto => proto,\n\t\t\t\t:port => port,\n\t\t\t\t:state => state,\n\t\t\t\t:created => Time.now\n\t\t\t)\n\t\t\trec.save\n\t\t\tframework.events.on_db_service(context, rec)\n\t\tend\n\t\treturn rec\n\tend", "def generate_services\n is_adjustment_line = @service.adjustment_line_is?\n service_segments = []\n service_segments << service_payment_information unless is_adjustment_line\n service_segments << service_date_reference\n unless is_adjustment_line\n cas_segments, pr_amount, crosswalked_codes = Output835.cas_adjustment_segments(@service, @client, @facility, @payer, @element_seperator, @eob, @batch, @check)\n service_segments << cas_segments\n else\n pr_amount = 0.0\n end\n service_segments << service_line_item_control_num unless is_adjustment_line\n service_segments << provider_control_number unless is_adjustment_line\n supp_amount = supplemental_amount\n service_segments << service_supplemental_amount(supp_amount) unless supp_amount.blank? || @service.amount('service_paid_amount').blank?\n service_segments << patpay_specific_lq_segment if @facility.abbr_name == \"RUMC\"\n service_segments << standard_industry_code_segments(@service)\n [service_segments.compact.flatten, pr_amount]\n end", "def parse_args(args, stages, services)\n args = args.dup\n selected_services = []\n tasks = nil\n selected_stage = nil\n\n selected_stage = if stages.include?(args.first)\n args.shift\n elsif !get_stage_name(args.first, stages).nil?\n arg = args.shift\n selected_services << get_service_name(arg, services)\n get_stage_name(arg, stages)\n else\n nil\n end\n\n args.each_with_index do |a, i|\n if selected_stage.nil? && !get_stage_name(a, stages).nil?\n selected_stage = get_stage_name(a, stages)\n _service = get_service_name(a, services)\n selected_services << _service unless selected_services.include?(_service)\n elsif !get_service_name(a, services).nil?\n _service = get_service_name(a, services)\n selected_services << _service unless selected_services.include?(_service)\n else\n tasks = args[i..args.length].join(\" \")\n break\n end\n end\n [selected_stage, selected_services.flatten.uniq, tasks]\n end", "def create\n @service = Service.create(service_params)\n end", "def create(name, command, description = nil, options = {})\n defaults = {\n :service_type => Win32::Service::WIN32_OWN_PROCESS,\n :start_type => Win32::Service::AUTO_START,\n :error_control => Win32::Service::ERROR_NORMAL\n }\n defaults.merge!(options)\n name = n(name)\n options = defaults.merge(\n :display_name => name,\n :description => description || name,\n :binary_path_name => command\n )\n Win32::Service.create(name, nil, options)\n end", "def service_definition(service)\n @analyzer.analyze(service)\n end", "def service_params\n params.require(:service).permit(:name, :description)\n end", "def service_params\n params.require(:service).permit(:name, :description)\n end", "def cloud_desc(use_cache: true)\n return @cloud_desc_cache if @cloud_desc_cache and use_cache\n rules = {}\n\n @config[\"listeners\"].each { |l|\n name = MU::Cloud::Google.nameStr(@cloud_id+\"-\"+l['targetgroup'])\n rule = if @config['global']\n MU::Cloud::Google.compute(credentials: @config['credentials']).get_global_forwarding_rule(\n @project_id,\n name\n )\n else\n MU::Cloud::Google.compute(credentials: @config['credentials']).get_forwarding_rule(\n @project_id,\n @config['region'],\n name\n )\n end\n rule = rule.first if !rule.respond_to?(:name)\n rules[rule.name] = rule\n if rule.respond_to?(:backend_service) and !rule.backend_service.nil?\n @backend_cache ||= []\n @backend_cache << rule.backend_service.gsub(/.*?\\//, '')\n elsif rule.respond_to?(:target) and !rule.target.nil?\n proxy = self.class.desc_from_url(rule.target, @project_id, credentials: @credentials)\n if proxy.respond_to?(:url_map) and !proxy.url_map.nil?\n urlmap = self.class.desc_from_url(proxy.url_map, @project_id, credentials: @credentials)\n if urlmap.respond_to?(:default_service) and !urlmap.default_service.nil?\n backend = self.class.desc_from_url(urlmap.default_service, @project_id, credentials: @credentials)\n @backend_cache ||= []\n @backend_cache << backend\n end\n end\n end\n }\n rules = nil if rules.empty?\n @backend_cache.uniq! if @backend_cache\n @cloud_desc_cache = rules\n\n rules\n end", "def initialize(description, url)\n @url = url\n\n @type = description.at('serviceType').text.strip\n @id = description.at('serviceId').text.strip\n @control_url = @url + description.at('controlURL').text.strip\n @event_sub_url = @url + description.at('eventSubURL').text.strip\n @scpd_url = @url + description.at('SCPDURL').text.strip\n\n create_driver\n end", "def create_service_objects\n\n # initialize vars\n svcconfig = String.new\n svcconfig = \"#### Service Objects ####\\n\"\n svcconfig += \"config firewall service custom\"\n service_tracker = Set.new # create a set for tracking if service already has been created to avoid duplicates\n category = $opts[:servicecategory]\n filterused = nil\n\n # Open external files with data for mapping protocol port numbers\n ip = File.open 'reference/ip_protocol_nums.txt', 'r'\n tcpudp = File.open 'reference/tcp-udp_ports.txt', 'r'\n icmp = File.open 'reference/icmp_type_codes.txt', 'r'\n icmpmsg = File.open 'reference/icmp_msg_codes.txt', 'r'\n\n # Initialize hashes for stroing the protocol/port number information from files\n h_ip = Hash.new\n h_tcpudp = Hash.new\n h_icmp = Hash.new\n h_icmp_msg = Hash.new\n\n # import the ip protocol number info from file to h_ip hash\n ip.each_line do |x|\n num, name = x.split\n h_ip[num] = name\n end\n\n # reverse the keys and values\n h_ip = h_ip.invert\n\n # import the tcp/dump port number info from file to h_tcpudp hash\n tcpudp.each_line do |x|\n num, name = x.split\n h_tcpudp[num] = name\n end\n\n # reverse the keys and values\n h_tcpudp = h_tcpudp.invert\n\n # import the icmp type code detail from file to the h_icmp hash\n icmp.each_line do |x|\n num, name = x.split\n h_icmp[num] = name\n end\n\n # import the icmp msg code detail from file to the h_icmp_msg hash\n icmpmsg.each_line do |x|\n num, name = x.split\n h_icmp_msg[num] = name\n end\n\n # close the protocol info files\n ip.close\n tcpudp.close\n icmp.close\n icmpmsg.close\n\n # Create a new service category in the local fg config file to assign all created services to\n svcconfig = <<-EOS\nconfig firewall service category\n edit #{category}\nend\n\nEOS\n\n # Merge ipv4 and ipv6 filters to hash \"filters\" to process both ipv4 and ipv6 in this request\n filters = $h_filters.merge($h_filters6)\n\n # Process service objects for all ipv4 filters first\n filters.each_key do |filtername|\n filterused = check_if_filter_used(filtername)\n\n unless filterused\n p \"policy_service_objects: filter not used by an interface, skipping: #{filtername}\" if $opts[:verbose]\n next\n end\n\n\n filters[filtername].each_key do |termname|\n filters[filtername][termname][:source].each do |sourcename, sourcetype|\n\n # Use sourcetype to identify service definitions then modify those as needed to\n # convert for use in FG config\n case sourcetype.to_s # we will be matching against strings and output to string so need to chg from symbol\n when *%w[destination-port source-port port]\n\n # Matching anything that is all digits or digits with a single dash\n # the just digits indicates a single port number while with a dash is a range.\n # anything that does not match these will be processed in subsequent case\n # as we'll need to map those from words \"http, ftp, etc\" to port numbers\n if /^(\\d+)$/ =~ sourcename || /^(\\d+[-]\\d+)$/ =~ sourcename\n\n ### Some entries contain a range of ports. In these cases\n ### we need to split the low and high ports for assignment\n lowport, highport = ''\n lowport, highport = sourcename.to_s.split('-')\n\n highport = lowport unless highport\n\n ### Check to see if the associated term defines tcp, udp or icmp\n ### if it defines none of these then we will create objects for\n ### both tcp and udp. It defines just icmp, we won't worry about the\n ### tcp/udp objects and will process icmp under a different case\n tcp, udp, icmp = nil\n if filters[filtername][termname][:source].has_key?(:tcp)\n tcp = true\n end\n\n if filters[filtername][termname][:source].has_key?(:udp)\n udp = true\n end\n\n if filters[filtername][termname][:source].has_key?(:icmp)\n icmp = true\n end\n unless tcp && udp && icmp\n tcp = true\n udp = true\n end\n\n # create a tcp destination object if term contains protocol tcp and if\n # it's not type source-port and if we haven't already created this object\n if (tcp && !service_tracker.include?(\"#{sourcename}-tcp\") && sourcetype != :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-tcp\", lowport, highport, \"from term: #{termname}\",\\\n category, :dst, :tcp)\n\n service_tracker.add(\"#{sourcename}-tcp\")\n end\n\n if (udp && !service_tracker.include?(\"#{sourcename}-udp\") && sourcetype != :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-udp\", lowport, highport, \"from term: #{termname}\",\\\n category, :dst, :udp)\n\n service_tracker.add(\"#{sourcename}-udp\")\n end\n\n if (tcp && !service_tracker.include?(\"#{sourcename}-tcp\") && sourcetype == :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-tcp_source\", lowport, highport, \"from term: #{termname}\",\\\n category, :src, :tcp)\n\n service_tracker.add(\"#{sourcename}-tcp_source\")\n end\n\n if (udp && !service_tracker.include?(\"#{sourcename}-udp\") && sourcetype == :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-udp_source\", lowport, highport, \"from term: #{termname}\",\\\n category, :src, :udp)\n\n service_tracker.add(\"#{sourcename}-udp_source\")\n end\n\n # Map named protocol term definitions to ports (aka http, ftp, snmp)\n else\n # Get port matching sourcename from h_tcpudp service/port mapping array\n port, lowport, highport = nil\n\n port = h_tcpudp[sourcename.to_s]\n # if port is nil then no match was found, print out some info and move to next record\n if port == nil\n p \"Couldn't find a protocol match in file: Sourcename: #{sourcename} --> Port: #{port}\"\\\n if $opts[:verbose]\n\n next\n end\n\n lowport, highport = port.split('-')\n highport = lowport unless highport\n\n # Check to see if the associated term defines tcp, udp or icmp\n # if it defines none of these then we will create objects for\n # both tcp and udp. It defines just icmp, we won't worry about the\n # tcp/udp objects and will process icmp under a different case\n tcp, udp, icmp = nil\n if filters[filtername][termname][:source].has_key?(:tcp)\n tcp = true\n end\n\n if filters[filtername][termname][:source].has_key?(:udp)\n udp = true\n end\n\n if filters[filtername][termname][:source].has_key?(:icmp)\n icmp = true\n end\n unless tcp && udp && icmp\n tcp = true\n udp = true\n end\n\n if (tcp && !service_tracker.include?(\"#{sourcename}-tcp\") && sourcetype != :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-tcp\", lowport, highport, \"from term: #{termname}\",\\\n category, :dst, :tcp)\n\n service_tracker.add(\"#{sourcename}-tcp\")\n end\n\n if (udp && !service_tracker.include?(\"#{sourcename}-udp\") && sourcetype != :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-udp\", lowport, highport, \"from term: #{termname}\",\\\n category, :dst, :udp)\n\n service_tracker.add(\"#{sourcename}-udp\")\n end\n\n if (tcp && !service_tracker.include?(\"#{sourcename}-tcp\") && sourcetype == :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-tcp_source\", lowport, highport, \"from term: #{termname}\",\\\n category, :src, :tcp)\n\n service_tracker.add(\"#{sourcename}-tcp_source\")\n end\n\n if (udp && !service_tracker.include?(\"#{sourcename}-udp\") && sourcetype == :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-udp_source\", lowport, highport, \"from term: #{termname}\",\\\n category, :src, :udp)\n\n service_tracker.add(\"#{sourcename}-udp_source\")\n end\n end\n\n\n### Process ICMP protocol types\n\n when *%w[icmp-type icmp-type-except]\n port = String.new\n\n if /^(\\d+)$/ =~ sourcename\n port = sourcename\n else\n port = h_icmp[sourcename.to_s]\n end\n\n if port and !service_tracker.include?(port)\n svcconfig += config_fgservice(\"ICMP-#{sourcename}\", port, port, \"from term: #{termname}\",\\\n category, :icmp, :icmp)\n\n service_tracker.add(\"ICMP-#{sourcename}\")\n\n elsif !port\n p \"create_fgpolicy_service_objects: service icmp-type not found port = #{port} sourcename = #{sourcename}\"\\\n if $opts[:verbose] || $opts[:debug]\n next\n end\n end\n end\n end\n end\n if $opts[:debug]\n p \"service tracker\"\n service_tracker.each do |x|\n p x\n end\n end\n\n # Return the resulting config to main execution\n svcconfig += \"end\\n\\n\"\nend", "def update_service(service_id, name, description)\n response = @client.post(\"/api/v1/services/#{service_id}\", { \"name\" => name, \"description\" => description })\n return JSON.parse(response.body)\n end", "def create_service request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_service_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ServiceDirectory::V1beta1::Service.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def parse_service(data, service)\n data[\"methods\"] ||= {}\n\n data[\"methods\"].each do |name, options|\n options.relative_path = options.path\n options.path = File.join(service.servicePath, options.path)\n options.type = options.httpMethod\n if options.request\n options.request_property = parse_property(\"#{name}_request\", options.request)\n options.request = options.request_property.type\n end\n if options.response\n options.response_property = parse_property(\"#{name}_response\", options.response)\n options.response = options.response_property.type\n end\n # Load service parameters\n if options.parameters.nil? and options.type == \"GET\"\n options.parameters = service.parameters\n end\n end\n\n data.operations = data[\"methods\"]\n\n parse_services(data.resources, service) if data.resources\n\n Types::Service.new(data)\n end", "def create\n @admin_service = Admin::Service.new(admin_service_regex_params)\n\n respond_to do |format|\n if @admin_service.save\n format.html { redirect_to @admin_service, notice: 'Platform was successfully created.' }\n format.json { render :show, status: :created, location: @admin_service }\n else\n format.html { render :new }\n format.json { render json: @admin_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_service_definition_with_http_info(service_name, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceDefinitionAPI.get_service_definition ...'\n end\n # verify the required parameter 'service_name' is set\n if @api_client.config.client_side_validation && service_name.nil?\n fail ArgumentError, \"Missing the required parameter 'service_name' when calling ServiceDefinitionAPI.get_service_definition\"\n end\n allowable_values = ['v1', 'v2', 'v2.1']\n if @api_client.config.client_side_validation && opts[:'schema_version'] && !allowable_values.include?(opts[:'schema_version'])\n fail ArgumentError, \"invalid value for \\\"schema_version\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v2/services/definitions/{service_name}'.sub('{service_name}', CGI.escape(service_name.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'schema_version'] = opts[:'schema_version'] if !opts[:'schema_version'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ServiceDefinitionGetResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :get_service_definition,\n :header_params => 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 :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServiceDefinitionAPI#get_service_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_build( build_def, changesets, duration, message, number, start, status,uri )\r\n\r\n\t\[email protected](\"Creating build.\")\r\n\t\r\n\t\tfields = {\r\n\t\t\t:build_definition => build_def,\r\n\t\t\t:changesets => changesets,\r\n\t\t\t:duration => duration,\r\n\t\t\t:message => message,\r\n\t\t\t:number => number,\r\n\t\t\t:start => start,\r\n\t\t\t:status => status,\r\n\t\t\t:uri => uri\t\r\n\t\t}\r\n\t\[email protected](\"Creating build #{fields}\")\r\n\t\t\r\n\t\tbuild = @rally.create(:build, fields)\r\n\t\[email protected](\"Created build #{fields}\")\r\n\r\n\t\r\n\tend", "def parse_device_description(dd)\n dd_xml = Nokogiri::XML(dd)\n raise DeviceDescriptionInvalid if dd_xml.nil?\n dd_xml.remove_namespaces!\n camera_name = dd_xml.css('device friendlyName').inner_text\n services = dd_xml.css('device X_ScalarWebAPI_Service')\n endpoints = {}\n services.each do |sv|\n service_type = sv.css('X_ScalarWebAPI_ServiceType').inner_text\n endpoints[service_type] = File.join(sv.css('X_ScalarWebAPI_ActionList_URL').inner_text, service_type)\n end\n # endpoints['liveview'] = dd_xml.css('device X_ScalarWebAPI_LiveView_URL').inner_text\n # endpoints.delete_if { |k, v| v.blank? }\n log.info \"model-name: #{camera_name}\"\n log.debug 'endpoints:'\n endpoints.each do |e|\n log.debug \" #{e}\"\n end\n endpoints\n end", "def add_service_name(current_string)\n add_if_present(@service_name, current_string, \" #{@service_name}\")\n end", "def from_s(str)\n # Get rid of whitespace\n str.strip!\n\n # Parse into lines\n lines = str.split /\\n/\n\n # Remove comments and get rid of empty lines\n lines.each do |line|\n line.lstrip!\n line.sub!(/#.*$/, '')\n line.rstrip!\n end\n lines.delete_if { |line| line.empty? }\n raise \"Project definition empty\" if lines.empty?\n\n # Parse project declaration\n parse_project_decl lines\n raise \"Unexpected end of project declaration\" if lines.empty?\n\n while !lines.empty?\n # Get the next property string\n curline = lines.first\n tokens = curline.split\n property = tokens.first\n\n # Check if we're all done\n if property == '}'\n if lines.size > 1\n raise \"Unexpected tokens after final '}' in project definition\"\n end\n return\n end\n \n # Parse each property\n begin\n case property\n when 'type'\n parse_type lines\n when 'files'\n Utils::parse_unnamed_block(lines, files)\n when 'deps'\n Utils::parse_unnamed_block(lines, deps)\n when 'libs'\n Utils::parse_unnamed_block(lines, libs)\n when 'inc-paths'\n Utils::parse_unnamed_block(lines, inc_paths)\n when 'lib-paths'\n Utils::parse_unnamed_block(lines, lib_paths)\n else\n raise \"Unknown project property\"\n end\n rescue => e\n raise \"Error parsing property '#{property}': \" + e.message\n end\n\n # Make sure we haven't reached a premature end of the definition\n raise \"Unexpected end of system declaration\" if lines.empty?\n end\n end", "def prepare_service(parameter)\n return @service_path % parameter\n end", "def service_resource\n find_resource(:systemd_unit, \"#{new_resource.name}.service\") do\n content(\n 'Unit' => {\n 'Description' => \"MongoDB #{new_resource.name} service\",\n 'After' => 'network.target',\n 'Documentation' => 'https://docs.mongodb.org/manual'\n },\n 'Service' => {\n 'User' => new_resource.user,\n 'Group' => new_resource.group,\n 'ExecStart' => \"#{new_resource.daemon_path} --config #{new_resource.config_path}\",\n 'RestartSec' => '3s',\n 'Restart' => 'always',\n 'LimitFSIZE' => 'infinity',\n 'LimitCPU' => 'infinity',\n 'LimitAS' => 'infinity',\n 'LimitNOFILE' => 64000,\n 'LimitNPROC' => 16000\n },\n 'Install' => {\n 'WantedBy' => 'multi-user.target'\n }\n )\n\n triggers_reload true\n\n action :nothing\n end\n end", "def generate\n\t\ttemplate('service.tt', \"lib/services/#{name.underscore}_service.rb\")\n\tend", "def service_naming(service, dialogs_options_hash)\n log(:info, \"Processing service_naming...\", true)\n new_service_name = dialogs_options_hash[0][:dialog_service_name] rescue nil\n new_service_description = dialogs_options_hash[0][:dialog_service_description] rescue nil\n\n if new_service_name.blank?\n new_service_name = \"#{service.name}-#{Time.now.strftime('%Y%m%d-%H%M%S')}\"\n end\n log(:info, \"Service name: #{new_service_name}\")\n service.name = new_service_name\n\n unless new_service_description.blank?\n log(:info, \"Service description #{new_service_description}\")\n service.description = new_service_description\n end\n log(:info, \"Processing service_naming...Complete\", true)\nend", "def call\n # Update service and update context\n self.service = Entities::Service.find_by_system_name(remote: threescale_client,\n system_name: service_system_name)\n if service.nil?\n # Create service and update context\n self.service = Entities::Service.create(remote: threescale_client,\n service_params: service_settings)\n logger.info \"Created service id: #{service.id}, name: #{service_name}\"\n else\n service.update(service_settings)\n logger.info \"Updated service id: #{service.id}, name: #{service_name}\"\n end\n\n report['id'] = service.id\n report['system_name'] = service.system_name\n report['name'] = service.name\n report['backend_version'] = api_spec.service_backend_version\n end", "def test_service_creation\n JavaBuildpack::Container::Payara::ServiceBindingsHandler.create_service_definitions_from_file_set(\n @payara_complete_domain_configs_yml,\n @config_cache_root,\n @payara_complete_domain_configs_props)\n JavaBuildpack::Container::Payara::ServiceBindingsHandler.create_service_definitions_from_bindings(\n @app_services_config,\n @payara_complete_domain_configs_props)\n\n log('Done generating Domain Configuration Property file for WLST: '\\\n \"#{@payara_complete_domain_configs_props}\")\n log('--------------------------------------')\n end", "def initialize_service_for_create\n @service = service_class.new(hashified_params, service_options)\n end", "def build(step)\n step = default_step if step.blank?\n form_name = \"ProjectForm::#{step.capitalize}Form\".constantize\n create_form! form_name, step\n rescue NameError\n nil\n end", "def obtain_description\n\t\t#it's only pulling traffic train status for now, but we will get it to pull out the description instead.\n\t\tService.find_by(name: self.service_name).traffic\n\tend", "def obtain_description\n\t\t#it's only pulling traffic train status for now, but we will get it to pull out the description instead.\n\t\tService.find_by(name: self.service_name).traffic\n\tend", "def create_services_for_env(services=[])\n whitelist = ['name', 'label', 'plan', 'tags', 'plan_option', 'credentials']\n svcs_hash = {}\n services.each do |svc|\n svcs_hash[svc['label']] ||= []\n svc_hash = {}\n whitelist.each {|k| svc_hash[k] = svc[k] if svc[k]}\n svcs_hash[svc['label']] << svc_hash\n end\n svcs_hash.to_json\n end", "def add_services(product, quantity, attributes)\n separate = (product.active_template? || product.active_survey?)\n # can't add single order_detail for service when it requires a template or a survey.\n # number of order details to add\n repeat = separate ? quantity : 1\n # quantity to add them with\n individual_quantity = separate ? 1 : quantity\n\n Array.new(repeat) do\n create_order_detail({ product: product, quantity: individual_quantity }.merge(attributes))\n end\n end", "def create(project_name, repo_name, description) ; end", "def project_params\n params.require(:service).permit(:name, :description, :price, :tag_list)\n end", "def service\n @service ||= service_class.new(self, assessment: @assessment, submission: @submission)\n end", "def create_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'CreateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tself.run(args)\n\tend", "def create\n @complex_service = ComplexService.new(params[:complex_service])\n\n respond_to do |format|\n if @complex_service.save\n format.html { redirect_to(@complex_service, :notice => 'ComplexService was successfully created.') }\n format.xml { render :xml => @complex_service, :status => :created, :location => @complex_service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @complex_service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_ProjectDescription(value)\n set_input(\"ProjectDescription\", value)\n end", "def new\n @service = Service.new\n\n # If a valid type is received, apply to the host to create.\n check_priority_param\n @service.priority = @priority if([email protected]?)\n\n # Add custom views paths\n prepend_view_path \"app/views/services\"\n prepend_view_path \"lib/probes/#{@service.probe}/views\"\n\n respond_to do |format|\n format.html\n end\n end", "def create\n submenu_item 'services-new'\n @service = Service.new(params[:service])\n @service_type = @service.type\n service_param\n\n @service.tenant_id = current_user.tenant_id\n\n # service_params = Service.extract_params(params[:service])\n # service_params = Service.extract_thresholds(service_params)\n # @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n flash[:notice] = \"#{@service.name}创建成功\"\n format.html { redirect_to(@service) }\n else\n dictionary\n format.html { render :action => \"new\" }\n end\n end\n end", "def fetch\n if @scpd_url.empty?\n log \"<#{self.class}> NO SCPDURL to get the service description from. Returning.\"\n set_deferred_success self\n return\n end\n\n description_getter = EventMachine::DefaultDeferrable.new\n log \"<#{self.class}> Fetching service description with #{description_getter.object_id}\"\n get_description(@scpd_url, description_getter)\n\n description_getter.errback do\n msg = \"Failed getting service description.\"\n log \"<#{self.class}> #{msg}\", :error\n # @todo Should this return self? or should it succeed?\n set_deferred_status(:failed, msg)\n\n if ControlPoint.raise_on_remote_error\n raise ControlPoint::Error, msg\n end\n end\n\n description_getter.callback do |description|\n log \"<#{self.class}> Service description received for #{description_getter.object_id}.\"\n @description = description\n @xmlns = @description[:scpd][:@xmlns]\n extract_spec_version\n extract_service_state_table\n\n if @description[:scpd][:actionList]\n log \"<#{self.class}> Defining methods from action_list using [#{description_getter.object_id}]\"\n define_methods_from_actions(@description[:scpd][:actionList][:action])\n end\n\n set_deferred_status(:succeeded, self)\n end\n end", "def service(operation, name, options='')\n ssh_cmd \"service #{name} #{operation.to_s} #{options}\".rstrip\n end", "def set_project_category_service\n @project_category_service = ProjectCategoryService.new\n end", "def service_name; end", "def to_dynamic_service\n log {\n \"Service '#{self.name}' does not appear to by a dynamic service. It does not define the following fields which are required for dynamic services: #{self.missing_fields_for_dynamic_service.join(\",\")}\"\n } unless dynamic_service?\n\n MotherBrain::Gear::DynamicService.new(component.name, name)\n end", "def initialize project, credentials,\n retries: nil, timeout: nil, host: nil, quota_project: nil\n @project = project\n @credentials = credentials\n @service = API::DnsService.new\n @service.client_options.application_name = \"gcloud-ruby\"\n @service.client_options.application_version = \\\n Google::Cloud::Dns::VERSION\n @service.client_options.open_timeout_sec = timeout\n @service.client_options.read_timeout_sec = timeout\n @service.client_options.send_timeout_sec = timeout\n @service.request_options.retries = retries || 3\n @service.request_options.header ||= {}\n @service.request_options.header[\"x-goog-api-client\"] = \\\n \"gl-ruby/#{RUBY_VERSION} gccl/#{Google::Cloud::Dns::VERSION}\"\n @service.request_options.quota_project = quota_project if quota_project\n @service.authorization = @credentials.client\n @service.root_url = host if host\n end", "def add_service(name)\n serv = @services[name] || new_service(Service.new(name, self))\n @services.sort{|a,b| \"#{a[0]}\"<=>\"#{b[0]}\"}\n serv\n end", "def create\n req = VCAP::Services::Api::ServiceOfferingRequest.decode(request_body)\n logger.debug(\"Create service request: #{req.extract.inspect}\")\n\n # Should we worry about a race here?\n\n success = nil\n svc = Service.find_by_label(req.label)\n if svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n attrs = req.extract.dup\n attrs.delete(:label)\n # Keep DB in sync with configs if the token changes in the config\n attrs[:token] = @service_auth_token if svc.is_builtin?\n svc.update_attributes!(attrs)\n else\n # Service doesn't exist yet. This can only happen for builtin services since service providers must\n # register with us to get a token.\n svc = Service.new(req.extract)\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.is_builtin? && svc.verify_auth_token(@service_auth_token)\n svc.token = @service_auth_token\n svc.save!\n end\n\n render :json => {}\n end", "def create\n service = current_account.services.build\n create_service = ServiceCreator.new(service: service)\n create_service.call(service_params.to_h)\n service.reload if service.persisted? # It has been touched\n respond_with(service)\n end", "def validate_scpd(service_description)\n namespace = service_description.at('scpd').namespace.href\n\n raise Error, \"invalid namespace #{namespace}\" unless\n namespace == 'urn:schemas-upnp-org:service-1-0'\n\n major = service_description.at('scpd > specVersion > major').text.strip\n minor = service_description.at('scpd > specVersion > minor').text.strip\n\n raise Error, \"invalid version #{major}.#{minor}\" unless\n major == '1' and minor == '0'\n end", "def create_service request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_service_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def named(name)\n service = all.find{|service| service.name == name}\n if service.nil?\n raise UnknownService, \"Service named #{name} isn't available\"\n else\n service\n end\n end", "def create\n service = current_account.services.build\n create_service = ServiceCreator.new(service: service)\n create_service.call(service_params)\n service.reload if service.persisted? # It has been touched\n respond_with(service)\n end", "def as_service\n @service ||= (plan.find_plan_service(self) || PlanService.new(self))\n end" ]
[ "0.56258726", "0.5333281", "0.5274084", "0.51164347", "0.51129496", "0.5043704", "0.5030223", "0.499239", "0.49863032", "0.49497426", "0.49423024", "0.48808274", "0.48239368", "0.4815402", "0.48146513", "0.4779233", "0.47615486", "0.47334135", "0.46988174", "0.46753865", "0.46554726", "0.463806", "0.4633233", "0.4595608", "0.4574702", "0.4571535", "0.4551771", "0.45503056", "0.4546287", "0.45462072", "0.45417222", "0.45322692", "0.45254016", "0.44930527", "0.4487494", "0.44749308", "0.44733593", "0.44728765", "0.44629657", "0.44610605", "0.44546402", "0.4453025", "0.44409096", "0.44352803", "0.44231096", "0.4412051", "0.44001105", "0.43967786", "0.43892223", "0.43887562", "0.43831158", "0.43814212", "0.43748614", "0.43748614", "0.4367192", "0.43634892", "0.4361518", "0.4356777", "0.43328452", "0.43273652", "0.43243465", "0.43205887", "0.431535", "0.43125007", "0.4304395", "0.42961517", "0.42935893", "0.42747352", "0.4262156", "0.42611444", "0.42607892", "0.42449865", "0.42440057", "0.42377633", "0.4237658", "0.4237625", "0.42350486", "0.42297766", "0.42230192", "0.42178756", "0.42169005", "0.42141733", "0.42109632", "0.4210455", "0.42089006", "0.4204347", "0.42005464", "0.4196362", "0.41952062", "0.41898298", "0.4184418", "0.4168842", "0.41668245", "0.416543", "0.41623175", "0.41585782", "0.41583568", "0.41529018", "0.41528574", "0.4149768" ]
0.54059
1
This method is just here because I want the descs list at the very bottom of the file
def process_descs(descs) if $options[:readonly] branch_report descs else build_the_world descs end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def desc; end", "def desc\n\tend", "def desc\n\tend", "def add_desc(heading,list)\n description = \"\\n\\n#{heading}: #{list.length.to_s}\\n\\n\\t\"\n description << list.join(\"\\n\\t\") unless list.empty?\n description\n end", "def load_long_desc_file(path)\n if ::File.extname(path) == \".txt\"\n begin\n ::File.readlines(path).map do |line|\n line = line.chomp\n line =~ /^\\s/ ? [line] : line\n end\n rescue ::SystemCallError => e\n raise Toys::ToolDefinitionError, e.to_s\n end\n else\n raise Toys::ToolDefinitionError, \"Cannot load long desc from file type: #{path}\"\n end\n end", "def desc(description); @next_desc = description; end", "def program_long_desc(desc)\n abstract!\n end", "def desc=(_); end", "def is_desc?(line)\n @desc += \"\\n\"+line unless @skip or @to_code\n end", "def main_description; end", "def describe\n f = file!\n puts \"Current target: #{f.basename}\"\n puts '*' * 70\n File.open(f).each do |line|\n puts \" #{line}\"\n end\n puts '*' * 70\n end", "def one_line_description(opts={}) ; attributes['comments'] ; end", "def desc(description); @@next_desc = description; end", "def descriptions\n []\n end", "def desc() summary; end", "def flatiron_title_descend_01\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n end", "def formatted_file_list(title, source_files); end", "def long_desc(long_desc); @next_long_desc = long_desc; end", "def long_desc(long_desc); @next_long_desc = long_desc; end", "def descriptions\n @all_descriptions ||= @doc.match DESCRIPTION_MATCHES\n end", "def print\n blank = \"#{Tty.yellow}[no description]#{Tty.reset}\"\n @descriptions.keys.sort.each do |name|\n description = @descriptions[name] || blank\n puts \"#{Tty.white}#{name}:#{Tty.reset} #{description}\"\n end\n end", "def output_details(files) \n @stdout.puts\n @stdout.puts \"Details\".bold\n files.each do |t|\n fname = t.path\n @stdout.puts \"File: %s\" % [((t.status == FileData::STATUS_OK) ? fname : fname.red)]\n @stdout.puts \"Includes: %s\" % [format_fds(t.includes)] unless t.includes.empty?\n @stdout.puts \"Included by: %s\" % [format_fds(t.included_by)] unless t.included_by.empty?\n @stdout.puts \"References: %s\" % [format_fds(t.references)] unless t.references.empty?\n @stdout.puts \"Referenced by: %s\" % [format_fds(t.referenced_by)] unless t.referenced_by.empty?\n unless t.status == FileData::STATUS_NOT_FOUND\n # show that part only if file exists\n @stdout.puts \"Size: %s (%d)\" % [format_size(t.size),t.size]\n if (t.docbook)\n @stdout.puts \"Type: DocBook, Version #{t.version}, Tag: #{t.tag}\"\n else\n @stdout.puts \"MIME: #{val_s(t.mime)}\"\n end\n @stdout.puts \"Timestamp: %s\" % [t.ts]\n @stdout.puts \"SHA1: %s\" % [t.checksum]\n end\n @stdout.puts \"Error: %s\" % [t.error_string.to_s.red] unless (t.error_string.nil?) \n @stdout.puts\n end\n end", "def find_description_in(header)\n desc_found = false\n docstring = []\n header.each_line do |line|\n if desc_found\n docstring.push line\n elsif line.chomp == 'Description'\n desc_found = true\n end\n end\n\n docstring.join(\"\\n\")\n end", "def fileHeader(fname, curDate, misc=\"\")\r\n fname = File.basename(fname, \".gdl\")\r\n header = <<EOF\r\n/* **************************************************************************\r\n * File: #{fname}.gdl\r\n *\r\n * Guideline source generated #{curDate}\r\n * #{misc}\r\n *\r\n * *************************************************************************/\r\n\r\n\r\nEOF\r\n\r\n return header\r\n end", "def desc(usage, description)\n @docs ||= []\n @docs << { usage: usage, desc: description }\n end", "def description\n description_section.join(\" \").tr(\"\\n\", ' ').gsub(/[{}]/,'').gsub(/\\[[^\\]]+\\]/,'') # strip rdoc\n end", "def desc\n\t\t\"Useful for analyzing scanned web sites later.\"\n\tend", "def desc\n return @desc\n end", "def long_desc(long_desc); @@next_long_desc = long_desc; end", "def provide_navigation_to_all_long_descriptions\n # Interface method\n end", "def description\n reading = @pinyin.empty? ? @pinyin_diacritic : @pinyin\n desc_str = \"%s %s [%s], %s\" % [@headword_trad, @headword_simp, reading, meaning_txt]\n end", "def gen_descriptions\n @parser.descriptions.each do |name|\n editor = ModelEditor.new(name.snake_case)\n editor.generate_resource(@parser.properties[name])\n editor.fixup_properties(@parser.properties[name])\n editor.insert(BEFORE_CLASS, model_comments(name))\n editor.insert(AFTER_INCLUDES, ' include AssociationHelper')\n editor.insert(AFTER_INCLUDES, ' is_paginated')\n editor.insert(AFTER_REQUIREMENTS, def_to_s(@parser.properties[name]))\n end\n end", "def yardoc_file; end", "def ending\n if File.exist?('CREDITS.md')\n @io.puts IO.read('CREDITS.md')\n @io.puts\n end\n\n if File.exist?('AUTHORS.md')\n @io.puts IO.read('AUTHORS.md')\n @io.puts\n end\n\n if File.exist?('LICENSE.md')\n @io.puts IO.read('LICENSE.md')\n @io.puts\n end\n @io.puts\n @io.puts \"Documentation generated #{Time.now.strftime('%Y-%m-%d %H:%M')}\"\n @io.puts\n @io.close\n end", "def parse_description\n skip_tkspace\n\n tk = get_tk\n\n @desc = tk.text[1..-2]\n end", "def generate_excerpt?; end", "def apply_updates_desc(desc)\n return if desc.to_s.empty?\n\n wrap_length = MAX_LINE_LENGTH - WORD_WRAP_INDENT\n\n @control_string.sub!(\n /desc\\s+(((\").*?(?<!\\\\)\")|((').*?(?<!\\\\)')|((%q{).*?(?<!\\\\)[}])|(nil))\\n/m,\n \"desc %q{#{desc}}\".word_wrap(wrap_length).indent(WORD_WRAP_INDENT)\n )\n end", "def description; @doc['description']; end", "def description; @doc['description']; end", "def overview( *settings )\r\n txt = []\r\n txt << \"List of ToDos/FixMes:\"\r\n @codelines.each do |key, todo|\r\n txt << todo.infoline(settings)\r\n end\r\n txt.join(\"\\n\")\r\n end", "def desc(description)\n @docs << description\n end", "def desc(txt)\n @@desc = txt\n end", "def description\n return super if ordered_descriptions.blank?\n JSON.parse(ordered_descriptions)\n end", "def description_section\n section_of( 'README.md', 'DESCRIPTION')\n end", "def add_description!(options)\n # Can be useful if an app generates additional tests on the fly for a single test in the flow,\n # e.g. a POR, in that case they will not want the description to be attached to the POR, but to\n # the test that follows it\n unless options[:inhibit_description_consumption]\n ht_coms = OrigenTesters::Flow.ht_comments\n cc_coms = OrigenTesters::Flow.cc_comments\n line_no = options[:source_line_number]\n # options[:then] only present on the second iteration of the same test same loop (not sure what this is really)\n # This method is called twice per test method in a loop but the second call should not consume a comment\n if line_no && !options[:then]\n if ht_coms[line_no]\n options[:description] ||= ht_coms[line_no]\n end\n if cc_coms[line_no] && cc_coms[line_no].first\n options[:description] ||= [cc_coms[line_no].shift]\n end\n end\n end\n end", "def generate_description\n text, _ = parse_description\n parts = []\n parts << text if text.length > 0\n parts << JSON.generate(config) if config && config.length > 0\n parts.join(\"\\n\")\n end", "def description\n @description ||= begin\n readme = File.read( path( 'README.txt' ) )\n md = readme.match( /== DESCRIPTION:(.+?)\\n== /m ) or\n fail( \"can't find a description section in README.txt\" )\n md[1].strip\n end\n end", "def initialize(filename)\n @name = ''\n @desc = ''\n @diagram = ''\n \n file = File.open(filename)\n \n while(line = file.gets)\n line.chomp!\n if(line == 'NAME')\n @name = file.gets.chomp!\n elsif(line == 'DESC')\n while((line = file.gets) && line != \"END\\n\")\n @desc += line\n end\n elsif(line == 'DIAGRAM')\n while((line = file.gets) && line != \"END\\n\")\n @diagram += line\n end \n end\n end\n file.close()\n end", "def desc(description, options = {})\n @last_description = options.merge(description: description)\n end", "def program_desc(desc)\n abstract!\n end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def help\n lines = []\n end", "def site_description\n headings = @doc.xpath(\"//h3[@class='clearl']\")\n content_sections = @doc.xpath(\"//h3[@class='clearl']/following-sibling::p[1]\")\n content = \"\"\n headings.zip(content_sections).each do |h, c| \n unless (c.to_s().squeeze().empty?)\n content << \"<h3>#{sanitize(h.to_s)}</h3>\" \n content << \"<p>#{sanitize(c.to_s)}\"\n end\n end\n rhtml = IO.read(File.expand_path(\"site_description.rhtml\", File.dirname(__FILE__)))\n content_html = Erubis::Eruby.new(rhtml)\n content_html.result(:content => content)\n end", "def generator_descriptions\n lengths = []\n\n generators = RDoc::RDoc::GENERATORS.map do |name, generator|\n lengths << name.length\n\n description = generator::DESCRIPTION if\n generator.const_defined? :DESCRIPTION\n\n [name, description]\n end\n\n longest = lengths.max\n\n generators.sort.map do |name, description|\n if description then\n \" %-*s - %s\" % [longest, name, description]\n else\n \" #{name}\"\n end\n end.join \"\\n\"\n end", "def desc\n Desc.new(self)\n end", "def use_desc\n desc = @desc\n @desc = nil\n desc || ''\n end", "def description\n\t\tdoCommandList.each do |commandItem|\n\t\t\tputs commandItem.description\n\t\tend\n\tend", "def printHeader\n puts \"!_TAG_FILE_FORMAT\\t2\\t/extended format/\\n\" \n puts \"!_TAG_FILE_SORTED\\t0\\t/0=unsorted, 1=sorted, 2=foldcase/\\n\"\n puts \"!_TAG_PROGRAM_AUTHOR\\tScott Shattuck\\t/[email protected]/\\n\"\n puts \"!_TAG_PROGRAM_URL\\t//\\n\"\n puts \"!_TAG_PROGRAM_NAME\\tjstags.rb\\t//\\n\"\n puts \"!_TAG_PROGRAM_VERSION\\t1.0\\t//\\n\"\n return\nend", "def extract_description(text_lines, start_line)\n\tdescription = \"\"\n\ttext_lines[start_line..-1].each do |line|\n\t\tif line == line.upcase && line != \"\"\n\t\t\tbreak\n\t\telse\n\t\t\tdescription << line.strip + \" \"\n\t\tend\n\tend\n\tdescription\nend", "def process_descriptions(n)\n descriptions = self.feature.descriptions\n delete_descriptions = self.fields.delete('descriptions.delete')\n descriptions.clear if !delete_descriptions.blank? && delete_descriptions.downcase == 'yes'\n 0.upto(n) do |i|\n prefix = i>0 ? \"#{i}.descriptions\" : 'descriptions'\n description_content = self.fields.delete(\"#{prefix}.content\")\n if !description_content.blank?\n description_content = \"<p>#{description_content}</p>\"\n author_name = self.fields.delete(\"#{prefix}.author.fullname\")\n description_title = self.fields.delete(\"#{prefix}.title\")\n author = author_name.blank? ? nil : AuthenticatedSystem::Person.find_by(fullname: author_name)\n description = description_title.blank? ? descriptions.find_by(content: description_content) : descriptions.find_by(title: description_title) # : descriptions.find_by(['LEFT(content, 200) = ?', description_content[0...200]])\n language = Language.get_by_code_or_name(self.fields.delete(\"#{prefix}.languages.code\"), self.fields.delete(\"#{prefix}.languages.name\"))\n attributes = {:content => description_content, :title => description_title}\n attributes[:language_id] = language.id if !language.nil?\n if description.nil?\n if language.nil?\n self.say \"Language needed to create description for feature #{self.feature.pid}.\"\n description = nil\n else\n description = descriptions.create(attributes)\n end\n else\n description.update_attributes(attributes)\n end\n if !description.nil?\n self.spreadsheet.imports.create(:item => description) if description.imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n description.authors << author if !author.nil? && !description.author_ids.include?(author.id)\n end\n end\n end \n end", "def contstruct_readme\n config = template.config\n\n s = []\n s << \"# %s - %s\" % [config[:name], config[:summary]]\n s << \"## SYNOPSIS\"\n s << Array(usage).join(\"\\n\")\n s << \"## DESCRIPTION\"\n s << config[:description]\n s << \"## COPYRIGHT\"\n s << config[:copyright]\n s.join(\"\\n\\n\")\n end", "def file_description\n @descriptive_detail.file_description\n end", "def articles_desc\n articles_asc.reverse\n end", "def manual_description\n txt = '\\t' + @names.join(\", \") + (@type && @type != 'x' ? ' ' : ': ')\n txt += _INTL('({1}): ',type_name(@type)) if @type && @type != 'x'\n txt += @description\n return txt\n end", "def desc\n\t\t\"Basic I/O\"\n\tend", "def list_descriptions(obj, fake_default = false)\n type = obj.type_tag\n\n # Filter out empty descriptions (unless it's public or one you own).\n list = obj.descriptions.includes(:user).select do |desc|\n desc.notes? || (desc.user == @user) ||\n reviewer? || (desc.source_type == :public)\n end\n\n # Sort, putting the default one on top, followed by public ones, followed\n # by others ending in personal ones, sorting by \"length\" among groups.\n type_order = Description.all_source_types\n list.sort_by! do |x|\n [\n (x.id == obj.description_id ? 0 : 1),\n type_order.index(x.source_type),\n -x.note_status[0],\n -x.note_status[1],\n description_title(x),\n x.id\n ]\n end\n\n # Turn each into a link to show_description, and add optional controls.\n list.map! do |desc|\n item = description_link(desc)\n writer = writer?(desc)\n admin = is_admin?(desc)\n if writer || admin\n links = []\n if writer\n links << link_with_query(:EDIT.t,\n controller: obj.show_controller,\n action: \"edit_#{type}_description\",\n id: desc.id)\n end\n if admin\n links << link_with_query(:DESTROY.t,\n { controller: obj.show_controller,\n action: \"destroy_#{type}_description\",\n id: desc.id },\n data: { confirm: :are_you_sure.t })\n end\n item += indent + \"[\" + links.safe_join(\" | \") + \"]\" if links.any?\n end\n item\n end\n\n # Add \"fake\" default public description if there aren't any public ones.\n if fake_default && !obj.descriptions.any? { |d| d.source_type == :public }\n str = :description_part_title_public.t\n link = link_with_query(:CREATE.t, controller: obj.show_controller,\n action: \"create_#{type}_description\",\n id: obj.id)\n str += indent + \"[\" + link + \"]\"\n list.unshift(str)\n end\n\n list\n end", "def file_desc\n \"Files (#{file_ext(',')})\"\n end", "def summary(content)\n content[0, content.index('<!-- more -->') || content.length]\nend", "def descriptions\n @@descriptions ||= Parser::DescriptionLookup.new\n end", "def parse_definition_list; end", "def print_help\n File.read(__FILE__).lines[1..-1].each do |line|\n if line =~ /\\A#/\n puts line[2..-1]\n else\n break\n end\n end\nend", "def print_help\n File.read(__FILE__).lines[1..-1].each do |line|\n if line =~ /\\A#/\n puts line[2..-1]\n else\n break\n end\n end\nend", "def describe(desc, *additional_desc, &block); end", "def describe\n base = \"\"\n\n if !described? && respond_to?(:desc)\n self.described = true\n base << desc.to_s\n elsif described? && respond_to?(:short_desc)\n base << short_desc.to_s\n elsif described? && !respond_to?(:short_desc)\n base << desc.to_s\n else\n base << \"I see nothing special\"\n end\n\n if open && !children.empty?\n base << \"<br>\"\n\n if parent.tag == :root\n base << \"You also see:\" + \"<br>\"\n else\n base << \"Inside it you see:\" + \"<br>\"\n end\n\n children.each do |c|\n base << \"#{c.presence}<br>\" if c.presence\n end\n end\n\n puts base\n end", "def base_docstring; end", "def help\n prettify(description)\n end", "def summary\n description.lines.first.thru { |line|\n if line\n line.split( '. ', 2 ).first\n else\n ''\n end\n }\n end", "def desc(usage, desc, long_desc = nil)\n @usage = usage\n @desc = desc\n @long_desc = long_desc\n end", "def desc\n if self.namespace\n content_from 'ns:desc', :ns => self.namespace.href\n else\n content_from :desc\n end\n end", "def long_desc_markdown\n return desc_markdown if long_description.empty?\n\n <<-EOL\n## Description\n\n#{description}\n\n#{long_description}\nEOL\n end", "def genFileComment(cls, bld)\r\n end", "def genFileComment(cls, bld)\r\n end", "def genFileComment(cls, bld)\r\n end", "def genFileComment(cls, bld)\r\n end", "def genFileComment(cls, bld)\r\n end", "def indentify\n 'description'\n end", "def indentify\n 'description'\n end", "def help_text\n build_html do\n p <<P1\nThis page is a simple presentation of the paths that match the file\nthat was searched for an the fileset that the file was shipped in.\nP1\n end\n end", "def rearrange_docs!; end", "def update_readme(data_hash)\n \n puts \"Updating README measure order...\"\n \n table_flag_start = \"MEASURE_WORKFLOW_START\"\n table_flag_end = \"MEASURE_WORKFLOW_END\"\n \n readme_path = \"README.md\"\n \n # Create table\n table_lines = []\n table_lines << \"|Group|Measure|Dependencies*|\\n\"\n table_lines << \"|:---|:---|:---|\\n\"\n data_hash.each do |group|\n new_group = true\n group[\"group_steps\"].each do |group_step|\n grp = \"\"\n if new_group\n grp = group[\"group_name\"]\n end\n name = group_step['name']\n deps = group_step['dependencies']\n table_lines << \"|#{grp}|#{name}|#{deps}|\\n\"\n new_group = false\n end\n end\n \n # Embed table in README text\n in_lines = IO.readlines(readme_path)\n out_lines = []\n inside_table = false\n in_lines.each do |in_line|\n if in_line.include? table_flag_start\n inside_table = true\n out_lines << in_line\n out_lines << table_lines\n elsif in_line.include? table_flag_end\n inside_table = false\n out_lines << in_line\n elsif not inside_table\n out_lines << in_line\n end\n end\n \n File.write(readme_path, out_lines.join(\"\"))\n \nend", "def parse_summary(content)\n summary = \"\"\n status = :pre_header\n content.each_line do |l|\n \n # Verify status change\n case status\n when :pre_header\n if l.strip =~ /^h\\d\\.(.+)/\n status = :header \n end\n status = :paragraph if status != :header && l.strip.length > 0\n when :header\n status = :post_header\n when :post_header\n status = :paragraph if l.strip.length > 0\n when :paragraph\n break if l.strip =~ /^h\\d\\./ || l.strip.length == 0\n end\n summary << l\n \n end \n return summary\n end" ]
[ "0.653615", "0.6517724", "0.6517724", "0.64309126", "0.6331982", "0.62967014", "0.62569886", "0.6231334", "0.62243974", "0.6200707", "0.6195624", "0.61647594", "0.6160527", "0.6131406", "0.6069356", "0.60113496", "0.599692", "0.5985559", "0.5985559", "0.59829885", "0.5948528", "0.5943911", "0.5921748", "0.5920667", "0.59040725", "0.5890547", "0.58730435", "0.58653504", "0.5855367", "0.5855341", "0.5855267", "0.5835707", "0.5810593", "0.58063495", "0.577943", "0.57785535", "0.5769556", "0.5766467", "0.5766467", "0.57312924", "0.57300824", "0.5728329", "0.57187396", "0.57088107", "0.57050383", "0.5703893", "0.5702817", "0.5702397", "0.5687386", "0.56697184", "0.5663914", "0.5663914", "0.5663914", "0.5663914", "0.5663914", "0.5663914", "0.5663914", "0.5663914", "0.5663914", "0.5663914", "0.56606007", "0.5654221", "0.5633313", "0.5621327", "0.5616599", "0.56097037", "0.560571", "0.5594396", "0.55906683", "0.55870676", "0.557831", "0.5560672", "0.55265886", "0.5525506", "0.55253416", "0.55223215", "0.5519621", "0.5518984", "0.55181146", "0.5506907", "0.5506907", "0.550388", "0.55017877", "0.55011547", "0.5486615", "0.5484855", "0.5481551", "0.54747677", "0.54708815", "0.5467676", "0.5467676", "0.5467676", "0.5467676", "0.5467676", "0.5467362", "0.5467362", "0.5466814", "0.5459496", "0.5451992", "0.544878" ]
0.58648264
28
Publish an event to the queue
def publish(event) exchange.publish(event) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_event event\n @event_queue << event\n end", "def publish_event(event)\n @event_bus.publish(Domain::EventMessage.as_message(event))\n end", "def publish\n raise 'Event already published' if published\n\n begin\n ::SNT::Core::MQ.publisher.publish(event_context.to_json, routing_key: \"#{service}.dto\")\n self.published = true\n rescue ::StandardError => e\n logger.error \"Could not publish service event to RabbitMQ: #{e.message}\"\n logger.error e.backtrace\n end\n end", "def push(event:)\n super\n\n @queue << event\n end", "def _publish\n puts(\"pushing message: #{self.to_json} to queue #{@queue}\")\n AMQPCli.instance.push(self.to_json, @queue)\n end", "def publish(payload)\n @provider_queue.publish(payload)\n end", "def call(event)\n client.send_message(queue_url: queue_url, message_body: event)\n end", "def call(event)\n client.send_message(queue_url: queue_url, message_body: event)\n end", "def publish(event)\n if deliver_messages\n safe_publish(event)\n say \"Publishing event with routing key #{routing_key}: #{event.to_json}\"\n else\n say \"Event produced but not delivered. If you want to deliver it \" + \\\n \"try to set Untied::Publisher.config.deliver_messages to true. \" + \\\n \"Event: #{event.to_json}\"\n end\n end", "def post(ev)\n\t\t@queue << ev\n\tend", "def publish(response_message)\n @queue.push(response_message)\n nil\n end", "def push(entry)\n exchange.publish(Marshal.dump(entry), :key => queue_name)\n end", "def publish(event, payload)\n end", "def <<(event)\n @mutex.synchronize { @queue << event }\n self\n end", "def safe_publish(event)\n if connection.status == :open\n exchange.publish(event.to_json, :routing_key => routing_key)\n else\n say \"Event not sent. Connection status is #{connection.status}: \" + \\\n \"#{event.to_json}\"\n end\n end", "def publish(channel, event, &block)\n FayeMessage.new.publish(event, channel, capture(&block))\n end", "def publish(channel, event, data)\n Pusher[channel].trigger(event,data)\n end", "def publish(message)\n with_queue(waiting_queue_name) do |waiting_queue|\n publish_to_queue(waiting_queue, message)\n end\n end", "def broadcast(event_name, payload)\n @event_queue << { id: SecureRandom.uuid, name: event_name, payload: payload }\n end", "def store_event( event )\n\t\ttime = event.delete( '@timestamp' )\n\t\ttype = event.delete( '@type' )\n\t\tversion = event.delete( '@version' )\n\n\t\tdata = JSON.generate( event )\n\t\theaders = {\n\t\t\ttime: time,\n\t\t\ttype: type,\n\t\t\tversion: version,\n\t\t\tcontent_type: 'application/json',\n\t\t\tcontent_encoding: data.encoding.name,\n\t\t\ttimestamp: Time.now.to_f,\n\t\t}\n\n\t\t@amqp_exchange.value.publish( data, headers )\n\tend", "def post( event )\n if @thread && @conditions[ event.event_class ]\n set_event_status(event, :pending )\n @event_queue.push event\n CFSM.logger.info \"Event #{event.inspect} posted to #{namespace}\"\n process_event if @thread==true\n end\n end", "def publish(event, payload = {})\n exchange.publish(MultiJson.dump(payload), routing_key: event, content_type: 'application/json')\n end", "def publish(event, *arguments)\n subscribers.each do |subscriber|\n if subscriber.respond_to?(:notify)\n subscriber.notify(event, *arguments)\n end\n end\n end", "def on_publish(ptr, _, packet_id)\n @events << {\n type: :publish,\n packet_id: packet_id,\n }\n end", "def _publish(event, url)\n publish(event, url)\n end", "def enqueue(payload)\n @queue.publish(JSON.generate(payload), :routing_key => @queue.name)\n end", "def publish(message)\n # TODO: queue name and configuration should be in a config file\n @out_exchange.publish(message, :persistent => true, :key => \"esperfooin\", :mandatory => true)\n end", "def publish(event)\n event_key = publisher_key if protocol == :http\n event_key ||= event.name.split('.').last\n publish_operation_name = publish_operation_name_for(event_key)\n\n logger.debug \"Publisher#publish publish_operation_name: #{publish_operation_name}\"\n publish_operation = find_publish_operation_for(publish_operation_name)\n publish_operation.call(event.payload, {headers: event.headers})\n end", "def call event\n puts \"Transport published `#{event.type}` to \\\"#{event.topic}\\\" (from \\\"#{event.originator}\\\", #{event.args.size} args, #{event.kwargs.size} kwargs).\" if @print_debug\n # Publish the event across the session\n @session.publish(event.topic, event.args, { event: event.type, originator: event.originator }.merge(event.kwargs))\n # This is a pass-through middleware, so proxy the event up.\n fire(event)\n end", "def publish(queue_name,job)\n queue = queue(queue_name)\n queue.send_message(message_body: encode_job(job))\n end", "def publish\n set_publish_state(Event::PUBLISHED_STATE)\n end", "def publish(event_name:, event_data:, channel_name: :global)\n channel = get_channel(name: channel_name)\n channel.publish(event_name: event_name, event_data: event_data)\n end", "def publish( eventname )\n\t\t\tdelivery_info = OpenStruct.new( routing_key: eventname )\n\t\t\tproperties = OpenStruct.new( content_type: 'application/json' )\n\n\t\t\tmetadata = {\n\t\t\t\tdelivery_info: delivery_info,\n\t\t\t\tproperties: properties,\n\t\t\t\tcontent_type: properties.content_type,\n\t\t\t}\n\n\t\t\tpayload = '[]'\n\t\t\treturn task.work( payload, metadata )\n\t\tend", "def queue_event (event, *args)\n\n #ldebug { \"queue_event() :#{event}\" }\n\n return if event == :stop\n return if event == :launch\n return if event == :reschedule\n\n wfid = extract_fei(args[0]).parent_wfid\n #\n # maybe args[0] could be a FlowExpression instead\n # of a FlowExpressionId instance\n #puts \"___#{event}__wfid : #{wfid}\"\n\n e = serialize_event(event, *args)\n\n bucket = nil\n\n synchronize do\n\n bucket = get_bucket(wfid)\n bucket << e\n\n #ldebug { \"queue_event() bucket : #{bucket.object_id}\" }\n\n if event == :terminate\n\n bucket.flush\n @buckets.delete(wfid)\n end\n end\n #\n # minimizing the sync block\n\n # TODO : spin that off this thread, to the\n # flush thread...\n #\n if event == :terminate\n if @application_context[:keep_journals] == true\n #\n # 'move' journal to the done/ subdir of journal/\n #\n FileUtils.cp(\n bucket.path,\n @donedir + \"/\" + File.basename(bucket.path))\n end\n FileUtils.rm bucket.path\n end\n end", "def enqueue(payload)\n @queue.publish(payload.encode, :persistent => true)\n end", "def publish(data)\n @consumer_channel.push data\n end", "def publish_to_queue(queue, message)\n logger.debug \"Publisher #{self.class.name} sending message: #{message.to_json}\"\n queue.send_message(Base64.encode64(message.to_json))\n end", "def publish(event, *event_args)\n ::GDO::Core::Log.debug(\"GDO::Core::WithEvents.publish(#{event}, #{event_args.inspect})\")\n event_subscriptions(event).each do |identifier, subscription|\n ::GDO::Core::Log.verbose(display_publish_consumed(event, subscription))\n begin\n subscription.call(*event_args)\n rescue => e # log and rethrow\n ::GDO::Core::Log.exception(e)\n raise e\n end\n end\n end", "def notify(bucket)\n @queue.push({:Event => \"New Message\", :Bucket => bucket})\n end", "def publish(event, *args)\n if to_notify = @callbacks[event]\n to_notify.each { |callback| callback.call(*args) rescue nil }\n end\n end", "def publish_to(exname, message, opts={})\n EventMachine.schedule {\n ex = amq.exchanges[exname] || raise(\"Undefined exchange name : #{exname}\")\n case ex.type\n when :topic\n unless opts.has_key? :key\n opts[:key] = '*'\n end\n end\n ex.publish(Serializer.instance.marshal(message), opts)\n }\n end", "def post( event )\n raise CFSM::EventDoesNotHaveExpiry.new(event) if event.expiry.nil?\n\n # Start the wait thread once we have something to wait for.\n start_wait_thread if @wait_thread.nil?\n\n @queue_mutex.synchronize do\n self.push event\n event.instance_exec { set_status(:delayed) }\n end\n CFSM.logger.info \"Pushed delayed event #{event.inspect}\"\n @wait_thread.wakeup if self.length > 0 && self.first == event\n end", "def publish(name, context = {})\n redis.publish \"event:#{name}\", MultiJson.dump(context)\n end", "def publish\n @event = Event.find_by_id(params[:event_id].to_i)\n if @event != nil && [email protected]\n if [email protected]\n @event.published = true\n @event.published_date = Time.now\n if @event.save\n # send push notifications\n # send_push_notification_to_members(\"New Event Posted - #{@event.name}\")\n\n # email members about new even posting\n email_members(\"New Event Posted - #{@event.name}\",\n \"<p>A new #{@event.event_type.title.downcase} event has been posted on the BendroCorp Dashboard called <b>#{@event.name}</b> with the following description:</p><p>#{@event.description}</p>If you would like more information on this event please visit the events page on the BendroCorp Dashboard.\")\n\n # # send push notifications\n # send_push_notification_to_members(\"Full event details for #{@event.name} have been published!\")\n\n # emit event\n EventStreamWorker.perform_async('event-publish', @event)\n\n render status: 200, json: @event\n else\n render status: 500, json: { message: \"Error: Event could not be published...check the data you entered.\" }\n end\n else\n render status: 403, json: { message: \"This event has already been published you can not publish an event which has already been published.\" }\n end\n else\n render status: 404, json: { message: \"Event not found.\" }\n end\n end", "def add_event(event)\n @queue[event.key] = EventData.new(event)\n end", "def publish(stream, event_name, data)\n stream = stream_name(stream)\n connection.xadd(stream, { \"#{event_name}\": data })\n end", "def issueEvent\n loop do\n [email protected]\n changed\n notify_observers(event[0],event[1],event[2],event[3])\n end\n end", "def arm_publish(event, *args)\n arm_globe.signal(self, event, args)\n self\n end", "def entry(event)\n queues.each do |q|\n q.register_stat(q.state, event.time - @current_time) # register stat for all queues (time count)\n end\n q = event.queue\n @current_time = event.time\n @current_event = event\n if q.state < q.capacity\n q.register_entry\n if q.state <= q.servers\n connections = @network.get_connections(q) # get all connections for queue\n connection = select_connection(connections) # handles probabilities\n event_type = connection.nil? ? \"exit\" : \"transfer\" # sets type for scheduling event\n @scheduler.schedule(event_type, (@current_time + @random.next_in_range(q.min_service, q.max_service)), q, connection) # schedules event\n raise OutOfRandomsError if @random.see_next < 0\n end\n else\n q.register_loss # if queue is full, register loss\n end\n @scheduler.schedule(\"entry\", (@current_time + @random.next_in_range(q.min_arrival, q.max_arrival)), q) # schedule next entry\n raise OutOfRandomsError if @random.see_next < 0\n end", "def schedule_write(event)\n EM.schedule do\n @stream << event\n unless @stream_callbacks.empty?\n @stream_callbacks.shift.call(@stream.shift)\n end\n end\n end", "def push(event)\n @events.push(event)\n end", "def push(message)\n @queue.push(message)\n end", "def deliver(message)\n @queue.push(message)\n end", "def publish(message)\n envelope = @transport.create_message(message, @serializer)\n data = @serializer.serialize(envelope)\n #queue = type, but messageType needs env.messageType = \"urn:message:\" + env.messageType\n q_name = (message.messageType || data.class.name.gsub(\"::\",\".\"))\n @transport.publish(q_name,data,:headers=> {\"Content-Type\"=>\"application/vnd.masstransit+json\"}) #exchange?\n #@transport.publish(q_name,data) #exchange?\n end", "def publish(event_name, data = nil)\n @logger.info \"[#{event_name}] #{data[:key]}\"\n end", "def safe_publish(e)\n on_exchange do |exchange|\n exchange.publish(e.to_json, :routing_key => @routing_key)\n end\n end", "def publish(queue_name, object)\n amq = MQ.new\n amq.queue(queue_name).publish(serialize(object))\n end", "def <<(event)\n name, value, time = event.get(\"message\").split(\" \")\n event.set(name, value.to_f)\n\n if time != \"N\"\n event.timestamp = LogStash::Timestamp.at(time.to_i)\n end\n\n @queue << event\n end", "def publish( message )\n subscribers.each do |name, subscriber|\n subscriber.produce( message )\n end\n end", "def publish(routing_key, payload = {}, options = {})\n raise Traffiq::NoExchangeError.new if @exchange.nil?\n bind_queue(routing_key) if options[:bind_to_queue]\n @exchange.publish(MultiJson.dump(payload), routing_key: routing_key, persistent: true)\n end", "def publish(message, headers = {})\n message = message.to_json unless message.is_a?(String)\n client.publish(\"/queue/#{queue}\", message, { priority: 4, persistent: true }.merge(headers))\n end", "def publish_queued_task(name, cur_publish_on, options={})\n cur_publish_on = Time.now + cur_publish_on if cur_publish_on.kind_of?(Fixnum)\n raise \"Expected Time type. Got:\" + cur_publish_on.class.name unless cur_publish_on.kind_of?(Time)\n queued_task_class.publish(name, cur_publish_on, {:actor => self}.merge(options))\n end", "def emit_event(event)\n log.trace \"in_sendgrid_event: emit_event\"\n router.emit(\"#{tag}\", Fluent::EventTime.now, event)\n end", "def broadcast(message)\n @channel.default_exchange.publish(message, routing_key: @queue.name)\n end", "def publish(object)\n @channel << object\n end", "def notify(msg)\n @room_queue.push(msg)\n end", "def handle_publish(client, data)\n topic_uri, payload, exclude, include = data\n\n @engine.create_event(client, topic_uri, payload, exclude, include)\n\n trigger(:publish, client, topic_uri, payload, exclude, include)\n end", "def publish(channel, message); end", "def publish(channel, message); end", "def queue_event(message)\n formatted_classification = @formatter.format_classification(message)\n #TODO: stream this to a file via the logger!\n # look at fluentd to read the log and create a s3 batch file!\n log_event(formatted_classification.to_s)\n end", "def send\n @sent_at = Time.now\n sender.publish(data, meta)\n self\n end", "def publish msg\n @conn.send_data :opcode => PUBLISH, :channel => @name, :data => msg.to_s\n end", "def work(message)\n if message.is_a?(Message)\n exchange.publish(message.body, routing_key: message.to,\n persistent: !Proletariat.test_mode?,\n headers: message.headers)\n end\n end", "def deliver\n @queue << self\n end", "def send_event(event)\n each { |actor| actor.mailbox.system_event event }\n end", "def send_message( message )\n\t\tself.send_queue << message\n\t\tself.reactor.enable_events( self.socket, :write ) unless\n\t\t\tself.reactor.event_enabled?( self.socket, :write )\n\tend", "def deliver(data)\n @queue.enq data\n end", "def put( queueid, event )\n if @connected \n res = @conn.exec(\"insert into queues (queueid, event, status ) values ( #{queueid}, '#{event.serialize}', #{EV_READY} )\")\n else\n raise DBError, \"Not connected\"\n end\n end", "def subscribeTo (event)\r\n @subscribedEvents.add(event)\r\n end", "def work(raw_post)\n puts \"Msg received: \" + raw_post\n ack! # we need to let queue know that message was received\n end", "def queue(message); end", "def next_event\n @queue.pop\n end", "def deliver(event)\n Webhook::DeliveryJob.perform_later(id, event.to_json)\n end", "def push(x)\n @queue << x\n end", "def publish(node, message, host, &block)\n pubsub.publish(node, message, host, &callback_logging(__method__, node, message.operation, &block))\n end", "def publish(message)\n SideJob.publish \"/sidejob/job/#{id}\", message\n end", "def mq_send(message, arg = nil)\n AMQP.start(:host => opt.mq_host) do |connection|\n channel = AMQP::Channel.new(connection)\n logger.info \"Publish message to RabbitMQ '#{message}' with arg '#{arg}' to '#{opt.mq_queue}'...\"\n channel.default_exchange.publish({:msg => message, :arg => arg}.to_json, :routing_key => opt.mq_queue)\n EM.add_timer(0.5) { mq_disconnect(connection) }\n end\n end", "def publish(connection)\n #\t4. Communication session\n channel = connection.create_channel\n # 5 Declare queue\n channel.queue(DELAYED_QUEUE, arguments: { \"x-dead-letter-exchange\" => \"\", \"x-dead-letter-routing-key\" => DESTINATION_QUEUE, \"x-message-ttl\" => 300000})\n\n # 6. Publish a message\n channel.default_exchange.publish \"message content\", routing_key:\n DELAYED_QUEUE\n puts \"#{Time.now}: Published the message\"\n channel.close\nend", "def publish(message, name)\n logger.debug \"AMQP publishing `#{message}` to exchange `#{name}`\"\n publish_channel.fanout(name, :auto_delete => true).publish(message)\n end", "def queue_msg(msg)\n dispatch_msg(msg)\n end", "def message(event)\n msg = JSON.parse(event.data, :symbolize_names => true) rescue {}\n seq = msg[:message_sequence]\n if msg[:ping] == 'PING'\n Firehose.logger.debug \"WS ping received, sending pong\"\n @ws.send JSON.generate :pong => 'PONG'\n elsif !@subscribed && seq.kind_of?(Integer)\n Firehose.logger.debug \"Subscribing at message_sequence #{seq}\"\n subscribe seq\n end\n end", "def publish(payload, routing_key = AMQ::Protocol::EMPTY_STRING, user_headers = {}, mandatory = false, immediate = false, frame_size = nil)\n headers = { :priority => 0, :delivery_mode => 2, :content_type => \"application/octet-stream\" }.merge(user_headers)\n @client.send_frameset(Protocol::Basic::Publish.encode(@channel.id, payload, headers, @name, routing_key, mandatory, immediate, (frame_size || @client.connection.frame_max)))\n\n self\n end", "def publish(stream, message)\n @logger.tagged('publisher') do\n @redis_pool.with do |redis|\n redis.xadd(stream, payload: @serializer.serialize(message, stream))\n end\n @logger.debug { \"published to stream #{stream}: #{message.inspect}\" }\n end\n end", "def publish_to_feed(key, msg)\n event = Chronologic::Event.new(\n key: key,\n data: { type: \"message\", message: \"#{msg}\"},\n timelines: [\"group:#{self.group.id}\", \"project:#{self.id}\"],\n objects: { group: \"group:#{self.group.id}\", project: \"project:#{self.id}\" }\n )\n $feed.publish(event, true, Time.now.utc.tv_sec)\n end", "def publish(channel, data)\n send_action('publish', channel, data)\n end", "def publish(message, key)\n @exchange.publish(message.to_json, :routing_key => key)\n end", "def queue_out\n @channel.queue('out', durable: true)\n end", "def queue_out\n @channel.queue('out', durable: true)\n end", "def subscribe(event_name, &block) # rubocop:disable Metrics/MethodLength\n @subscribers << Subscriber.new(event_name, block, @logger)\n\n return if thread_spawned?\n thread_spawned!\n\n Thread.new do\n loop do\n @redis.with do |conn|\n message = conn.brpoplpush(@stream, EVENT_STORE)\n call_subscribers(\n serializer.deserialize(message)\n )\n end\n end\n end\n end", "def dispatch(payload)\n queue.push(payload)\n end" ]
[ "0.8039173", "0.77513444", "0.74168557", "0.74051875", "0.73826945", "0.7163963", "0.7132995", "0.7132995", "0.7105684", "0.7042068", "0.69849694", "0.6973809", "0.69404465", "0.69388026", "0.6871741", "0.6835738", "0.6757857", "0.67524415", "0.6705046", "0.66898024", "0.6688803", "0.6685324", "0.66745734", "0.66548014", "0.6651714", "0.66336405", "0.65818655", "0.6577326", "0.6547211", "0.65308577", "0.6513601", "0.65041345", "0.6481418", "0.64674103", "0.64593893", "0.6444952", "0.64411795", "0.6429796", "0.64227456", "0.6398769", "0.63901085", "0.63763326", "0.637324", "0.6364346", "0.63414717", "0.6318418", "0.62998676", "0.62963647", "0.62757975", "0.6250726", "0.6238489", "0.6231985", "0.62193346", "0.62126184", "0.6210702", "0.6198274", "0.61871594", "0.6141119", "0.61251813", "0.61163086", "0.61037505", "0.6094056", "0.6079145", "0.60747385", "0.6064075", "0.6050647", "0.6016571", "0.5967281", "0.5967281", "0.59570044", "0.59535635", "0.5950875", "0.5945507", "0.59274656", "0.5926884", "0.5922142", "0.5921233", "0.59164923", "0.5909602", "0.58937657", "0.5888494", "0.5884255", "0.5873572", "0.5862422", "0.5853042", "0.5849495", "0.58303565", "0.5798457", "0.5797204", "0.57779473", "0.5772536", "0.57674134", "0.57658213", "0.5748991", "0.5742878", "0.57406", "0.57368755", "0.57368755", "0.5723579", "0.5723362" ]
0.76841867
2
Listen for an event from the queue
def listen(&block) queue.bind(exchange).subscribe do |delivery_info, metadata, event| block.call(event) end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_event event\n @event_queue << event\n end", "def setup_queue_listener\n service_queue.subscribe(:block => true) do |info, properties, payload|\n log.debug \"Received message: #{payload}...\"\n @return_info = nil\n rpc_wrapper.call { process(info, properties, payload) }\n end\n end", "def handle_queue_event(queue, id) # :nodoc: all\n # Time to process a new queue event.\n # If we get a callback for an ID we don't know about, don't worry -\n # just ignore it. It may be for a query we've already completed.\n #\n # So, get the next response from the queue (presuming there is one!)\n #\n # @TODO@ Tick could poll the queue and then call this method if needed - no need for observer interface.\n # @TODO@ Currently, tick and handle_queue_event called from select_thread - could have thread chuck events in to tick_queue. But then, clients would have to call in on other thread!\n #\n # So - two types of response :\n # 1) we've got a coherent response (or error) - stop sending more packets for that query!\n # 2) we've validated the response - it's ready to be sent to the client\n #\n # so need two more methods :\n # handleValidationResponse : basically calls send_result_and_stop_querying and\n # handleValidationError : does the same as handleValidationResponse, but for errors\n # can leave handleError alone\n # but need to change handleResponse to stop sending, rather than send_result_and_stop_querying.\n #\n # @TODO@ Also, we could really do with a MaxValidationTimeout - if validation not OK within\n # this time, then raise Timeout (and stop validation)?\n #\n # @TODO@ Also, should there be some facility to stop validator following same chain\n # concurrently?\n #\n # @TODO@ Also, should have option to speak only to configured resolvers (not follow authoritative chain)\n #\n if queue.empty?\n Dnsruby.log_and_raise('Severe internal error - Queue empty in handle_queue_event')\n end\n event_id, event_type, response, error = queue.pop\n # We should remove this packet from the list of outstanding packets for this query\n _resolver, _msg, client_query_id, _retry_count = id\n if id != event_id\n Dnsruby.log_and_raise(\"Serious internal error!! #{id} expected, #{event_id} received\")\n end\n # @mutex.synchronize{\n @parent.single_res_mutex.synchronize {\n if @query_list[client_query_id] == nil\n # print \"Dead query response - ignoring\\n\"\n Dnsruby.log.debug{'Ignoring response for dead query'}\n return\n end\n _msg, _client_queue, _select_queue, outstanding = @query_list[client_query_id]\n if event_type == Resolver::EventType::RECEIVED ||\n event_type == Resolver::EventType::ERROR\n unless outstanding.include?(id)\n Dnsruby.log.error(\"Query id not on outstanding list! #{outstanding.length} items. #{id} not on #{outstanding}\")\n end\n outstanding.delete(id)\n end\n # }\n if event_type == Resolver::EventType::RECEIVED\n # if (event.kind_of?(Exception))\n if error\n handle_error_response(queue, event_id, error, response)\n else # if event.kind_of?(Message)\n handle_response(queue, event_id, response)\n # else\n # Dnsruby.log.error('Random object #{event.class} returned through queue to Resolver')\n end\n elsif event_type == Resolver::EventType::VALIDATED\n if error\n handle_validation_error(queue, event_id, error, response)\n else\n handle_validation_response(queue, event_id, response)\n end\n elsif event_type == Resolver::EventType::ERROR\n handle_error_response(queue, event_id, error, response)\n else\n # print \"ERROR - UNKNOWN EVENT TYPE IN RESOLVER : #{event_type}\\n\"\n TheLog.error(\"ERROR - UNKNOWN EVENT TYPE IN RESOLVER : #{event_type}\")\n end\n }\n end", "def monitor_events\n event_monitor_running\n event_monitor_handle.start do |event|\n @queue.enq(event)\n end\n ensure\n stop_event_monitor\n end", "def issueEvent\n loop do\n [email protected]\n changed\n notify_observers(event[0],event[1],event[2],event[3])\n end\n end", "def next_event\n @queue.pop\n end", "def handle_queue_event(queue, id) #:nodoc: all\r\n # If we get a callback for an ID we don't know about, don't worry -\r\n # just ignore it. It may be for a query we've already completed.\r\n # \r\n # So, get the next response from the queue (presuming there is one!)\r\n #\r\n # @TODO@ Tick could poll the queue and then call this method if needed - no need for observer interface.\r\n # @TODO@ Currently, tick and handle_queue_event called from select_thread - could have thread chuck events in to tick_queue. But then, clients would have to call in on other thread!\r\n #\r\n if (queue.empty?)\r\n TheLog.fatal(\"Queue empty in handle_queue_event!\")\r\n raise RuntimeError.new(\"Severe internal error - Queue empty in handle_queue_event\")\r\n end\r\n event_id, response, error = queue.pop\r\n # We should remove this packet from the list of outstanding packets for this query\r\n resolver, msg, client_query_id, retry_count = id\r\n if (id != event_id)\r\n TheLog.error(\"Serious internal error!! #{id} expected, #{event_id} received\")\r\n raise RuntimeError.new(\"Serious internal error!! #{id} expected, #{event_id} received\")\r\n end\r\n @mutex.synchronize{\r\n if (@query_list[client_query_id]==nil)\r\n TheLog.debug(\"Ignoring response for dead query\")\r\n return\r\n end\r\n msg, client_queue, select_queue, outstanding = @query_list[client_query_id]\r\n if (!outstanding.include?id)\r\n TheLog.error(\"Query id not on outstanding list! #{outstanding.length} items. #{id} not on #{outstanding}\")\r\n raise RuntimeError.new(\"Query id not on outstanding!\")\r\n end\r\n outstanding.delete(id)\r\n }\r\n # if (event.kind_of?(Exception))\r\n if (error != nil)\r\n handle_error_response(queue, event_id, error, response)\r\n else # if (event.kind_of?(Message))\r\n handle_response(queue, event_id, response)\r\n # else\r\n # TheLog.error(\"Random object #{event.class} returned through queue to Resolver\")\r\n end\r\n end", "def listen_for_messages\n @queue.subscribe do |_delivery_info, _metad5ata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end", "def wait_for_event\n q = @vm.eventQueue()\n while(true)\n event_set = q.remove()\n it = event_set.iterator()\n while(it.hasNext)\n event = it.next\n $DEBUG and puts(\"Received an event: #{event.java_class}\")\n @frame = AndroidDebug::Jpda::Frame.new(event.thread.frame(0), event.location)\n @this = @frame.this\n return(AndroidDebug::Jpda::Event.new(event))\n end \n end\n end", "def handle_event(event)\n logger.warn(\"Isimud::EventObserver#handle_event not implemented for #{event_queue_name}\")\n end", "def receive_message(queue_name, message)\n listener = listeners[queue_name]\n raise_dispatch_error(message) unless listener\n listener.dispatch(message)\n end", "def push(event:)\n super\n\n @queue << event\n end", "def listen\n @queue.subscribe(block: true) do |delivery_info, properties, body|\n puts(body)\n end\n end", "def listen\n amqp_listen do |msg|\n do_handle(msg)\n end\n end", "def handle(event)\n return unless event.name == @subscribed_event_name\n @listener.call(*event.args)\n end", "def dispatch_events!\n loop do\n event = @event_queue.pop\n\n callbacks.each do |callback|\n Thread.new do\n callback.call event\n end\n end\n end\n end", "def run\n return unless @mutex.try_lock\n until @event_queue.empty? or not @running\n if @event_queue.length > 1\n log \"#{@event_queue} commands in queue\", Logger::Medium\n end\n handle_event(@event_queue.pop)\n end\n @mutex.unlock\n end", "def get_event_callback\n Proc.new do |new_packets, refCon_ptr, connRefCon_ptr|\n begin\n # p \"packets received: #{new_packets[:numPackets]}\"\n timestamp = Time.now.to_f\n messages = get_messages(new_packets)\n # SINM ADDED\n @queue.push(messages.map do |message|\n enqueue_message(message, timestamp)\n end.compact)\n # SINM COMMENTED OUT\n # messages.each { |message| enqueue_message(message, timestamp) }\n rescue Exception => exception\n Thread.main.raise(exception)\n end\n end\n end", "def on_queue(url)\n true\n end", "def call(event)\n client.send_message(queue_url: queue_url, message_body: event)\n end", "def call(event)\n client.send_message(queue_url: queue_url, message_body: event)\n end", "def worker\n @fsevent\n end", "def process_next_gevent\r\n #@log.info \"Process next event\"\r\n return if @suspend_queue_proc == true\r\n while @proc_queue.size > 0\r\n next_ev_handl = @proc_queue.pop\r\n send(next_ev_handl)\r\n return if @suspend_queue_proc == true\r\n end\r\n \r\n end", "def on_event(&listener)\n @lock.lock\n @event_listeners += [listener]\n ensure\n @lock.unlock\n end", "def post(ev)\n\t\t@queue << ev\n\tend", "def <<(event)\n @mutex.synchronize { @queue << event }\n self\n end", "def onMessage(event)\n type, client_id = event.getMessageObject().split(':')\n case type\n when 'message'\n @engine.empty_queue(client_id)\n when 'disconnect'\n @engine.server.trigger(:close, client_id)\n else\n @engine.server.debug 'Unknown event ?', type\n end\n end", "def event_bus; end", "def event_bus; end", "def listen_for_messages\n queue = @channel.queue(\"\")\n\n queue.bind(@exchange).subscribe do |delivery_info, metadata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end", "def poll\n Logger.debug(klass: self.class, name: 'kqueue poller', message: 'calling kevent')\n t = shortest_timeout\n rc = Platforms.kevent(@kq_fd, @events[0], @change_count, @events[0], MAX_EVENTS, shortest_timeout)\n @change_count = 0\n Logger.debug(klass: self.class, name: 'kqueue poller', message: \"kevent returned [#{rc}] events!\")\n\n if rc >= 0\n rc.times { |index| process_event(event: @events[index]) }\n else\n Logger.debug(klass: self.class, name: 'kqueue poller', message: \"rc [#{rc}], errno [#{::FFI.errno}]\")\n end\n end", "def dispatch event\n raise Exception.new(\"workers cannot dispatch while blocked\") if blocked?\n @event = event\n @is_running = true\n \n self.resume event\n end", "def monitor_events\n event_monitor_handle.start\n event_monitor_handle.each_batch do |events|\n event_monitor_running\n if events && !events.empty?\n @queue.enq events\n end\n sleep_poll_normal\n end\n ensure\n reset_event_monitor_handle\n end", "def run_event_loop\n while true\n event = @event_queue.pop\n @worker_pool.dispatch event\n \n if @stopped\n Thread.stop;\n return\n end\n end\n end", "def observe_events(client)\n return unless enable_listener?\n queue = create_queue(client)\n client.subscribe(queue) do |message|\n event = Event.parse(message)\n handle_event(event)\n end\n end", "def handle\n @queue << \"handle\"\n end", "def handle_event(event)\n\n\t\tend", "def listen(topic_name, options = {}, &message_processor)\n QueueListener.listen(aws_client, config, topic_name, options, &message_processor)\n end", "def entry(event)\n queues.each do |q|\n q.register_stat(q.state, event.time - @current_time) # register stat for all queues (time count)\n end\n q = event.queue\n @current_time = event.time\n @current_event = event\n if q.state < q.capacity\n q.register_entry\n if q.state <= q.servers\n connections = @network.get_connections(q) # get all connections for queue\n connection = select_connection(connections) # handles probabilities\n event_type = connection.nil? ? \"exit\" : \"transfer\" # sets type for scheduling event\n @scheduler.schedule(event_type, (@current_time + @random.next_in_range(q.min_service, q.max_service)), q, connection) # schedules event\n raise OutOfRandomsError if @random.see_next < 0\n end\n else\n q.register_loss # if queue is full, register loss\n end\n @scheduler.schedule(\"entry\", (@current_time + @random.next_in_range(q.min_arrival, q.max_arrival)), q) # schedule next entry\n raise OutOfRandomsError if @random.see_next < 0\n end", "def queue_event (event, *args)\n\n #ldebug { \"queue_event() :#{event}\" }\n\n return if event == :stop\n return if event == :launch\n return if event == :reschedule\n\n wfid = extract_fei(args[0]).parent_wfid\n #\n # maybe args[0] could be a FlowExpression instead\n # of a FlowExpressionId instance\n #puts \"___#{event}__wfid : #{wfid}\"\n\n e = serialize_event(event, *args)\n\n bucket = nil\n\n synchronize do\n\n bucket = get_bucket(wfid)\n bucket << e\n\n #ldebug { \"queue_event() bucket : #{bucket.object_id}\" }\n\n if event == :terminate\n\n bucket.flush\n @buckets.delete(wfid)\n end\n end\n #\n # minimizing the sync block\n\n # TODO : spin that off this thread, to the\n # flush thread...\n #\n if event == :terminate\n if @application_context[:keep_journals] == true\n #\n # 'move' journal to the done/ subdir of journal/\n #\n FileUtils.cp(\n bucket.path,\n @donedir + \"/\" + File.basename(bucket.path))\n end\n FileUtils.rm bucket.path\n end\n end", "def work(raw_post)\n puts \"Msg received: \" + raw_post\n ack! # we need to let queue know that message was received\n end", "def event_handler(event)\n case event.command\n when :shutdown\n shutdown_handler(event)\n @run = false\n when :perform\n perform_handler(event)\n else\n raise Workers::UnknownEventError, \"Unhandled event (#{event.inspect}).\"\n end\n\n nil\n end", "def register_listener(queue_name, listener = nil, &block)\n array_dispatcher = (listeners[queue_name] ||= ArrayMessageDispatcher.new)\n array_dispatcher.add_dispatcher MessageDispatcher.new(block.nil? ? listener : block)\n queue_manager.listen(queue_name)\n end", "def signal_queue; end", "def add_received_message_callback(queue=received_message_queue,&block)\n @received_thread = Thread.new do\n poll_queue(queue,&block)\n end\n end", "def amqp_listen\n @listener = \"client.#{::Kernel.rand(999_999_999_999)}\"\n Thread.new(self) do \n AMQP.start(:host => @host) do\n _notify = MQ.fanout(@x_notify)\n puts \"[amqp_listen] starting listener on #{Thread.current}\" if $DEBUG\n MQ.queue(@listener, :auto_delete => true).bind(_notify).subscribe{ |msg| yield msg }\n end \n end\n end", "def add_event(event)\n @queue[event.key] = EventData.new(event)\n end", "def process\n read_events.each {|event| event.callback!}\n end", "def dispatch event\n @dispatch_fiber.resume event\n end", "def handler\r\n\t loop do \r\n\t socket = @rqueue.pop\r\n\t req = Request.new socket \r\n\t if req.broadcast == true\r\n\t handle_broadcast req \r\n\t else\r\n\t handle_listen req\r\n\t end\r\n\t \r\n\t end\r\n \tend", "def process\n river = Pebblebed::River.new\n queue_options = {\n :name => \"#{@app_name}.security_listener\",\n :path => '**',\n :klass => 'access_group|access_group_membership|access_group_subtree',\n :event => '**',\n :interval => 1\n }\n queue = river.queue queue_options\n queue.subscribe(block: true) do |delivery_info, metadata, payload|\n consider({:payload => payload})\n end\n end", "def post( event )\n if @thread && @conditions[ event.event_class ]\n set_event_status(event, :pending )\n @event_queue.push event\n CFSM.logger.info \"Event #{event.inspect} posted to #{namespace}\"\n process_event if @thread==true\n end\n end", "def listener; end", "def subscribe(event_name, &block) # rubocop:disable Metrics/MethodLength\n @subscribers << Subscriber.new(event_name, block, @logger)\n\n return if thread_spawned?\n thread_spawned!\n\n Thread.new do\n loop do\n @redis.with do |conn|\n message = conn.brpoplpush(@stream, EVENT_STORE)\n call_subscribers(\n serializer.deserialize(message)\n )\n end\n end\n end\n end", "def listen \n response.headers[\"Content-Type\"] = \"text/event-stream\"\n redis = Redis.new\n\n key = \"/node/#{params[:event_id]}:change\"\n logger.info \"listen #{key}\"\n redis.subscribe(key) do |on|\n on.message do |event, data|\n response.stream.write \"event: update\\n\"\n response.stream.write \"data: \"+data+\"\\n\\n\"\n end\n end\n\n rescue IOError \n # Client disconnected\n ensure \n response.stream.close\n end", "def listen\n Thread.new { EventMachine.run } unless EventMachine.reactor_running?\n jack.each_job(2) do |job|\n job = Job.new(job.conn, job.jobid, job.body)\n EventMachine.defer proc { process(job) }, proc {|res| raise(res) if res.kind_of?(Exception) }\n end\n end", "def listen\n Thread.new do\n while true\n retrieve_messages\n sleep (0.1)\n end\n end\n end", "def process_queue\n puts \"Waiting for new messages\"\n th = Thread.new do\n Thread.current.abort_on_exception = true\n loop do\n # This will sit around and wait forever.\n key, raw_msg = @redis_client.blpop(@redis_in_key, 0)\n json_msg = Crack::JSON.parse(raw_msg)\n # Send back a random quote\n random_quote = @quotes[rand(@quotes.size)]\n out_msg = {:from => json_msg['from'], :body => random_quote}.to_json\n # Pusing onto the \"out\" list queues up something for the listener to process\n @redis_client.lpush(@redis_out_key, out_msg)\n end\n end \n end", "def queue_ready(queue)\n @queue = queue\n @queue.bind(@exchange, :routing_key => @routing_key) do |binding_ok|\n @queue.subscribe(:ack => true, &method(:message_received))\n self.succeed\n end\n end", "def event_received(sequence)\n false # return true if we handled the event here\n end", "def listen\n em_run do\n end\n end", "def update_event(event)\n key = event.key\n return unless @queue.has_key?(key)\n @updated_keys << key\n end", "def listen\n # TODO\n self\n end", "def handle_message(message)\n if @response_wait_list.waiting_for?(message)\n @response_wait_list.received(message)\n else\n @listener.receive_message(message)\n end\n end", "def listener message\n p message\n case message.downcase\n # add own messages\n when \"start\"\n puts 'Starting'\n when \"end\"\n puts 'Ending'\n stop\n exit 0\n else\n puts \"unknown message:#{message}\"\n end\n publish \"ack\"\n end", "def run\n @connection.queue do |queue|\n puts(\"Client started. Listening on queue “#{queue.name}”.\")\n begin\n queue.listen do |message|\n puts(message)\n end\n rescue Interrupt\n return\n end\n end\n end", "def queue_msg(msg)\n dispatch_msg(msg)\n end", "def on_enqueued\n @flow_lock.synchronize do\n return if @on_enqueued_invoked\n\n @on_enqueued_invoked = true\n\n yield(@first_message, @last_message)\n end\n end", "def handle_event(data)\n topic = data[1]\n payload = data[2]\n\n trigger(:event, self, topic, payload)\n end", "def on evt, bool = false, &b\n each do |q|\n q.add_event_listener evt.to_s, bool, &b\n end\n \n return nil\n end", "def receive(number)\n puts \"received number #{number}\"\n @queue << number\n end", "def listening?; end", "def make_queue\n # Create EventQueue with new-style events (added in Rubygame 2.4)\n @queue = EventQueue.new()\n @queue.enable_new_style_events\n end", "def subscribeTo (event)\r\n @subscribedEvents.add(event)\r\n end", "def start\n queue = channel.queue(\"\", :exclusive => true, :auto_delete => true)\n queue.bind(exchange_in, :routing_key => consumer.routing_key)\n queue.subscribe(&method(:handle_message))\n logger.info \"Bind queue with routing key '#{consumer.routing_key}' to exchange '#{exchange_in.name}', waiting for messages...\"\n end", "def listen\r\n end", "def queue(message); end", "def go\n while(true)\n process_event(wait_for_event)\n end\n end", "def broadcast(event_name, payload)\n @event_queue << { id: SecureRandom.uuid, name: event_name, payload: payload }\n end", "def listen\n consumers = input.map do |queue|\n consume queue\n end\n close_after consumers\n end", "def run\n @logger.info 'Running'\n @thread_status = :running\n\n register_self_with_zk\n register_callbacks\n watch\n loop do\n queue_event = @queue.pop\n GracefulTrap.critical_section(%w(INT TERM), @logger) do\n process_queue_event(\n queue_event[:type],\n queue_event[:value],\n queue_event[:meta]\n )\n end\n end\n @thread_status = :stopped\n end", "def subscribe(&onMessage) # block\n end", "def listen(p0) end", "def listen(p0) end", "def listen(p0) end", "def receive_message\n sqs = Aws::SQS::Client.new(region: ENV['AWS_REGION'])\n resp = sqs.receive_message(queue_url: ENV['SQS_ENDPOINT'])\n\n if resp.messages.count > 0\n process_message(resp.messages[0])\n end\n end", "def on_event(event_name=:__default__, &block)\n event_handler.register( event_name, &block )\n end", "def received\n end", "def process_events\n until @dead\n event = next_event\n notify_listeners(event)\n event.dispatch\n end\n rescue Exception => ex\n Logger.error \"Error while running event: #{Logger.format_error(ex)}\"\n end", "def dispatch\n @queue.pop.run while @queue.ready?\n end", "def set_queue\n self.add_queue(queue_name) do |metadata, payload|\n log.info(\"Message received with the routing key: #{metadata.routing_key}\")\n log.debug(\"Processing message with routing key: '#{metadata.routing_key}' and payload: #{payload}\")\n s2_resource = s2_resource(payload)\n route_message(metadata, s2_resource)\n end\n end", "def on_message(event)\n message = JSON.parse(event.data)\n\n if message['id']\n message['command'] = 'response_received'\n elsif message['message']\n command, *args = *message['message']\n message = {'command' => command, 'args' => args}\n end\n\n logger.debug \"Message received: #{message.inspect}\"\n dispatch(message)\n end", "def on_connection_listener_fetch_loop(event)\n listener = event[:caller]\n debug \"[#{listener.id}] Polling messages...\"\n end", "def notify_listeners(event)\n @listeners.each { |listener| listener.handle_delivery(event) }\n end", "def dispatch\n queue << nil\n while message = queue.shift\n consumers.each do |consumer|\n if response = consumer.on_message(message)\n @queue += Array(response)\n end\n end\n end\n end", "def listener()\n puts \"listener() thread starting.\" if $verbose\n stuff=''\n while(not($all_done))\n $serial_port.synchronize do\n stuff=stuff+$serialport.read(999)\n end\n (thing,stuff)=stuff.split(';',2)\n if(not(stuff))\n stuff=''\n end\n if(thing) \n $queue.synchronize do\n thing=thing+';'\n puts \"Adding to queue: #{thing}\" if $verbose\n $rx_messages.push(thing)\n end\n end\n sleep(0.1)\n end\n puts \"listener() thread exiting.\" if $verbose\nend", "def record_event(event)\n @events_mutex.synchronize do\n @events << event\n end\n end", "def listen\n raise NotImplementedError.new(\"Implement listen() in your Invoker. \")\n end", "def start\n subscribe &Proc.new { |message| listener(message) }\n end", "def enqueue_events\n @valid_events.each do |_, events|\n WebhookJob::RecordTestEvent.perform_now(events[0])\n end\n\n BgJob.enqueue(\n ProcessTestWebhookEvents,\n {\n lock_id: lock_id,\n client_webhook_setting_id: @webhook_id,\n admin_id: @admin_id\n }\n )\n end" ]
[ "0.7066768", "0.7052746", "0.6905035", "0.68616337", "0.67937094", "0.6746992", "0.67265016", "0.6616742", "0.6599773", "0.6596181", "0.6584961", "0.6571458", "0.6507917", "0.6462799", "0.6460936", "0.6445918", "0.64383596", "0.63638663", "0.63591737", "0.631059", "0.631059", "0.6292954", "0.62897813", "0.6209815", "0.6200006", "0.6193561", "0.61694175", "0.615292", "0.615292", "0.61331064", "0.61048347", "0.6090559", "0.60867167", "0.60691315", "0.605521", "0.6052589", "0.6050617", "0.60284865", "0.5970207", "0.5961567", "0.5958661", "0.594151", "0.5940358", "0.59211606", "0.59198034", "0.5915993", "0.5905662", "0.5890454", "0.58814985", "0.58755267", "0.5865535", "0.585833", "0.5854812", "0.5851682", "0.5847272", "0.58463", "0.5843845", "0.58354163", "0.58196604", "0.5818802", "0.5782417", "0.5775311", "0.5774592", "0.5737758", "0.57357913", "0.5723738", "0.57190937", "0.57078356", "0.56961745", "0.5695009", "0.5690653", "0.5689366", "0.5689252", "0.56876594", "0.56863534", "0.56860787", "0.5678051", "0.5652746", "0.56491584", "0.56482744", "0.56405133", "0.56388754", "0.56384563", "0.56384563", "0.56384563", "0.5635759", "0.5631125", "0.5617498", "0.561684", "0.56137455", "0.55985653", "0.5597159", "0.55890775", "0.55881435", "0.5588086", "0.55720526", "0.55697995", "0.5564661", "0.556223", "0.5557316" ]
0.6724736
7
Queues are used to receive events
def queue # Probably should be a UUID in the real world @queue ||= channel.queue(self.object_id.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signal_queue; end", "def queue(*queues)\n end", "def dispatch\n queue << nil\n while message = queue.shift\n consumers.each do |consumer|\n if response = consumer.on_message(message)\n @queue += Array(response)\n end\n end\n end\n end", "def queue; end", "def queue; end", "def process_queue\n puts \"Waiting for new messages\"\n th = Thread.new do\n Thread.current.abort_on_exception = true\n loop do\n # This will sit around and wait forever.\n key, raw_msg = @redis_client.blpop(@redis_in_key, 0)\n json_msg = Crack::JSON.parse(raw_msg)\n # Send back a random quote\n random_quote = @quotes[rand(@quotes.size)]\n out_msg = {:from => json_msg['from'], :body => random_quote}.to_json\n # Pusing onto the \"out\" list queues up something for the listener to process\n @redis_client.lpush(@redis_out_key, out_msg)\n end\n end \n end", "def command_queue; end", "def queues\n register_classes\n register_bus\n sorted_queues\n end", "def queue\n @queue ||= []\n end", "def make_queue\n # Create EventQueue with new-style events (added in Rubygame 2.4)\n @queue = EventQueue.new()\n @queue.enable_new_style_events\n end", "def queue(_); end", "def queue(_); end", "def push(event:)\n super\n\n @queue << event\n end", "def get_event_callback\n Proc.new do |new_packets, refCon_ptr, connRefCon_ptr|\n begin\n # p \"packets received: #{new_packets[:numPackets]}\"\n timestamp = Time.now.to_f\n messages = get_messages(new_packets)\n # SINM ADDED\n @queue.push(messages.map do |message|\n enqueue_message(message, timestamp)\n end.compact)\n # SINM COMMENTED OUT\n # messages.each { |message| enqueue_message(message, timestamp) }\n rescue Exception => exception\n Thread.main.raise(exception)\n end\n end\n end", "def create_queues\n queue\n exchange\n end", "def setup_queue\n # Create EventQueue with new-style events (added in Rubygame 2.4)\n @queue = EventQueue.new()\n @queue.enable_new_style_events\n\n # Don't care about mouse movement, so let's ignore it.\n @queue.ignore = [MouseMoved]\n end", "def queue(message); end", "def _q\n @queue||=[]\n end", "def dispatch_events!\n loop do\n event = @event_queue.pop\n\n callbacks.each do |callback|\n Thread.new do\n callback.call event\n end\n end\n end\n end", "def signal_queue=(_arg0); end", "def post(ev)\n\t\t@queue << ev\n\tend", "def make_queue\n # Create EventQueue with new-style events (added in Rubygame 2.4)\n @queue = EventQueue.new()\n @queue.enable_new_style_events\n \n # Don't care about mouse movement, so let's ignore it.\n @queue.ignore = [MouseMoved]\n end", "def watch_movie (queue)\n queue.shift\n queue\nend", "def setup_queue_listener\n service_queue.subscribe(:block => true) do |info, properties, payload|\n log.debug \"Received message: #{payload}...\"\n @return_info = nil\n rpc_wrapper.call { process(info, properties, payload) }\n end\n end", "def handle_queue_event(queue, id) # :nodoc: all\n # Time to process a new queue event.\n # If we get a callback for an ID we don't know about, don't worry -\n # just ignore it. It may be for a query we've already completed.\n #\n # So, get the next response from the queue (presuming there is one!)\n #\n # @TODO@ Tick could poll the queue and then call this method if needed - no need for observer interface.\n # @TODO@ Currently, tick and handle_queue_event called from select_thread - could have thread chuck events in to tick_queue. But then, clients would have to call in on other thread!\n #\n # So - two types of response :\n # 1) we've got a coherent response (or error) - stop sending more packets for that query!\n # 2) we've validated the response - it's ready to be sent to the client\n #\n # so need two more methods :\n # handleValidationResponse : basically calls send_result_and_stop_querying and\n # handleValidationError : does the same as handleValidationResponse, but for errors\n # can leave handleError alone\n # but need to change handleResponse to stop sending, rather than send_result_and_stop_querying.\n #\n # @TODO@ Also, we could really do with a MaxValidationTimeout - if validation not OK within\n # this time, then raise Timeout (and stop validation)?\n #\n # @TODO@ Also, should there be some facility to stop validator following same chain\n # concurrently?\n #\n # @TODO@ Also, should have option to speak only to configured resolvers (not follow authoritative chain)\n #\n if queue.empty?\n Dnsruby.log_and_raise('Severe internal error - Queue empty in handle_queue_event')\n end\n event_id, event_type, response, error = queue.pop\n # We should remove this packet from the list of outstanding packets for this query\n _resolver, _msg, client_query_id, _retry_count = id\n if id != event_id\n Dnsruby.log_and_raise(\"Serious internal error!! #{id} expected, #{event_id} received\")\n end\n # @mutex.synchronize{\n @parent.single_res_mutex.synchronize {\n if @query_list[client_query_id] == nil\n # print \"Dead query response - ignoring\\n\"\n Dnsruby.log.debug{'Ignoring response for dead query'}\n return\n end\n _msg, _client_queue, _select_queue, outstanding = @query_list[client_query_id]\n if event_type == Resolver::EventType::RECEIVED ||\n event_type == Resolver::EventType::ERROR\n unless outstanding.include?(id)\n Dnsruby.log.error(\"Query id not on outstanding list! #{outstanding.length} items. #{id} not on #{outstanding}\")\n end\n outstanding.delete(id)\n end\n # }\n if event_type == Resolver::EventType::RECEIVED\n # if (event.kind_of?(Exception))\n if error\n handle_error_response(queue, event_id, error, response)\n else # if event.kind_of?(Message)\n handle_response(queue, event_id, response)\n # else\n # Dnsruby.log.error('Random object #{event.class} returned through queue to Resolver')\n end\n elsif event_type == Resolver::EventType::VALIDATED\n if error\n handle_validation_error(queue, event_id, error, response)\n else\n handle_validation_response(queue, event_id, response)\n end\n elsif event_type == Resolver::EventType::ERROR\n handle_error_response(queue, event_id, error, response)\n else\n # print \"ERROR - UNKNOWN EVENT TYPE IN RESOLVER : #{event_type}\\n\"\n TheLog.error(\"ERROR - UNKNOWN EVENT TYPE IN RESOLVER : #{event_type}\")\n end\n }\n end", "def next_event\n @queue.pop\n end", "def queue(&b)\n @queue << b\n end", "def queue() = @queue ||= CommandQueue.new", "def handle_queue_event(queue, id) #:nodoc: all\r\n # If we get a callback for an ID we don't know about, don't worry -\r\n # just ignore it. It may be for a query we've already completed.\r\n # \r\n # So, get the next response from the queue (presuming there is one!)\r\n #\r\n # @TODO@ Tick could poll the queue and then call this method if needed - no need for observer interface.\r\n # @TODO@ Currently, tick and handle_queue_event called from select_thread - could have thread chuck events in to tick_queue. But then, clients would have to call in on other thread!\r\n #\r\n if (queue.empty?)\r\n TheLog.fatal(\"Queue empty in handle_queue_event!\")\r\n raise RuntimeError.new(\"Severe internal error - Queue empty in handle_queue_event\")\r\n end\r\n event_id, response, error = queue.pop\r\n # We should remove this packet from the list of outstanding packets for this query\r\n resolver, msg, client_query_id, retry_count = id\r\n if (id != event_id)\r\n TheLog.error(\"Serious internal error!! #{id} expected, #{event_id} received\")\r\n raise RuntimeError.new(\"Serious internal error!! #{id} expected, #{event_id} received\")\r\n end\r\n @mutex.synchronize{\r\n if (@query_list[client_query_id]==nil)\r\n TheLog.debug(\"Ignoring response for dead query\")\r\n return\r\n end\r\n msg, client_queue, select_queue, outstanding = @query_list[client_query_id]\r\n if (!outstanding.include?id)\r\n TheLog.error(\"Query id not on outstanding list! #{outstanding.length} items. #{id} not on #{outstanding}\")\r\n raise RuntimeError.new(\"Query id not on outstanding!\")\r\n end\r\n outstanding.delete(id)\r\n }\r\n # if (event.kind_of?(Exception))\r\n if (error != nil)\r\n handle_error_response(queue, event_id, error, response)\r\n else # if (event.kind_of?(Message))\r\n handle_response(queue, event_id, response)\r\n # else\r\n # TheLog.error(\"Random object #{event.class} returned through queue to Resolver\")\r\n end\r\n end", "def queues\n @channel.queues\n end", "def entry(event)\n queues.each do |q|\n q.register_stat(q.state, event.time - @current_time) # register stat for all queues (time count)\n end\n q = event.queue\n @current_time = event.time\n @current_event = event\n if q.state < q.capacity\n q.register_entry\n if q.state <= q.servers\n connections = @network.get_connections(q) # get all connections for queue\n connection = select_connection(connections) # handles probabilities\n event_type = connection.nil? ? \"exit\" : \"transfer\" # sets type for scheduling event\n @scheduler.schedule(event_type, (@current_time + @random.next_in_range(q.min_service, q.max_service)), q, connection) # schedules event\n raise OutOfRandomsError if @random.see_next < 0\n end\n else\n q.register_loss # if queue is full, register loss\n end\n @scheduler.schedule(\"entry\", (@current_time + @random.next_in_range(q.min_arrival, q.max_arrival)), q) # schedule next entry\n raise OutOfRandomsError if @random.see_next < 0\n end", "def queued_messages\r\n @buffer.slice(@pointer, @buffer.length - @pointer)\r\n end", "def run\n return unless @mutex.try_lock\n until @event_queue.empty? or not @running\n if @event_queue.length > 1\n log \"#{@event_queue} commands in queue\", Logger::Medium\n end\n handle_event(@event_queue.pop)\n end\n @mutex.unlock\n end", "def listen_for_messages\n @queue.subscribe do |_delivery_info, _metad5ata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end", "def queues\n\t\t\t@queues ||= {}\n\t\tend", "def queued_messages\n @buffer.slice(@pointer, @buffer.length - @pointer)\n end", "def handle\n @queue << \"handle\"\n end", "def push_event event\n @event_queue << event\n end", "def dispatch\n @queue.pop.run while @queue.ready?\n end", "def queue_msg(msg)\n dispatch_msg(msg)\n end", "def worker(*queues)\n end", "def on_queue(url)\n true\n end", "def dequeue\n end", "def queued\n hydra.queued_requests\n end", "def event_bus; end", "def event_bus; end", "def initialize\n @queue = []\n end", "def queue\n @queue ||= produce_queue\n end", "def monitor_events\n event_monitor_running\n event_monitor_handle.start do |event|\n @queue.enq(event)\n end\n ensure\n stop_event_monitor\n end", "def queue\n @handle.queue_name if @handle\n end", "def enqueue( *events )\n\t\tevents.each do |event|\n\t\t\tdata = event.resolve\n\t\t\tmsg = \"«%s» %p\" % [ data[:@type], data ]\n\t\t\tself.log.debug( msg )\n\t\tend\n\tend", "def send_commands_from_queue\n synchronize do\n return unless can_write?\n\n while @can_send > 0 && @send_queue.length > 0\n send_to_printer(@send_queue.pop)\n end\n end\n end", "def listen_queues(queues) #:nodoc:\n EM.run do\n exchanges = exchanges_for_queues(queues)\n create_exchanges(exchanges)\n bind_queues(queues)\n subscribe_queues(queues)\n yield if block_given?\n end\n end", "def queued\n @queued\n end", "def queue\n @queue ||= channel.queue(queue_name)\n end", "def on_enqueued\n @flow_lock.synchronize do\n return if @on_enqueued_invoked\n\n @on_enqueued_invoked = true\n\n yield(@first_message, @last_message)\n end\n end", "def enqueue_events\n @valid_events.each do |_, events|\n WebhookJob::RecordTestEvent.perform_now(events[0])\n end\n\n BgJob.enqueue(\n ProcessTestWebhookEvents,\n {\n lock_id: lock_id,\n client_webhook_setting_id: @webhook_id,\n admin_id: @admin_id\n }\n )\n end", "def setup_queue\n Thread.current[:carrot] = Carrot.new(:host=>'mediashelf1.dtic.dk')\n @q = Carrot.queue(@queue_name)\n end", "def queue\n\n @queue ||= channel.queue(*(opt('queue') || [ '' ]))\n end", "def monitor_events\n event_monitor_handle.start\n event_monitor_handle.each_batch do |events|\n event_monitor_running\n if events && !events.empty?\n @queue.enq events\n end\n sleep_poll_normal\n end\n ensure\n reset_event_monitor_handle\n end", "def issueEvent\n loop do\n [email protected]\n changed\n notify_observers(event[0],event[1],event[2],event[3])\n end\n end", "def fetch_messages\n if !@worker_pool.worker_available? && @state.run?\n @worker_available.wait\n end\n return unless @worker_pool.worker_available? && @state.run?\n\n begin\n args = [self.signals_redis_key, self.queue_redis_keys.shuffle, 0].flatten\n redis_key, encoded_payload = @client.block_dequeue(*args)\n if redis_key != @signals_redis_key\n @worker_pool.push(QueueItem.new(redis_key, encoded_payload))\n end\n rescue RuntimeError => exception\n log \"Error occurred while dequeueing\", :error\n log \"#{exception.class}: #{exception.message}\", :error\n (exception.backtrace || []).each{ |l| log(l, :error) }\n sleep 1\n end\n end", "def set_queue\n self.add_queue(queue_name) do |metadata, payload|\n log.info(\"Message received with the routing key: #{metadata.routing_key}\")\n log.debug(\"Processing message with routing key: '#{metadata.routing_key}' and payload: #{payload}\")\n s2_resource = s2_resource(payload)\n route_message(metadata, s2_resource)\n end\n end", "def queues\n subject.queues\n end", "def queue\n @queue.pending\n end", "def queue\n @queue ||= Queue.new\n end", "def queue(proc)\n\t\tself.sink.queue_proc(proc)\n\tend", "def sniff_queue\n queue = Queue.new\n \n # Spin up a thread that just queues packets (a buffer, if you will)\n qthread = Thread.new do\n @sniffer.each_packet do |pkt|\n queue.push pkt unless queue.length > 1000\n end\n end # of qthread\n \n # Now read each of those packets\n loop do\n pkt = queue.pop\n @event_collector.pkt_count += 1\n @event_collector.bytes += pkt.caplen\n case pkt\n when @tcp_traffic\n @tcp_handler.packet(pkt) if @tcp_handler\n when @udp_traffic\n @udp_handler.packet(pkt) if @udp_handler and pkt.udp? # INVESTIGATE!\n end\n end # of each_packet\n end", "def view_queue (queue)\n queue.each do |movie|\n puts \"You will watch #{movie}\"\nend\nend", "def receive(number)\n puts \"received number #{number}\"\n @queue << number\n end", "def run(queue)\n @typeperf.start_monitor\n \n @logger.debug(\"Started perfmon monitor\")\n\n while @typeperf.alive?\n data = @typeperf.get_next\n\n @codec.decode(data) do |event|\n decorate(event)\n \n event.set('host', @host)\n \n queue << event\n @logger.debug(\"Added event to queue: #{event}\")\n end\n end\n end", "def setup(*)\n super\n @queue = Array.new\n end", "def queues_cmd\n return @unique_queues.dup << TIMEOUT if @strictly_ordered_queues\n queues = @queues.sample(@unique_queues.size).uniq\n queues.concat(@unique_queues - queues)\n queues << TIMEOUT\n end", "def start_queue(test_objects, threads, cmd)\n @event_emitter.emit_event :info => 'All test processes full. Sending remaining tests to the test queue...'\n test = get_next_test(test_objects)\n while test != nil\n break if @stopped\n if get_active_thread_count(threads) < @queueSize\n threads << run_test(test, cmd)\n test = get_next_test(test_objects)\n end unless @stopped\n sleep 1\n end\n if @stopped\n @event_emitter.emit_event :info => 'Test run was stopped. Aborting queue and waiting for tests to complete....'\n else\n @event_emitter.emit_event :info => 'Queue complete. Waiting for tests to finish running...'\n end\n\n threads.each do |t|\n t.join\n end\n # done = false\n # until done do\n # stat = []\n # threads.each do |t|\n # stat << t.status\n # end\n # threads.delete_if {|t| !t.alive?}\n # threads.each do |t|\n # puts t.value\n # end if threads.length == 1\n # @event_emitter.emit_event :info => \"Waiting on #{threads.length} to finish running\"\n # done = true unless stat.include?('sleep') || stat.include?('run') || stat.include?('aborting')\n # sleep 1\n # end\n end", "def work(raw_post)\n puts \"Msg received: \" + raw_post\n ack! # we need to let queue know that message was received\n end", "def e\n @queue << \"enable\"\n end", "def listen\n consumers = input.map do |queue|\n consume queue\n end\n close_after consumers\n end", "def queue_receive(queue, options = {})\n raise NotImplementedError\n end", "def process_command_queue\n $logger.debug \"process_cmd_queue: #{@cmd_queue.inspect()}\"\n while (@cmd_queue.length > 0)\n cmd=@cmd_queue.shift()\n if (!cmd.nil?) #Command Recieved\n Analyzer.connection.reconnect!()\n process_cmd(cmd)\n end\n end\n end", "def receive(id)\n @queues[id].pop\n end", "def queue(*queues)\n queues.flatten!\n\n if defined?(Mongoid)\n c = ::Delayed::Job\n c = c.where(:failed_at => nil)\n c = c.where(:run_at.lte => Time.now.utc)\n c = c.where(:queue.in => queues) unless queues.empty?\n c.count\n elsif defined?(ActiveRecord)\n c = ::Delayed::Job\n c = c.where(:failed_at => nil)\n c = c.where(\"run_at <= ?\", Time.now.utc)\n c = c.where(:queue => queues) unless queues.empty?\n c.count\n else\n raise \"HireFire could not detect ActiveRecord or Mongoid for HireFire::Macro::Delayed::Job.\"\n end\n end", "def checkQueue\n #Check queue and deliver\n Thread.new do\n queue = Order.where(['state=?',\"accepted\"]).order(:due_date)\n for order in queue do\n #Check stock\n puts order\n products = Fetcher.getProductsWithStock\n if products[order.sku] > order.total && !order.due_date.past? then\n #Mover a despacho\n moveToDespacho(order.sku,order.total)\n stock = Product.where(sku:Integer(order.sku)).first.stock\n if order.destination == \"FTP\" then\n #Despachar\n puts \"FTP\"\n despacharFtp(order.sku,order.total,\"notEmpty\",order.oc)\n order.state = \"Despachada\"\n order.save\n else\n #dispatch to another group\n moveToGroup(order.sku,order.total,order.destination,order.oc)\n order.state = \"Despachada\"\n order.sav\n end\n else\n #producir\n\n end\n end\n end\n end", "def queue_in\n @channel.queue('dns-in', durable: true)\n end", "def queue_for(method, queue_name)\n @_queue_names ||= {}\n @_queue_names[method] = queue_name\n end", "def enqueue_message(obj)\n output_queue << obj\n end", "def process_next_gevent\r\n #@log.info \"Process next event\"\r\n return if @suspend_queue_proc == true\r\n while @proc_queue.size > 0\r\n next_ev_handl = @proc_queue.pop\r\n send(next_ev_handl)\r\n return if @suspend_queue_proc == true\r\n end\r\n \r\n end", "def queues\n @cache\n end", "def setup\n EM.kqueue\n #AMQP.logging = true\n @mq = MQ.new\n @requests = @mq.queue('jesus_nut',:auto_delete => true)\n @setup = true\n @mq.queue(@reply_to).subscribe { |info, response|\n resp = Marshal.load response\n callback = @pending.delete info.message_id\n callback.call resp\n }\n @id = 1\n end", "def listen_queues(*queues, &block)\n queues = determine_queue_names(queues)\n subscriber.listen_queues(queues, &block)\n end", "def queue(*args, &block)\n @queue << [block, args]\n end", "def monitor()\n listener = QueueListener.new(monitor_queue)\n sub_processor = SubscriptionProcessor.new\n avail_processor = AvailabilityProcessor.new(true)\n\n listener.add_processor(sub_processor)\n listener.add_processor(avail_processor)\n\n # add a post-processor to let the subscriber know\n # of all the available services it is interested in, \n # that we currently know about.\n sub_processor.post_process = Proc.new do |msg|\n begin\n if msg.subscribe\n info { \"received subscription from #{msg.response_queue} for #{msg.services.inspect}\" }\n debug { \"got subscription #{msg.inspect}\" }\n queue = sqs.queue(msg.response_queue)\n\n # determine which services that this subscriber is interested in,\n # and organize them by ipv4 address (so we can send a minimal amount of messages)\n ipv4_services = {}\n\n msg.services.each do |service|\n # send an availability message for each service\n addrs = avail_processor.available(service)\n addrs.each do |addr|\n ipv4_services[addr.ipv4] ||= []\n ipv4_services[addr.ipv4] |= [\"#{service}#{addr.port}\"]\n end\n end\n\n ipv4_services.each do |ipv4, services|\n avail_msg = AvailabilityMessage.new(services, ipv4, true)\n debug { \"sending availability msg #{avail_msg.inspect}\" }\n send_message(queue, avail_msg)\n end\n end\n rescue Exception => ex\n error \"Error during post-process for message #{msg.inspect}\", ex\n end\n end\n\n # add a post-processor to let any subscribers know of\n # updates to availability, even keep-alives.\n avail_processor.post_process = Proc.new do |msg|\n debug { \"received availability message #{msg.inspect}\" }\n begin\n msg.services.each do |service|\n # service may have included a port, so strip that off when we\n # search for subscribers\n service_minus_port = service.gsub(/:.*$/, '')\n\n sub_processor.response_queues(service_minus_port).each do |response_queue|\n # original message may have included more services \n # other than what the subscriber is interested in\n avail_msg = AvailabilityMessage.new([service], msg.ipv4addr, msg.available, msg.ttl)\n debug { \"sending availability message #{avail_msg.inspect}\" }\n send_message(sqs.queue(response_queue), avail_msg)\n end\n end\n rescue Exception => ex\n error \"Error during post-process for message #{msg.inspect}\", ex\n end\n end\n\n # TODO: allow control over this thread\n unavail_thread = Thread.new do\n while true\n begin\n avail_processor.expired.each do |service, addr_list|\n info { \"#{service} on #{addr_list.inspect} expired\" }\n sub_processor.response_queues(service).each do |response_queue|\n addr_list.each do |addr|\n msg = AvailabilityMessage.new([\"#{service}#{addr.port}\"], addr.ipv4, false, -1)\n debug { \"sending unavailable message #{msg.inspect} to #{response_queue}\" }\n begin\n send_message(sqs.queue(response_queue), msg)\n rescue Exception => ex\n error \"Error sending unavailable message #{msg.inspect} to #{response_queue}\", ex\n end\n end\n end\n end\n rescue Exception => ex\n error \"Unexpected exception in expiration thread!\", ex\n end\n sleep 1\n end\n end\n \n\n return listener.listen\n end", "def queue_job; end", "def get_queues\n @gem_queue = get_queue 'gem'\n @md5_queue = get_queue 'md5'\n @sha512_queue = get_queue 'sha512'\n end", "def async_queue_add(changes)\n @queue << changes\n\n # Putting interactor in background puts guard into foreground\n # so it can handle change notifications\n Thread.new { interactor.background }\n end", "def queues\n Thread.current[:queues] == \"*\" ? Resque.queues.sort : Thread.current[:queues].split(',')\n end", "def queues\n Thread.current[:queues] == \"*\" ? Resque.queues.sort : Thread.current[:queues].split(',')\n end", "def blocking_queue_handler queues, meth, timeout=Stella::Worker.queuetimeout\n queues << timeout # We do it this way to support Ruby 1.8\n queue, jobid = *(Stella::SmartQueue.redis.send(meth, *queues) || [])\n return nil if jobid.nil?\n #Stella.ld \"FOUND #{jobid} in #{queue}\"\n jobid\n end", "def send_events; end", "def init_queue\n @queue = EM::Queue.new\n processor = proc { |msg|\n send_to_client msg\n @queue.pop(&processor)\n }\n @queue.pop(&processor)\n end", "def list\n @queue << \"list\"\n end" ]
[ "0.72783893", "0.6948128", "0.6929715", "0.6898411", "0.6898411", "0.6830583", "0.6767041", "0.67299604", "0.6631542", "0.65903133", "0.65895563", "0.65895563", "0.65695035", "0.6567283", "0.6556751", "0.65265745", "0.6524798", "0.65216345", "0.65173316", "0.6488111", "0.64790195", "0.6451334", "0.6448488", "0.6428947", "0.6410766", "0.637568", "0.6372926", "0.63723963", "0.63709366", "0.63643223", "0.6319137", "0.6290357", "0.6283036", "0.6270832", "0.62615746", "0.6224725", "0.6219335", "0.6204376", "0.6196634", "0.61964077", "0.61836696", "0.6180005", "0.61788213", "0.61621875", "0.61553186", "0.61553186", "0.61519957", "0.6150895", "0.61282754", "0.6120649", "0.6106028", "0.61046696", "0.6090934", "0.6086983", "0.60748696", "0.60698926", "0.60441905", "0.6039752", "0.6038016", "0.60183436", "0.6013846", "0.60077447", "0.6007652", "0.60008836", "0.6000742", "0.59905434", "0.59833044", "0.5969765", "0.5961529", "0.5947842", "0.5943252", "0.59226084", "0.5906572", "0.58895785", "0.5872897", "0.58689916", "0.5868052", "0.58644956", "0.5863996", "0.58631665", "0.5852386", "0.5839763", "0.58352137", "0.58344084", "0.58334243", "0.58309364", "0.5824682", "0.5824579", "0.5823163", "0.58225006", "0.58190286", "0.5809651", "0.58086026", "0.5794814", "0.5788162", "0.5788162", "0.5783969", "0.5779144", "0.5772481", "0.57718635" ]
0.617012
43
Exchanges are used to publish events
def exchange @exchange ||= channel.fanout(QUEUE_NAME) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exchanges\n @exchanges ||= {}\n end", "def exchanges\n\t\t\t@exchanges ||= {}\n\t\tend", "def exchanges\n @channel.exchanges\n end", "def initialize\n @exchanges = {}\n end", "def exchange\n @exchange ||= produce_exchange\n end", "def event_bus; end", "def event_bus; end", "def send_events; end", "def safe_publish(e)\n on_exchange do |exchange|\n exchange.publish(e.to_json, :routing_key => @routing_key)\n end\n end", "def mail_exchanges\n records.map { |record| record.exchange.to_s }\n end", "def exchange\n raise \"This is an abstract class. Override exchange method in descendant class\"\n end", "def publish(event)\n exchange.publish(event)\n nil\n end", "def exchange(id)\n get \"exchanges/#{id}\"\n end", "def safe_publish(event)\n if connection.status == :open\n exchange.publish(event.to_json, :routing_key => routing_key)\n else\n say \"Event not sent. Connection status is #{connection.status}: \" + \\\n \"#{event.to_json}\"\n end\n end", "def exchange\n @exchange ||= Hightops.connection.channel.exchange(exchange_naming.to_s, type: exchange_type, durable: true)\n end", "def observed_exchange\n nil\n end", "def exchange\n @exchange ||= Exchange.new(@channel, :direct, AMQ::Protocol::EMPTY_STRING, :key => name)\n end", "def on_exchange(&block)\n return unless @channel\n @channel.topic('untied', :auto_delete => true, &block)\n end", "def subscribed; end", "def publish_to(exname, message, opts={})\n EventMachine.schedule {\n ex = amq.exchanges[exname] || raise(\"Undefined exchange name : #{exname}\")\n case ex.type\n when :topic\n unless opts.has_key? :key\n opts[:key] = '*'\n end\n end\n ex.publish(Serializer.instance.marshal(message), opts)\n }\n end", "def exchange\n @exchange ||= channel.topic(Proletariat.exchange_name,\n durable: !Proletariat.test_mode?)\n end", "def exchange\n @exchange ||= channel.direct(exchange_name,\n durable: !Proletariat.test_mode?,\n auto_delete: Proletariat.test_mode?)\n end", "def pubsub_adapter; end", "def subscribeToEvent (bookieEmail)\r\n events = @BetESS.fMapOfAllEvents\r\n subscribedEvents = @BetESS.fGetSubscribedEventsFrom(bookieEmail)\r\n\r\n # Delete all the events he's already subscribed to\r\n subscribedEvents.each do |eventID|\r\n if (events.has_key?(eventID))\r\n events.delete(eventID)\r\n end\r\n end\r\n\r\n puts \"\\t\\tList of Events\"\r\n events.each {|eventID,event| puts \"#{event.toString}-------\"}\r\n\r\n if (events.length>0)\r\n puts \"Which event do yo want to subscribe to: \"\r\n id = gets.chomp.to_i\r\n\r\n @BetESS.fSubscribeBookieToEvent(id,bookieEmail)\r\n @BetESS.fAddSubscribedEventTo(bookieEmail,id)\r\n puts \"Event subscription was successful!\"\r\n else puts \"There are no subscribable events.\"\r\n end\r\n\r\n\r\n end", "def publish(message)\n # TODO: queue name and configuration should be in a config file\n @out_exchange.publish(message, :persistent => true, :key => \"esperfooin\", :mandatory => true)\n end", "def haseventack(key)\n @events_ack[key]\n end", "def register_exchange(name, options={})\n name = name.to_s\n raise ConfigurationError.new(\"exchange #{name} already configured\") if exchanges.include?(name)\n exchanges[name] = options.symbolize_keys.merge(:type => :topic, :durable => true, :queues => [])\n end", "def with_exchange(&block)\n setup_to_publish do | client | \n block.call( create_topic(client) ) \n sleep 0.1 if puberror.empty?\n end\n end", "def register_events\n EventReactor.sub(:trade_cleared, &method(:trade_cleared))\n EventReactor.sub(:round_change, &method(:change_round))\n EventReactor.sub(:ask_posted, &method(:ask_posted))\n EventReactor.sub(:bid_posted, &method(:bid_posted))\n end", "def to_wires_event; self; end", "def retrieve(exchange)\n begin\n new = dupl = 0\n events = api_request \"https://api.github.com/events?per_page=100\"\n (new, dupl, stored) = store_count events\n\n # This means that the first page does not contain all new events. Do\n # a paged request and get everything on the queue\n if dupl == 0\n events = paged_api_request \"https://api.github.com/events?per_page=100\"\n (new1, dupl1, stored1) = store_count events\n stored = stored | stored1\n new = new + new1\n end\n\n stored.each do |e|\n repo = e['repo']['name'].gsub('/',' ')\n key = \"evt.#{e['type']}\"\n if @options[:projects_given]\n exchange.publish repo, :persistent => true, :routing_key => GHTorrent::ROUTEKEY_PROJECTS\n debug \"Published update to project #{repo}\"\n if @events_requeue.include? e['type']\n exchange.publish e['id'], :persistent => true, :routing_key => key\n end\n else\n exchange.publish e['id'], :persistent => true, :routing_key => key\n end\n end\n\n return new, dupl\n rescue StandardError => e\n STDERR.puts e.message\n STDERR.puts e.backtrace\n end\n end", "def find_exchange(name)\n @exchanges[name]\n end", "def publish_event(consumers, event_name)\n consumers.each do |consumer|\n key = \"consumers.#{Helpers::Inflector.map(consumer.class.to_s)}.#{event_name}\"\n Karafka::App.monitor.instrument(key, context: consumer)\n end\n end", "def store_event( event )\n\t\ttime = event.delete( '@timestamp' )\n\t\ttype = event.delete( '@type' )\n\t\tversion = event.delete( '@version' )\n\n\t\tdata = JSON.generate( event )\n\t\theaders = {\n\t\t\ttime: time,\n\t\t\ttype: type,\n\t\t\tversion: version,\n\t\t\tcontent_type: 'application/json',\n\t\t\tcontent_encoding: data.encoding.name,\n\t\t\ttimestamp: Time.now.to_f,\n\t\t}\n\n\t\t@amqp_exchange.value.publish( data, headers )\n\tend", "def register_events\n EventReactor.sub(:trade_cleared, &method(:log_trade_cleared))\n EventReactor.sub(:round_change, &method(:log_round_change))\n end", "def send_events=(_arg0); end", "def exchange\n @exchange ||= channel.topic(topic_name, durable: true)\n end", "def subscribe!\n # TODO: Implement\n end", "def check_event_stock!\n event = self.exchange.event\n event.check_stock!\n\n # Agrego una tarea para revisar que los otros eventos de la misma experiencia tengan stock,\n # esto sirve principalmente para el stock de los eventos sin exclusividad.\n CheckEventStockWorker.perform_async(event.experience_id)\n end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def event_handler(msg = {})\n event, element = msg[:event], msg[:element]\n @logger.info { \"[Domotics] event [#{event}] element [#{element}] state [#{element.state}]\" }\n Domotics::Core::WsServer.publish \"#{element.room.name}/#{element.name}\"\n end", "def exchange\n Delayed::Job.tomqueue_manager.channel.exchange(@name,\n :type => @type,\n :auto_delete => @auto_delete,\n :durable => @durable\n )\n end", "def instantiate_exchange\n\n Thread.current['_boss_amqp_exchange'] ||= begin\n\n exc = exchange\n type, name, options = exc\n\n raise ArgumentError.new(\n \"couldn't determine exchange from #{exc.inspect}\"\n ) unless name\n\n exchange_opts = (options || {}).each_with_object({}) { |(k, v), h|\n h[k.to_sym] = v\n }\n\n Bunny::Exchange.new(channel, type.to_sym, name, exchange_opts)\n end\n end", "def index\n @exchanges_grid = initialize_grid(Exchange.all)\n end", "def publish\n raise 'Event already published' if published\n\n begin\n ::SNT::Core::MQ.publisher.publish(event_context.to_json, routing_key: \"#{service}.dto\")\n self.published = true\n rescue ::StandardError => e\n logger.error \"Could not publish service event to RabbitMQ: #{e.message}\"\n logger.error e.backtrace\n end\n end", "def get_event_callback\n Proc.new do |new_packets, refCon_ptr, connRefCon_ptr|\n begin\n # p \"packets received: #{new_packets[:numPackets]}\"\n timestamp = Time.now.to_f\n messages = get_messages(new_packets)\n # SINM ADDED\n @queue.push(messages.map do |message|\n enqueue_message(message, timestamp)\n end.compact)\n # SINM COMMENTED OUT\n # messages.each { |message| enqueue_message(message, timestamp) }\n rescue Exception => exception\n Thread.main.raise(exception)\n end\n end\n end", "def exchange\n @exchange ||= channel.fanout(exchange_name, durable: true)\n end", "def transmit_event\n # Extract just the old values from change_hash\n old_values = {}\n change_hash.each_pair do |k,v|\n old_values[k] = v[0]\n end\n case source_type\n when \"Instance\"\n if ['running', 'stopped'].include?(status_code)\n # If we look this up through the 'source' association, we end up with it being a stale object.\n instance = Instance.unscoped.find(source_id)\n # If we have a time_last_running, use it; otherwise, we just started and it's not populated yet\n start_time = instance.time_last_running || Time.now\n terminate_time = status_code == 'stopped' ? instance.time_last_stopped : nil\n # Because this is an after-save hook, rescue any possible exceptions -- if for some reason\n # we cannot save the Event, we don't want to abort the Instance update transaction.\n begin\n e = Aeolus::Event::Cidr.new({\n :instance_id => instance.id,\n :deployment_id => instance.deployment_id,\n :image_uuid => instance.image_uuid,\n :owner => instance.owner.username,\n :pool => instance.pool.name,\n :provider => instance.provider_account.provider.name,\n :provider_type => instance.provider_account.provider.provider_type.name,\n :provider_account => instance.provider_account.label,\n :hardware_profile => instance.hardware_profile.name,\n :start_time => start_time,\n :terminate_time => terminate_time,\n :old_values => old_values,\n :action => status_code\n })\n e.process\n rescue Exception => e\n logger.error \"Caught exception trying to save event for instance: #{e.message}\"\n return true\n end\n end\n # There is also a \"summary\" attribute on state changes, but we don't appear to need to check it\n when \"Deployment\"\n if ['some_stopped', 'first_running', 'all_stopped', 'all_running'].include?(status_code)\n deployment = Deployment.unscoped.find(source_id)\n begin\n # TODO - The Cddr method supports a :deployable_id, but we don't implement this at the moment\n e = Aeolus::Event::Cddr.new({\n :deployment_id => deployment.id,\n :owner => deployment.owner.username,\n :pool => deployment.pool.name,\n :provider => (deployment.provider.name rescue \"-nil-\"),\n :provider_type => (deployment.provider.provider_type.name rescue \"-nil-\"),\n :provider_account => (deployment.instances.first.provider_account.label rescue \"-nil-\"),\n :start_time => deployment.start_time,\n :terminate_time => deployment.end_time,\n :old_values => old_values,\n :action => status_code\n })\n e.process\n rescue Exception => e\n logger.error \"Caught exception trying to save event for deployment: #{e.message}\"\n return true\n end\n end\n end\n end", "def send_event(msg, hash)\n client = Dogapi::Client.new(@api_key)\n event = Dogapi::Event.new(msg, hash)\n client.emit_event(event)\n end", "def exchange(name, type, durable: true, auto_delete: false, internal: false, arguments: {})\n @exchanges.fetch(name) do\n with_connection do |conn|\n conn.channel(1).exchange_declare(name, type, durable: durable, auto_delete: auto_delete,\n internal: internal, arguments: arguments)\n end\n @exchanges[name] = Exchange.new(self, name)\n end\n end", "def define_exchange(name, options = {})\n options = {\n durable: true,\n }.merge(options)\n @exchange = @channel.topic(name, options)\n end", "def test_emit_2\n driver = create_driver\n driver.emit('message' => 'source=web.1 dyno=heroku.appid.uuid sample.memory_total=512MB')\n driver.run\n tag, time, record = driver.emits.first\n\n refute record.key? 'hrm_source'\n refute record.key? 'hrm_dyno'\n refute record.key? 'hrm_sample#memory_total'\n end", "def run\n strategy_delay = @dax.collect { |_k, v| v.min_delay }.min\n\n EM.synchrony do\n @dax.each do |name, exchange|\n Arke::Log.debug \"Starting Exchange: #{name}\"\n\n exchange.timer = EM::Synchrony::add_periodic_timer(exchange.min_delay) do\n exchange.queue.pop do |action|\n Arke::Log.debug \"Scheduling Action #{Time.now} - Exchange #{name} Delay #{exchange.min_delay} - Queue size: #{exchange.queue.size}\"\n Arke::Log.debug \"pop: #{action}\"\n schedule(action)\n end\n end\n\n exchange.start\n end\n\n # order stacking is a very big issue here, I multiply by 2 because I yield 2 orders\n # one for buy and one for sell\n @timer = EM::Synchrony::add_periodic_timer(strategy_delay) do\n execute_strategy if queues_empty?\n end\n end\n end", "def forex_exchanges(opts = {})\n data, _status_code, _headers = forex_exchanges_with_http_info(opts)\n data\n end", "def create\n @exchange = Exchange.new(params[:exchange])\n # Save exchange and subscribe current_user to newly created exchange\n respond_to do |format|\n if @exchange.save\n Subscription.create(:user_id => current_user.id, :exchange_id => @exchange.id)\n# subscriptions = current_user.exchanges.collect(&:id) + [@exchange.id]\n# current_user.exchange_ids = params[:user][:exchange_ids] ||= [] # Sets up user subscriptions\n# current_user.update_attributes(:exchange_ids => subscriptions)\n flash[:notice] = 'Exchange was successfully created.'\n format.html { redirect_to(@exchange) }\n format.xml { render :xml => @exchange, :status => :created, :location => @exchange }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @exchange.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_exchange\n @exchange = Exchange.find(params[:id])\n end", "def set_exchange\n @exchange = Exchange.find(params[:id])\n end", "def set_exchange\n @exchange = Exchange.find(params[:id])\n end", "def set_exchange\n @exchange = Exchange.find(params[:id])\n end", "def set_exchange\n @exchange = Exchange.find(params[:id])\n end", "def set_exchange\n @exchange = Exchange.find(params[:id])\n end", "def events(params={})\n return Proxy.new(connection, \"./events\",params)\n end", "def subscribe_to_channel; end", "def prePushListener\n end", "def subscribe\n \nend", "def events\n end", "def publisher; end", "def publisher; end", "def publish(event, payload = {})\n exchange.publish(MultiJson.dump(payload), routing_key: event, content_type: 'application/json')\n end", "def nameless_exchange\n $nameless_exchange ||= client.default_exchange\nend", "def events=(_); end", "def isolate_signals; end", "def test_transaction\n conn_subscribe make_destination\n\n @conn.begin \"txA\"\n @conn.publish make_destination, \"txn message\", 'transaction' => \"txA\"\n\n @conn.publish make_destination, \"first message\"\n\n msg = @conn.receive\n assert_equal \"first message\", msg.body\n\n @conn.commit \"txA\"\n msg = @conn.receive\n assert_equal \"txn message\", msg.body\n checkEmsg(@conn)\n end", "def exchange_request\n @order = Order.find(params[:id])\n if @order\n @exchangeable_books = params[:books]\n user = User.find(@order.seller_id)\n @order.notification_sent = true\n @order.save\n TasksController.send_notification( user,@current_user,\"Book exchange request\", \"https://www.google.com\")\n render json:{status: 'Success', message: \"Your request is sent to book owner (\"+user.name+\")\"},status: :ok\n end\n end", "def push_to_amqp\n\n AMQP.start(APP_CONFIG['amqp']) do |connection|\n\n channel = AMQP::Channel.new(connection)\n\n channel.on_connection_interruption do |ch|\n puts \"--> Channel #{ch.id} detected connection interruption\"\n EventMachine.stop\n end\n\n exchange = channel.fanout(APP_CONFIG['amqp_channel'], :durable => true)\n exchange.on_connection_interruption do |ex|\n puts \"--> Exchange #{ex.name} detected connection interruption\"\n EventMachine.stop\n end \n\n exchange.publish(attributes.to_json.gsub('\\r\\n', '\\n'), :persistent => true) do\n connection.close { EventMachine.stop }\n end\n end\n\n return true\n end", "def publisher\n end", "def subscriptions; end", "def subscriptions; end", "def subscriptions; end", "def listen2\n \n EM.run do\n AMQP.connect(:host => @host) do |connection |\n puts \"Connected to AMQP broker. Running #{AMQP::VERSION} version of the gem...\"\n channel = AMQP::Channel.new(connection)\n exchange = channel.direct(@x_request)\n reply = channel.direct(@x_response)\n queue = channel.queue(@server_q)\n notify = channel.fanout(@x_notify)\n \n puts \"request xchange =#{@x_request}\"\n puts \"reply xchange =#{@x_response}\"\n puts \"server queue =#{@server_q}\"\n \n # listen for rpc requests on the server queue\n #\n queue.bind( exchange).subscribe do |header,body|\n \n # extract the headers and create a transport for this\n # client. the reply_to field may be in the application\n # headers field so check for it there also.\n \n reply_to = header.reply_to || ( header.headers && header.headers[:reply_to])\n message_id = header.message_id || ( header.headers && header.headers[:message_id])\n \n if reply_to && message_id\n # process the call\n response = do_handle(body)\n \n # publish the reply only if there is a response\n \n if response\n options = {}\n options[:key] = reply_to\n options[:message_id] = message_id\n data = Blix.to_binary_data(response)\n \n puts \"[AmqpServer] response: data=#{data}, options=#{options}\" if $DEBUG\n \n reply.publish(data, options )\n end\n else\n puts \"missing reply-to /message_id field .....\"\n pp header\n end\n end #subscribe\n \n # send any notifications that are waiting.\n while !@notify_queue.empty?\n message = @notify_queue.pop\n channel.fanout(@x_notify).publish(Blix.to_binary_data(message))\n puts \"[AmqpServer] notify: message=#{msg}\" if $DEBUG\n end\n end #connection\n end # EM\n \n end", "def active_exchanges\n self.participations.where([':todays_date > match_date \n AND :todays_date < exchange_date', \n :todays_date => Date.today])\n end", "def notify_parties\n buyer.add_transaction self\n seller.add_transaction self if seller\n end", "def test1 #fails\n\n EventMachine::WebSocket.start(:host => \"0.0.0.0\", :port => 8567) do |ws|\n ws.onopen do\n puts \"WebSocket opened\"\n conn = Bunny.new\n conn.start\n#ch = conn.default_channel\n q = $ch.queue(\"tweets\")\n q.subscribe(:block => true) do |delivery_info, properties, body|\n puts \"Received tweet\\n\"\n ws.send \"test\"\n end\n end\n ws.onclose do\n ws.close(code = nil, body = nil)\n puts \"WebSocket closed\"\n# exit\n end\n end\nend", "def on_envelope(envelope)\n pass envelope\n end", "def on_receive_order(value)\n end", "def on_receive_order(value)\n end", "def send_email_changed_notification; end", "def pubsub; end", "def receive_transaction\n end", "def receive_transaction\n end", "def exchange_info\n request :public, :get, :exchangeInfo\n end", "def initialize(exchange_name = nil, routing_key: nil, connection: nil, context: nil, ident: nil, expiration: nil, persistent: true, durable: true, timeout: nil)\n super(connection: connection, context: context, ident: ident)\n\n @routing_key = routing_key\n @timeout = timeout\n\n @rpc_exchange = self.channel.direct(\n exchange_name || EXCHANGE_NAME_DEFAULT,\n durable: durable\n )\n\n @response_queue = self.channel.queue(\n @ident,\n durable: false,\n header: true,\n auto_delete: true\n )\n @expiration = expiration\n @persistent = !!persistent\n\n @callback = { }\n\n @consumer = Skein::Adapter.subscribe(@response_queue, block: false) do |payload, delivery_tag, reply_to|\n self.context.trap do\n if (ENV['SKEIN_DEBUG_JSON'])\n $stdout.puts(payload)\n end\n\n response = JSON.load(payload)\n\n if (callback = @callback.delete(response['id']))\n if (response['error'])\n exception =\n case (response['error'] and response['error']['code'])\n when -32601\n NoMethodError.new(\n \"%s from `%s' RPC call\" % [\n response.dig('error', 'message'),\n response.dig('error', 'data', 'method')\n ]\n )\n when -32602\n ArgumentError.new(\n response.dig('error', 'data', 'message') || 'wrong number of arguments'\n )\n else\n RPCException.new(\n response.dig('error', 'data', 'message') || response.dig('error', 'message')\n )\n end\n\n case (callback)\n when Skein::TimeoutQueue\n callback << exception\n when Proc\n callback.call(exception)\n end\n else\n case (callback)\n when Skein::TimeoutQueue\n callback << response['result']\n when Proc\n callback.call(response['result'])\n end\n end\n end\n\n self.channel.acknowledge(delivery_tag)\n end\n end\n end", "def publish(event, payload)\n end" ]
[ "0.6925797", "0.6866954", "0.6835345", "0.68192106", "0.6454724", "0.60323125", "0.60323125", "0.6024625", "0.59110385", "0.586145", "0.5852531", "0.5753328", "0.57448405", "0.57171965", "0.5716946", "0.56829387", "0.5618979", "0.5583908", "0.5556776", "0.55445117", "0.5528467", "0.5519853", "0.5518481", "0.55136055", "0.5508296", "0.54734766", "0.54570633", "0.5445799", "0.5436706", "0.5433043", "0.5410796", "0.5366766", "0.53496027", "0.5347334", "0.5338053", "0.5314193", "0.5296751", "0.5296554", "0.5274725", "0.52676", "0.52676", "0.52676", "0.52676", "0.52676", "0.52676", "0.52676", "0.52676", "0.5255342", "0.5241277", "0.52383566", "0.52356035", "0.5232446", "0.5220847", "0.520557", "0.52022797", "0.5198012", "0.51932025", "0.5188117", "0.5186933", "0.5177075", "0.5163399", "0.51558256", "0.5143998", "0.5143998", "0.5143998", "0.5143998", "0.5143998", "0.5143998", "0.5141396", "0.5137172", "0.5134888", "0.5133387", "0.51314884", "0.51303554", "0.51303554", "0.51297134", "0.512795", "0.5125233", "0.51185095", "0.51090354", "0.5092963", "0.5074831", "0.50630915", "0.50564647", "0.50564647", "0.50564647", "0.5051277", "0.50425684", "0.5033725", "0.5027026", "0.50259185", "0.50217366", "0.50217366", "0.5021307", "0.5016901", "0.5016237", "0.5016237", "0.5016111", "0.501427", "0.50084084" ]
0.5506514
25
wired to app/views/recommendations/show.html.erb by default (naming convention) display a recommendation (if the application doesn't exist, redirect to the page for all the apps)
def show @recommendation = App.find(params[:id]) if @recommendation.nil? redirect_to action: :index end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recommendation }\n end\n end", "def show\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recommendation }\n end\n end", "def show\n @recommendation = Recommendation.find(params[:id])\n end", "def show\n @recommend = Recommend.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommend }\n end\n end", "def show\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommendation }\n end\n end", "def show\n redirect_to '/unauthorized' if current_user.blocked_by? User.find(params[:user_id])\n @user = User.find(params[:user_id])\n @dm_profile = @user.dm_profile\n unless @dm_profile.nil?\n @similar_profiles = User.recommender(@dm_profile, \"dm\")\n @similar_profiles = recommend_set(@similar_profiles, @user) & User.location(current_user, \"1\")\n else\n @similar_profiles = nil\n end\n if !@dm_profile\n redirect_to new_user_dm_profiles_path(@user, tutorial: params[:tutorial])\n else\n render 'show'\n end\n end", "def show\n @page_title = @recommendation.movie.title\n end", "def index\n @recommendations = Recommendation.all\n end", "def show\n Wishlist.all.each do |wishlist| \n if wishlist.email == current_user.email\n if (Application.where(id: wishlist.app_id)).exists?\n @application = Application.find (wishlist.app_id)\n end\n end\n end\n end", "def show\n @app = App.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @app }\n end\n end", "def show\n\t\t@recommendation = Recommendation.find(params[:id])\n\t\t#sleep 1\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @recommendation }\n\t\tend\n\tend", "def show\n @apparel = Apparel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @apparel }\n end\n end", "def show\n @user = User.find(params[:id])\n @recommendation = @user.recommendations.build if logged_in?\n end", "def show_app\n # raise params[:id].to_yaml\n render :layout => \"application_responsive\"\n end", "def show\n if current_user.application == @application or current_user.is_admin?\n redirect_to user_path(@application.user)\n else\n redirect_to root_path\n end\n end", "def show\n @app = current_user.apps.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end", "def show\n @recommend_recommend_other = Recommend::RecommendOther.find(params[:id])\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), recommend_recommend_other_path(@recommend_recommend_other)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommend_recommend_other }\n end\n end", "def show\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommender }\n end\n end", "def show\n @app = Mms::App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end", "def show\n @app = App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n format.json { render :json => @app } \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 @recommend_recommend_ptag = Recommend::RecommendPtag.find(params[:id])\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), recommend_recommend_ptag_path(@recommend_recommend_ptag)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommend_recommend_ptag }\n end\n end", "def show\n current_user_as :main_app do |current_user|\n respond_to do |format|\n format.html { render }\n format.rss {\n if @page.contains_feed?\n render :action => \"show\", :layout => false, :handlers => [:builder]\n else\n render :xml => {:error => 'Not found'}, :status => 404\n end\n }\n end\n end\n end", "def show\n @recipes = @ingredient.recipes.reorder(ingredient_order_by(\"recipes\")).paginate(page: params[:page], per_page: 2)\n @title = \"Recipes using: \" + @ingredient.name\n # goto render /views/ingredients/show.html.erb using /shared/_show_recipes using @recipes, @title\n end", "def show\n @recipes = @diet.recipes.reorder(diet_order_by(\"recipes\")).paginate(page: params[:page], per_page: 2)\n @title = \"Recipes using: \" + @ingredient.name\n # goto render /views/diets/show.html.erb using /shared/_show_recipes using @recipes, @title\n end", "def show\n @operas = Opera.where('artista_id=?', @artistum.id)\n @user = User.find_by_artista_id(@artistum.id)\n if current_user.nil?\n @preferiti = []\n else\n @preferiti = Favorite.opere(current_user.id)\n end\n render layout: \"gallery\"\n end", "def recommendations\n check_preference_setup \n check_last_played_time\n add_personality_recommendations\n\n @recommendations\n end", "def show\n \tif params[:hiperlink]\n\t @product = Product.find_by_hiperlink(params[:hiperlink])\n else\n @product = Product.find(params[:id])\n end\n if @product == nil\n \tredirect_to pages_path\n else\n\t render 'show', :layout=>'main_layout'\n\t end\n end", "def show\n currentapp_initialize\n end", "def show # will be default will generate show.html.erb\n end", "def index\n @load_content = preload_content\n @recommendations = policy_scope(\n @parent.recommendations.preload(preload_content))\n render 'api/v1/recommendations/index'\n end", "def show\n if @user.application.present?\n @application = @user.application\n end\n end", "def show\n\t\tredirect_to root_path\n\tend", "def show\n redirect_to settings_app_path(@app)\n end", "def show\n redirect_to home_path\n end", "def show\n @recommend_recommend_tag = Recommend::RecommendTag.find(params[:id])\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), recommend_recommend_tag_path(@recommend_recommend_tag)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommend_recommend_tag }\n end\n end", "def show\n if @user == current_user\n redirect_to my_account_url\n return\n end\n\n session[:user_return_to] = nil\n #unless @user.agent\n # redirect_to new_user_agent_url(@user); return\n #end\n if defined?(EnjuBookmark)\n @tags = @user.bookmarks.tag_counts.sort{|a,b| a.count <=> b.count}.reverse\n end\n\n @manifestation = Manifestation.pickup(@user.keyword_list.to_s.split.sort_by{rand}.first) rescue nil\n\n respond_to do |format|\n format.html # show.html.erb\n format.html.phone\n format.json { render json: @user }\n end\n end", "def show\n @app = App.find_by_id(params[:id])\n if (@app)\n Rabl.render(@app, 'api/apps/show', view_path: 'app/views')\n else\n render status: 401, json: {error: \"Invalid app\"}\n end\n end", "def new\n @recommendation = App.new\n end", "def show\n @learner = @activity.find_or_create_learner(current_user)\n respond_to do |format|\n# format.html { render :layout => 'layouts/show_activity' } # show.rhtml\n format.html # show.rhtml\n format.xml { render :xml => @activity.to_xml }\n end\n end", "def show\n if @onda.youtube_id.present?\n render \"youtube\", layout: false\n elsif @onda.facebook_video_url.present?\n render \"facebook\", layout: false\n else\n render layout: false\n end\n end", "def show\n # FIXME: redirect this to variants or do some transparent hoisting\n end", "def show\n \tredirect_to root_path\n end", "def show\n\t\t#show now run by find_book and before_action\n\t\t#keeps code dry\n\tend", "def show\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @suggestion }\n end\n end", "def show\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @suggestion }\n end\n end", "def show\n @helocapp = Helocapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @helocapp }\n end\n end", "def index\n @blog_recommendations = Blog::Recommendation.all\n end", "def show\n @educator = Educator.first(:conditions => \"id = #{params[:id]}\")\n if @educator.nil?\n redirect_to educators_path \n else\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @educator }\n end\n end\n end", "def index\n @book_recommendations = BookRecommendation.all\n end", "def show\n @recommend_recommend_quiz = Recommend::RecommendQuiz.find(params[:id])\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), recommend_recommend_quiz_path(@recommend_recommend_quiz)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommend_recommend_quiz }\n end\n end", "def new\n @recommendation = Recommendation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recommendation }\n end\n end", "def new\n @recommendation = Recommendation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recommendation }\n end\n end", "def recommend_articles\n @user = User.find(params[:user_id])\n @articles = @user.recommend_articles.accessibles(current_user).order_by_recommendations_count_desc.paginate(page: params[:page], per_page: Article::PER_PAGE) unless @user.blank?\n @more_link_path = more_articles_path(user_id: params[:user_id], page: @articles.next_page, articles_type: Article::List::Type::RECOMMEND)\n respond_to do |format|\n format.html { render 'articles_by_user' }\n end\n unless @articles.any?\n flash[:alert] = get_resource 'no_article'\n end\n end", "def show\n @artist = Artist.find(params[:id])\n unless @artist.belongs_to_this_brand?(website)\n redirect_to artists_path and return\n end\n if @artist.featured || @artist.artist_tier.show_on_artist_page?\n respond_to do |format|\n format.html { render_template } # show.html.erb\n # format.xml { render xml: @artist }\n end\n else\n redirect_to all_artists_path(letter: @artist.name.match(/\\w/).to_s.downcase) and return false\n end\n end", "def show\n @recipes = @preptime.recipes.reorder(preptime_order_by(\"recipes\")).paginate(page: params[:page], per_page: 2)\n @title = \"Recipes with prep time: \" + @preptime.name\n # goto render /views/preptimes/show.html.erb using /shared/_show_recipes using @recipes, @title\n end", "def show\n @userapp = Userapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @userapp }\n end\n end", "def show\n case params[:mode]\n when 'send_email'\n if user_signed_in?\n Notifier.manifestation_info(current_user.id, @manifestation.id).deliver_later\n flash[:notice] = t('page.sent_email')\n redirect_to manifestation_url(@manifestation)\n return\n else\n access_denied\n return\n end\n end\n\n return if render_mode(params[:mode])\n\n flash.keep(:search_query)\n\n if @manifestation.series_master?\n flash.keep(:notice) if flash[:notice]\n flash[:manifestation_id] = @manifestation.id\n redirect_to manifestations_url(parent_id: @manifestation.id)\n return\n end\n\n if defined?(EnjuCirculation)\n @reserved_count = Reserve.waiting.where(manifestation_id: @manifestation.id, checked_out_at: nil).count\n @reserve = current_user.reserves.where(manifestation_id: @manifestation.id).first if user_signed_in?\n end\n\n if defined?(EnjuQuestion)\n @questions = @manifestation.questions(user: current_user, page: params[:question_page])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.html.phone\n format.xml {\n case params[:mode]\n when 'related'\n render template: 'manifestations/related'\n else\n render xml: @manifestation\n end\n }\n format.rdf\n format.ttl\n format.mods\n format.json\n format.text\n format.js\n format.xlsx\n end\n end", "def show\n @application = Application.find(params[:id])\n end", "def show\n if !current_user.admin\n redirect_to root_path\n end\n @submission = @recommendation.submission\n end", "def show\n \n \n if [email protected]_users\n redirect_to :back, notice: \"You are not a discover user on this study\"\n \n else\n render :layout=>\"study_steps\", :locals=>{:in_association=>false, :wizard_path=>study_steps_path+'/contributor'}\n\n end\n \n \n \n end", "def show\n @application = Application.find(params[:id])\n end", "def show\n @appsoft = Appsoft.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @appsoft }\n end\n end", "def show_for_app(app)\n styled_header(\"Resources for #{app}\")\n\n addons = get_addons(:app => app).\n # the /apps/:id/addons endpoint can return more than just those owned\n # by the app, so filter:\n select { |addon| addon['app']['name'] == app }\n\n display_addons(addons, %w[Plan Name Price])\n\n display('') # separate sections\n\n styled_header(\"Attachments for #{app}\")\n display_attachments(get_attachments(:app => app), ['Name', 'Add-on', 'Billing App'])\n end", "def show\n # We have used the friendly_id that's why need to write like the below to add the views count\n impressionist(@book, \"books...\")\n end", "def apphelp_protected_show_link( obj, name = nil )\n return apphelp_unknown_quantity_warning() if ( obj.nil? )\n\n name = obj.name if ( name.nil? )\n link = apphelp_protected_link_to(\n :show,\n {\n :model => obj.class,\n :method => :url_for\n },\n obj\n ) { h( name ) }\n\n return ( link.empty? ) ? h( name ) : link\n end", "def show\n @approval = Approval.find(params[:id])\n @recommendation = Recommendation.find(@approval.recommendation_id)\n @approvals = @recommendation.approvals.find(:all, :order => \"created_at ASC\")\n @rec_user = User.find(@recommendation.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def show\n @user = current_user\n @notebook = @user.notebooks.find(params[:id])\n @title = @notebook.name\n @lessons = @notebook.lessons\n if @lessons.length == 0 && current_user.id == @notebook.user_id\n redirect_to new_notebook_lesson_path(@notebook)\n return\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @notebook }\n end\n end", "def show\n @user ||= current_user\n @app = @user.apps.find(params[:id]) \n end", "def show\n @question = @page.questions.find(params[:id])\n session[:breadcrumbs].add \"#{@question.short_title}\"\n\n initialize_fake_app_for_preview\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question }\n end\n end", "def show\n @recommender = User.where(username: params[:username]).first.recommender\n if @recommender.nil?\n render json: \"No Recommender of this user found\"\n else\n render json: @recommender.to_json(only: :latest_recommendation)\n end\n end", "def show\n @installation = Installation.find(params[:installation_id]) \n @offpost = Offpost.find(params[:id])\n @learn = @offpost.learns\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offpost }\n end\n end", "def show\n @event_suggestion = EventSuggestion.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to :controller => 'myAccount', :action => 'index' } # show.html.erb\n format.xml { render :xml => @event_suggestion }\n end\n end", "def show\n redirect_to :root, notice: 'There\\'s nothing to see at the URL entered.'\n end", "def show\n\t\trender 'index'\n\tend", "def show\n @app = App.find_by(uid: params[:uid]) \n end", "def show\n if not user_signed_in?\n share()\n else\n authorize_action_for(@prediction)\n authenticate_user!\n unseen_activities()\n @agreeUsers = User.joins(:challenges).where(challenges: { prediction: @prediction, agree: true})\n @disagreeUsers = User.joins(:challenges).where(challenges: { prediction: @prediction, agree: false})\n render 'show'\n end\n end", "def show\n redirect_to root_path if current_user.blocked_by? User.find(params[:user_id])\n @user = User.find(params[:user_id])\n @player_profile = @user.player_profile\n unless @player_profile.nil?\n @similar_profiles = User.recommender(@player_profile, \"player\")\n @similar_profiles = recommend_set(@similar_profiles, @user) & User.location(current_user, \"0\")\n else\n @similar_profiles = nil\n end\n end", "def show\n\t\t@book = Book.find(params[:id])\n\t\t@in_favs = @user.favorite_exists?(@book)\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\tend\n\tend", "def show\n if should_skip_to_first_child?\n redirect_to refinery.url_for(first_live_child.url) and return\n elsif page.link_url.present?\n redirect_to page.link_url and return\n elsif should_redirect_to_friendly_url?\n redirect_to refinery.url_for(page.url), :status => 301 and return\n end\n\n render_with_templates?\n end", "def show\n if should_skip_to_first_child?\n redirect_to refinery.url_for(first_live_child.url) and return\n elsif page.link_url.present?\n redirect_to page.link_url and return\n elsif should_redirect_to_friendly_url?\n redirect_to refinery.url_for(page.url), :status => 301 and return\n end\n\n render_with_templates?\n end", "def show\n render layout: 'layouts/application'\n end", "def show\n @fullwidth = true\n if @user.is_artist\n @artist = @user\n if user_signed_in?\n @review = Review.find_by(receiving_user_id: @artist.id, leaving_user_id: current_user.id)\n @review.nil? ? @review = Review.new : @review\n end\n @reviews = @artist.received_reviews.page(params[:page]).order('updated_at DESC').per(25)\n @artist.view_count.present? ? @artist.view_count += 1 : @artist.view_count = 0\n @artist.save\n else\n @reviews = @user.left_reviews.page(params[:page]).order('updated_at DESC').per(25)\n end\n if params[:review].present?\n top_review = Review.find(params[:review])\n if params[:response_link].present?\n render 'show', locals: {top_review: top_review, response_link: true}\n else\n render 'show', locals: {top_review: top_review}\n end\n else\n respond_to do |format|\n format.html { render 'show' }\n format.js { render action: 'paginate_reviews' }\n end\n end\n end", "def show\n @classified = Classified.find_by_permalink(params[:id])\n\n if @classified.nil?\n render :file => \"#{RAILS_ROOT}/public/404.html\", :status => 404\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @classified }\n end\n end", "def show\n unless @item\n render text: \"Page not found\" , status: 404\n end\n end", "def show\n @supplier = Supplier.find(params[:id])\n @pagetitle = \"Suppliers - #{@supplier.name}\"\n end", "def show\n @supplier = Supplier.find(params[:id])\n @pagetitle = \"Suppliers - #{@supplier.name}\"\n end", "def show\n sense_data = {} # TODO Sense.new(sense_params).call\n\n render template: \"user/sense/show\", locals: {sense_data: sense_data}\n end", "def show\n @engineer = Engineer.find(params[:id])\n @picture = get_resource(get_picture_label)\n @resume = get_resource(get_resume_label)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @engineer }\n end\n end", "def show\n render :view\n end", "def featured\n render '/home/app'\n end", "def show\n load_welcome_new_user_info\n\n @thing = Thing.find(params[:id])\n set_page_title @thing.name_with_brand\n @page_description = @thing.description\n @page_keywords += \",#{@thing.brand_name},#{@thing.name}\" if @thing.brand\n \n @comment = Comment.new\n @comment.thing = @thing\n \n check_if_has_site_access(false)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def show\n unless @dish.my_chef?(@chef)\n redirect_to :chef_dishes\n end\n end", "def show\n @offer = Offer.find params[:id]\n render layout: nil\n end", "def show\n @occasion = Occasion.find(params[:id])\n @products = Product.all\n @productcats = ProductCat.all\n @gift_types = GiftType.all\n @order = Order.new\n @subscription = Subscription.new\n if @my_recommendation = @occasion.product_recommendations.first\n @recommendation = current_user.recommendations.find_by_product_id_and_occasion_id(@my_recommendation.id,@occasion.id) || current_user.recommendations.build(:product_id => @my_recommendation.id, :occasion_id => @occasion.id)\n end\n\n if @my_recommendation\n @product = Product.find(@my_recommendation.id)\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @occasion }\n end\n end", "def show\n render :index\n end", "def show\n # TODO\n end", "def show\n # TODO\n end", "def show\n\t\t#will have template\n\tend", "def show\n render :index\n end" ]
[ "0.6652366", "0.6652366", "0.66444224", "0.65463555", "0.6293512", "0.6205064", "0.61723804", "0.6117695", "0.60913736", "0.60365653", "0.6010551", "0.60035425", "0.5958093", "0.5955163", "0.5933526", "0.5902165", "0.5866141", "0.5815659", "0.5805442", "0.5796318", "0.5781879", "0.57731164", "0.57712543", "0.57470816", "0.57437134", "0.5738286", "0.5734989", "0.5731268", "0.5722139", "0.5721657", "0.57136434", "0.5705257", "0.57028276", "0.56885946", "0.56697744", "0.5650856", "0.5641462", "0.56399477", "0.56260675", "0.56212115", "0.56211257", "0.56190544", "0.561434", "0.5607465", "0.5604734", "0.5604734", "0.56032896", "0.5603047", "0.5601179", "0.5600942", "0.5600298", "0.5597846", "0.5597846", "0.55969507", "0.5590741", "0.5589905", "0.55842274", "0.5578733", "0.5571813", "0.5565422", "0.5560387", "0.5559695", "0.5557996", "0.55567175", "0.55354327", "0.5531186", "0.55294937", "0.55281454", "0.5527993", "0.5525443", "0.5519062", "0.5515732", "0.5503283", "0.5502085", "0.5492377", "0.54901594", "0.54884744", "0.5487497", "0.5482989", "0.5479189", "0.5479189", "0.54720396", "0.54713327", "0.547116", "0.54685885", "0.54676294", "0.54676294", "0.5465706", "0.5463629", "0.54618347", "0.546163", "0.54602563", "0.5455373", "0.54529667", "0.5450505", "0.54498106", "0.5432851", "0.5432851", "0.5431106", "0.5429147" ]
0.79500365
0
wired to app/views/recommendations/new.html.erb by default (naming convention) that view GET a blank form for creating a new recommendation, submitting with POST
def new @recommendation = App.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @recommend = Recommend.new\n\n respond_to do |format|\n format.html\n format.json { render json: @recommend }\n end\n end", "def new\n @recommendation = Recommendation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recommendation }\n end\n end", "def new\n @recommendation = Recommendation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recommendation }\n end\n end", "def new\n\t\t@recommendation = Recommendation.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @recommendation }\n\t\tend\n\tend", "def new\n # this is the form for adding a new review\n # once we generated the model \"Review\", using the variable we are adding a form to feed into the db\n @review = Review.new\n end", "def new\n\t\t# no code needed here; all handled in the view\n\tend", "def new\n @page_title = \"New Recipe\"\n @recipe = current_user.recipes.build\n @btnText = \"Create Recipe\"\n @obj = @recipe\n render 'shared/form'\n end", "def new\n @page_title = \"New Recipe\"\n @recipe = current_user.recipes.build\n @btnText = \"Create Recipe\"\n @obj = @recipe\n render 'shared/form'\n end", "def new\n @recommendation = Recommendation.new\n @rr = RecommendationRequest.find(params[:request])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommendation }\n end\n end", "def new\n @suggestion = Suggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suggestion }\n end\n end", "def new\n @suggestion = Suggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suggestion }\n end\n end", "def new\n\t\t@review = Review.new\n\t\[email protected] = Establishment.new\n\t\[email protected] = Category.new\n\t\[email protected] = Clientele.new\n\t\[email protected]_level = SoundLevel.new\n\t\[email protected] = Hygiene.new\n\t\[email protected] = Rating.new\n\t\t\n\t\tcollect_additional_params()\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @review }\n\t\tend\n\tend", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review }\n end\n end", "def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @create_rating = CreateRating.new\n\n respond_to do |format|\n \n format.html # new.html.erb\n format.xml { render :xml => @create_rating }\n end\n end", "def new\n @recommend_recommend_ptag = Recommend::RecommendPtag.new\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_recommend_recommend_ptag_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommend_recommend_ptag }\n end\n end", "def new\n #just show me the form\nend", "def new\n render\n end", "def new\n render\n end", "def new\n render\n end", "def new\n render\n end", "def new\n @recommend_recommend_tag = Recommend::RecommendTag.new\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_recommend_recommend_tag_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommend_recommend_tag }\n end\n end", "def new\n @ecnreview_form = EcnreviewForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ecnreview_form }\n end\n end", "def new\n @person = Person.new #will create a blank person in memory but it will not have an id nor will it save it in memory\n @term = 'Add Person'\n render partial: 'form' #this will send it to the form page\n end", "def new\n @requisition = Requisition.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n render 'new.html.erb'\n \n end", "def create\n @recommendation = Recommendation.new\n\n respond_to do |format|\n if @recommendation.save\n format.html { redirect_to @recommendation, notice: 'Recommendation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recommendation }\n else\n format.html { render action: 'new' }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n # using the render method is not necessary if there is a view in 'views/questions'\n # with the same name as the action 'new'\n @question = Question.new\n\n end", "def new\n # render new.html\n end", "def new\n respond_to do |format|\n format.html\n end\n end", "def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end", "def new\n # default: render 'new' template\n end", "def new\n # default: render 'new' template\n end", "def new\n # default: render 'new' template\n end", "def new\n # default: render 'new' template\n end", "def create\n @recommendation = Recommendation.new(params[:recommendation])\n\n respond_to do |format|\n if @recommendation.save\n flash[:notice] = 'Recommendation was successfully created.'\n format.html { redirect_to(@recommendation) }\n format.xml { render :xml => @recommendation, :status => :created, :location => @recommendation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recommendation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n # @recipe = Recipe.new\n #\n new! do |format|\n # format.html # new.html.erb\n # format.json { render json: @recipe }\n end\n end", "def new\n # Using the render method is not necessary if\n # there is a view in `views/questions` with the\n # same name as the action `new`\n @question = Question.new\n end", "def new\n @m_rating = MRating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @m_rating }\n end\n end", "def new\n @recommend_recommend_other = Recommend::RecommendOther.new\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_recommend_recommend_other_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommend_recommend_other }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @professor_review = ProfessorReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @professor_review }\n end\n end", "def new\n @review = Review.new\nend", "def new\n @suggestion = Suggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @suggestion }\n end\n end", "def new\n @researcher = Researcher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @researcher }\n end\n end", "def new\n render :new\n end", "def new\n\t\tif !authenticate_user!(\"You must be logged in to write a review. Login now or sign up!\", true) \n\t\t\treturn \n\t\tend\t\t\n\t\t@store_review = @store.store_reviews.build\t\t\n\t\trender layout: false\t\t\n\tend", "def new\n respond_to do |format|\n format.html { render :layout => 'application' }\n format.xml { render :xml => @recommand }\n end\n end", "def new\n @snippet = Snippet.new\n\n respond_to do |format|\n format.html { render layout: 'form' }# new.html.erb\n format.json { render json: @snippet }\n end\n end", "def new\n @page_title = 'Create Army'\n respond_to do |format|\n format.html # render new.html.erb\n end\n end", "def new\n render 'new'\n end", "def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @review_type = ReviewType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review_type }\n end\n end", "def create\n @recommend_recommend_other = Recommend::RecommendOther.new(params[:recommend_recommend_other])\n\n respond_to do |format|\n if @recommend_recommend_other.save\n format.html { redirect_to @recommend_recommend_other, notice: 'Recommend other was successfully created.' }\n format.json { render json: @recommend_recommend_other, status: :created, location: @recommend_recommend_other }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recommend_recommend_other.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @form_of_receits = FormOfReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @recipe_page = RecipePage.new\n end", "def new\n @recipe = Recipe.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe }\n end\n end", "def new\n # render(:new) => this whole action could also be implicit\n end", "def new\n render \"new\"\n end", "def new\n render \"new\"\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_training_class }\n end\n end", "def new\n # Define a new question to properly generate a form\n @question = Question.new\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_review_product }\n end\n end", "def new\n # Not generally used. Most people want to vote via AJAX calls.\n end", "def new\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommender }\n end\n end", "def new\n @question = Question.new\n render :new\n end", "def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @questionnaire }\n end\n end", "def create\n @recommended = Recommended.new(recommended_params)\n\n respond_to do |format|\n if @recommended.save\n format.html { redirect_to @recommended, notice: 'Recommended was successfully created.' }\n format.json { render :show, status: :created, location: @recommended }\n else\n format.html { render :new }\n format.json { render json: @recommended.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe }\n end\n end", "def new\n @thesis_review = ThesisReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thesis_review }\n end\n end", "def new\n @object = @model_class.new\n respond_to do |format|\n format.html { render :template => views_directory + '/form' }\n format.xml { render :xml => @object }\n end\n end", "def new\n @review_of_dish = ReviewOfDish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review_of_dish }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suggestion_type }\n end\n end", "def new\n render layout: false\n end", "def new\n @favourite = Favourite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @favourite }\n end\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n\t\trender layout: false\n\tend", "def new\n @prefer = Prefer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prefer }\n end\n end", "def new\n @book_review = BookReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_review }\n end\n end", "def new\n # @feedback = Feedback.new\n # \n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @feedback }\n # end\n end", "def new\n @rating_alt = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating_alt }\n end\n end" ]
[ "0.7623733", "0.7510904", "0.7510904", "0.7254059", "0.7253947", "0.7070545", "0.6916067", "0.6916067", "0.67938554", "0.67545456", "0.67545456", "0.67349833", "0.67207897", "0.67207897", "0.6696563", "0.6690227", "0.6687838", "0.6671333", "0.6657233", "0.6657233", "0.6657233", "0.6657233", "0.66493505", "0.6642722", "0.6629721", "0.661389", "0.6607064", "0.660056", "0.6595214", "0.6595214", "0.6595214", "0.6595214", "0.6595214", "0.6595214", "0.65937245", "0.6589215", "0.6577364", "0.6566659", "0.65656096", "0.65656096", "0.65656096", "0.65656096", "0.65611875", "0.65566516", "0.6513572", "0.6503651", "0.65019804", "0.64963466", "0.64963466", "0.64963466", "0.64963466", "0.64963466", "0.64963466", "0.64930904", "0.6487439", "0.6484564", "0.6483971", "0.6480006", "0.64793324", "0.647574", "0.6474901", "0.64741045", "0.6473937", "0.6470129", "0.64568084", "0.64494705", "0.64466035", "0.64346224", "0.6433855", "0.6433137", "0.642714", "0.642714", "0.642588", "0.64120996", "0.6407099", "0.64064586", "0.64015764", "0.63994443", "0.639057", "0.63874865", "0.6386073", "0.63849235", "0.63829243", "0.63824886", "0.63767046", "0.6373426", "0.63728726", "0.6368927", "0.6368927", "0.6368927", "0.6368927", "0.6368927", "0.6368927", "0.6368927", "0.6368927", "0.63654006", "0.63503844", "0.6347972", "0.6338216", "0.63335264" ]
0.65902364
35
POST a newly filled form to create a new recommendation
def create if true #@recommendation = Recommendation.new() #@recommendation.nameDotNumber = params[:app][:nameDotNumber] #@recommendation.course = params[:app][:course] @new_rec = App.find_by(:nameDotNumber => params[:recommendation][:nameDotNumber]) @new_rec.update(:approved => "true") @new_rec.save if @recommendation.save redirect_to @recommendation, notice: "Successfully Saved!" else render new end else redirect_to home_url flash.alert = "No Recommendations available!" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @recommendation = Recommendation.new(recommendation_params)\n respond_to do |format|\n if @recommendation.save\n format.html { redirect_to @recommendation, notice: \"Recommendation was successfully created.\" }\n format.json { render :show, status: :created, location: @recommendation }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommendation = Recommendation.new(recommendation_params)\n @submission = Submission.find_by_user_id(current_user.id)\n @recommendation.submission_id = @submission.id\n\n respond_to do |format|\n if @recommendation.save\n RecommendationRequestMailer.recommendation_request(@recommendation).deliver\n format.html { redirect_to dashboard_home_path, notice: 'Recommendation was successfully created.' }\n format.json { render :show, status: :created, location: @recommendation }\n else\n format.html { render :new }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommendation = Recommendation.new\n\n respond_to do |format|\n if @recommendation.save\n format.html { redirect_to @recommendation, notice: 'Recommendation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recommendation }\n else\n format.html { render action: 'new' }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommended = Recommended.new(recommended_params)\n\n respond_to do |format|\n if @recommended.save\n format.html { redirect_to @recommended, notice: 'Recommended was successfully created.' }\n format.json { render :show, status: :created, location: @recommended }\n else\n format.html { render :new }\n format.json { render json: @recommended.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommendation = Recommendation.new(params[:recommendation])\n\n respond_to do |format|\n if @recommendation.save\n flash[:notice] = 'Recommendation was successfully created.'\n format.html { redirect_to(@recommendation) }\n format.xml { render :xml => @recommendation, :status => :created, :location => @recommendation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recommendation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @inchef_recommendation = InchefRecommendation.new(inchef_recommendation_params)\n\n respond_to do |format|\n if @inchef_recommendation.save\n format.html { redirect_to @inchef_recommendation, notice: 'Inchef recommendation was successfully created.' }\n format.json { render :show, status: :created, location: @inchef_recommendation }\n else\n format.html { render :new }\n format.json { render json: @inchef_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book_recommendation = BookRecommendation.new(book_recommendation_params)\n\n respond_to do |format|\n if @book_recommendation.save\n format.html { redirect_to @book_recommendation, notice: 'Book recommendation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book_recommendation }\n else\n format.html { render action: 'new' }\n format.json { render json: @book_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommend_recommend_other = Recommend::RecommendOther.new(params[:recommend_recommend_other])\n\n respond_to do |format|\n if @recommend_recommend_other.save\n format.html { redirect_to @recommend_recommend_other, notice: 'Recommend other was successfully created.' }\n format.json { render json: @recommend_recommend_other, status: :created, location: @recommend_recommend_other }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recommend_recommend_other.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommend_recommend_quiz = Recommend::RecommendQuiz.new(params[:recommend_recommend_quiz])\n\n respond_to do |format|\n if @recommend_recommend_quiz.save\n format.html { redirect_to @recommend_recommend_quiz, notice: 'Recommend quiz was successfully created.' }\n format.json { render json: @recommend_recommend_quiz, status: :created, location: @recommend_recommend_quiz }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recommend_recommend_quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @recommend = Recommend.new\n\n respond_to do |format|\n format.html\n format.json { render json: @recommend }\n end\n end", "def create\n @blog_recommendation = Blog::Recommendation.new(blog_recommendation_params)\n\n respond_to do |format|\n if @blog_recommendation.save\n format.html { redirect_to @blog_recommendation, notice: 'Recommendation was successfully created.' }\n format.json { render :show, status: :created, location: @blog_recommendation }\n else\n format.html { render :new }\n format.json { render json: @blog_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n i = Item.new\n i.title = params[\"title\"]\n i.description = params[\"desc\"]\n i.save\n redirect_to recommendations_url\n end", "def new\n # this is the form for adding a new review\n # once we generated the model \"Review\", using the variable we are adding a form to feed into the db\n @review = Review.new\n end", "def new\n @recommendation = Recommendation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recommendation }\n end\n end", "def new\n @recommendation = Recommendation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recommendation }\n end\n end", "def new\n\t\t@recommendation = Recommendation.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @recommendation }\n\t\tend\n\tend", "def new\n @recommendation = App.new\n end", "def create\n @recommend_recommend_tag = Recommend::RecommendTag.new(params[:recommend_recommend_tag])\n\n respond_to do |format|\n if @recommend_recommend_tag.save\n format.html { redirect_to @recommend_recommend_tag, notice: 'Recommend tag was successfully created.' }\n format.json { render json: @recommend_recommend_tag, status: :created, location: @recommend_recommend_tag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recommend_recommend_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommendation = current_user.recommendations.build(params[:recommendation])\n @users=User.all\n @products=Product.all\n @occasions=Occasion.all\n\n respond_to do |format|\n if @recommendation.save\n format.html { redirect_to occasion_path(@recommendation.occasion_id)}\n format.json { render json: @recommendation, status: :created, location: @recommendation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @recommendation = Recommendation.new\n @rr = RecommendationRequest.find(params[:request])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommendation }\n end\n end", "def create\n @movie_user_recommendation = MovieUserRecommendation.new(movie_user_recommendation_params)\n\n respond_to do |format|\n if @movie_user_recommendation.save\n format.html { redirect_to @movie_user_recommendation, notice: 'Recommendation was successfully created.' }\n format.json { render :show, status: :created, location: @movie_user_recommendation }\n else\n format.html { render :new }\n format.json { render json: @movie_user_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommendation = Recommendation.new\n @recommendation.rr_id = params[:rr_id]\n @recommendation.user_id = current_user.id\n @recommendation.place_id = params[:place_id]\n @recommendation.comment = params[:comment]\n\n respond_to do |format|\n if @recommendation.save\n format.html { redirect_to recommendation_request_path(params[:rr_id]), notice: 'Recommendation was successfully created.' }\n format.json { render json: @recommendation, status: :created, location: @recommendation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommend_recommend_subject = Recommend::RecommendSubject.new(params[:recommend_recommend_subject])\n\n respond_to do |format|\n if @recommend_recommend_subject.save\n format.html { redirect_to @recommend_recommend_subject, notice: 'Recommend subject was successfully created.' }\n format.json { render json: @recommend_recommend_subject, status: :created, location: @recommend_recommend_subject }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recommend_recommend_subject.errors, status: :unprocessable_entity }\n end\n end\n end", "def recommendation_params\n params.require(:recommendation).permit(:name, :detail, :rating)\n end", "def feedback_form\n @feedback = Feedback.new(params[:feedback])\n @feedback.save if params[:feedback]\n end", "def create\n\t\t@recommendation = Recommendation.new(params[:recommendation])\n\t\t#sleep 1\n\t\t#render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)\n\n\t\trespond_to do |format|\n\t\t\tif @recommendation.save\n\t\t\t\tformat.html { redirect_to @recommendation, notice: 'Recommendation was successfully created.' }\n\t\t\t\tformat.json { render json: @recommendation, status: :created, location: @recommendation }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @recommendation.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def recommendation_params\n params.require(:recommendation).permit(\n :address,\n :email,\n :capacity,\n :communication,\n :department,\n :habits,\n :institution,\n :maturity,\n :motivation,\n :name,\n :personality,\n :rating,\n :recommendation,\n :responsibility,\n :title,\n :years,\n )\n end", "def create\n @requisition = Requisition.new(params[:requisition])\n\n respond_to do |format|\n if @requisition.save\n format.html {redirect_to root_url, notice: 'Requisition was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def create\n\t\t@feedback = Feedback.new(params[:feedback])\n\t\tif @feedback.save\n\t\t\tredirect_to(about_path, :notice => \"Message was successfully sent.\")\n\tend\n# need this to save the form, take the @professor parameter\n# and save it in this new params\nend", "def create\n @recommend_recommend_ptag = Recommend::RecommendPtag.new(params[:recommend_recommend_ptag])\n\n respond_to do |format|\n if @recommend_recommend_ptag.save\n format.html { redirect_to @recommend_recommend_ptag, notice: 'Recommend ptag was successfully created.' }\n format.json { render json: @recommend_recommend_ptag, status: :created, location: @recommend_recommend_ptag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recommend_recommend_ptag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \tlogger.debug \"Debug Value!\"\n\tparamshash = params[:recommendation]\n\tlogger.debug paramshash\n\t@titlevalue = paramshash['title']\n\tlogger.debug @titlevalue\n @recommendation = Recommendation.new(params[:recommendation])\n @recommendation.instant_id = Instant.find_by_title(@titlevalue)\n respond_to do |format|\n if @recommendation.save\n format.html { redirect_to(@recommendation, :notice => 'Recommendation was successfully created.') }\n format.xml { render :xml => @recommendation, :status => :created, :location => @recommendation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recommendation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @reviews_and_rating = ReviewsAndRating.new(reviews_and_rating_params)\n\n respond_to do |format|\n if @reviews_and_rating.save\n format.html { redirect_to @reviews_and_rating, notice: 'Reviews and rating was successfully created.' }\n format.json { render :show, status: :created, location: @reviews_and_rating }\n else\n format.html { render :new }\n format.json { render json: @reviews_and_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @assignment_form = AssignmentForm.new\n @assignment_form.assignment.instructor ||= current_user\n @num_submissions_round = 0\n @num_reviews_round = 0\n @default_num_metareviews_required = 3\n end", "def create\n @suggestion = Suggestion.new(suggestion_params)\n respond_to do |format|\n if @suggestion.save\n format.html { redirect_to @suggestion, notice: 'Thank you for your suggestion!' }\n format.json { render :show, status: :created, location: @suggestion }\n else\n format.html { render :new }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.new(params[:recommender])\n\n respond_to do |format|\n if @recommender.save\n format.html { redirect_to collection_recommenders_path(@collection), notice: 'Recommender was successfully created.' }\n format.json { render json: @recommender, status: :created, location: @recommender }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recommender.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ecnreview_form = EcnreviewForm.new(params[:ecnreview_form])\n\n respond_to do |format|\n if @ecnreview_form.save\n format.html { redirect_to(@ecnreview_form, :notice => 'Ecnreview form was successfully created.') }\n format.xml { render :xml => @ecnreview_form, :status => :created, :location => @ecnreview_form }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ecnreview_form.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @admin_nature_of_review = Admin::NatureOfReview.new(admin_nature_of_review_params)\n\n respond_to do |format|\n if @admin_nature_of_review.save\n format.html { redirect_to @admin_nature_of_review, notice: 'Nature of review was successfully created.' }\n format.json { render :show, status: :created, location: @admin_nature_of_review }\n else\n format.html { render :new }\n format.json { render json: @admin_nature_of_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @appreciation = Appreciation.new(appreciation_params)\n\n respond_to do |format|\n if @appreciation.save \n @appreciation.parse\n \n format.html { redirect_to @appreciation, notice: 'Appreciation was successfully created.' }\n format.json { render :show, status: :created, location: @appreciation }\n else\n format.html { render :new }\n format.json { render json: @appreciation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reccomendation = Reccomendation.new(reccomendation_params)\n\n respond_to do |format|\n if @reccomendation.save\n format.html { redirect_to @reccomendation, notice: 'Reccomendation was successfully created.' }\n format.json { render :show, status: :created, location: @reccomendation }\n else\n format.html { render :new }\n format.json { render json: @reccomendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @form_of_receits = FormOfReceipt.new(params[:form_of_receits])\n\n respond_to do |format|\n if @form_of_receit.save\n format.html { redirect_to(@form_of_receits, :notice => 'Teste was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def new\n @advicepost = Advicepost.new\n #set user id attribute\n @advicepost.advisor_id = current_advisor.id\n @advicepost.status = \"Submitted\"\n \n @rating = Rating.new\n @rating.score = 0\n @rating.advisor_id = current_advisor.id\n @rating.rating_select = nil\n \n @advisor = Advisor.find(:first, :conditions => {:id=>current_advisor.id})\n @advisor.status = params[:status]\n @advisor.tokenID = params[:tokenID]\n @advisor.refundTokenID = params[:refundTokenID]\n @advisor.save\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advicepost }\n end\n end", "def create\n @requisition = Requisition.new(params[:requisition])\n\n respond_to do |format|\n if @requisition.save\n format.html { redirect_to @requisition, notice: 'Requisition was successfully created.' }\n format.json { render json: @requisition, status: :created, location: @requisition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @requisition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rating_answer = RatingAnswer.new(rating_answer_params)\n\n respond_to do |format|\n if @rating_answer.save\n format.html { redirect_to @rating_answer, notice: 'Rating answer was successfully created.' }\n format.json { render :show, status: :created, location: @rating_answer }\n else\n format.html { render :new }\n format.json { render json: @rating_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def recommendation_params\n params.require(:recommendation).permit(:is_obligatory, :group_id, :course_id, :text)\n end", "def new\n load_form_data\n @book = Book.new\n end", "def create\n @rating = Rating.new(rating_params)\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_back(fallback_location: presets_path, notice: 'rating was sucessefully added') }\n\n else\n format.html { render :new }\n\n end\n end\n end", "def create\n @questionnaire = Questionnaire.new(questionnaire_params)\n @questionnaire.user = current_user\n @questionnaire.user_approval_date = Time.now\n\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully created.' }\n format.json { render action: 'show', status: :created, location: @questionnaire }\n else\n format.html { render action: 'new' }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n\t\t@research_method = ResearchMethod.new(research_method_params)\n\n \t\tif @research_method.save\n \t\tflash[:notice] = \"Successfully created post!\"\n \t\tredirect_to admin_research_methods_path\n \telse\n \t\tflash[:alert] = \"Error creating new post!\"\n \t\trender :new\n \tend\n\tend", "def create\n @restaurant = Restaurant.new(restaurant_params)\n\n if @restaurant.save!\n # send the user to the newly created restaurant show page\n redirect_to @restaurant\n else\n # reload the form view\n render :new\n end\n end", "def create\n @rating_alt = Rating.new(params[:rating_alt])\n\n respond_to do |format|\n if @rating_alt.save\n format.html { redirect_to @rating_alt, notice: 'Rating was successfully created.' }\n format.json { render json: @rating_alt, status: :created, location: @rating_alt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating_alt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @feedback_form = FeedbackForm.new(params[:feedback_form])\n\n respond_to do |format|\n if @feedback_form.save\n format.html { redirect_to @feedback_form, notice: 'Feedback form was successfully created.' }\n format.json { render json: @feedback_form, status: :created, location: @feedback_form }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedback_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @question_learned = QuestionLearned.new(question_learned_params)\n\n respond_to do |format|\n if @question_learned.save\n format.html { redirect_to @question_learned, notice: 'Question learned was successfully created.' }\n format.json { render action: 'show', status: :created, location: @question_learned }\n else\n format.html { render action: 'new' }\n format.json { render json: @question_learned.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @page_title = \"New Recipe\"\n @recipe = current_user.recipes.build\n @btnText = \"Create Recipe\"\n @obj = @recipe\n render 'shared/form'\n end", "def new\n @page_title = \"New Recipe\"\n @recipe = current_user.recipes.build\n @btnText = \"Create Recipe\"\n @obj = @recipe\n render 'shared/form'\n end", "def create\n @terms_of_use = TermsOfUse.new(params[:terms_of_use])\n\n respond_to do |format|\n if @terms_of_use.save\n format.html { redirect_to @terms_of_use, notice: 'Terms of use was successfully created.' }\n format.json { render json: @terms_of_use, status: :created, location: @terms_of_use }\n else\n format.html { render action: \"new\" }\n format.json { render json: @terms_of_use.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @review = Review.new\nend", "def create\n @idea_rating = IdeaRating.new(idea_rating_params)\n\n respond_to do |format|\n if @idea_rating.save\n format.html { redirect_to @idea_rating, notice: (I18n.t :act_create) }\n format.json { render :show, status: :created, location: @idea_rating }\n else\n format.html { render :new }\n format.json { render json: @idea_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @suggestion = Suggestion.new(params[:suggestion])\n flash[:notice] = 'Thank you for your feedback. ' if @suggestion.save\n respond_with(@suggestion, location: root_url)\n end", "def create\n @ingredient_suggestion = IngredientSuggestion.new(ingredient_suggestion_params)\n\n respond_to do |format|\n if @ingredient_suggestion.save\n format.html { redirect_to @ingredient_suggestion, notice: 'Ingredient suggestion was successfully created.' }\n format.json { render :show, status: :created, location: @ingredient_suggestion }\n else\n format.html { render :new }\n format.json { render json: @ingredient_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommended_link = RecommendedLink.new(recommended_link_params)\n\n if @recommended_link.save\n render json: @recommended_link, status: :created, location: @recommended_link\n else\n render json: @recommended_link.errors, status: :unprocessable_entity\n end\n end", "def create\n if params[:research_answer].blank?\n flash[:error] = 'Please select at least one answer'\n redirect_to :back\n else\n @research_answer = ResearchAnswer.new(research_answer_params)\n\n respond_to do |format|\n if @research_answer.save\n format.html { redirect_to :answers_submitted, notice: 'Research answer was successfully created.' }\n # format.json { render :show, status: :created, location: @research_answer }\n else\n format.html { render :new }\n # format.json { render json: @research_answer.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @suggestion = Suggestion.new(suggestion_params)\n if @suggestion.save\n flash[:notice]='Suggestion was successfully created.'\n redirect_to '/'\n else\n flash[:notice]=\"Suggestion could not be created\"\n redirect_to '/'\n end\n end", "def create\n @question = Question.new(question_params)\n @question.save\n notify_reviewers\n redirect_to @question\n end", "def create\n @answer = Form::Answer.new(answer_params)\n respond_to do |format|\n if @answer.save\n format.html { redirect_to thanks_path, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @finale_rating = FinaleRating.new(finale_rating_params)\n\n respond_to do |format|\n if @finale_rating.save\n format.html { redirect_to @finale_rating, notice: 'Finale rating was successfully created.' }\n format.json { render :show, status: :created, location: @finale_rating }\n else\n format.html { render :new }\n format.json { render json: @finale_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe = new_recipe\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n @render_final_form = true\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n # Define a new question to properly generate a form\n @question = Question.new\n end", "def new\n @requisition = Requisition.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def create\n @motivonegativa = Motivonegativa.new(params[:motivonegativa])\n\n respond_to do |format|\n if @motivonegativa.save\n format.html { redirect_to(@motivonegativa, :notice => 'Motivonegativa was successfully created.') }\n format.xml { render :xml => @motivonegativa, :status => :created, :location => @motivonegativa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @motivonegativa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\r\n errors ||= Array.new\r\n if params[:feeling_id].blank?&&Feelings.isExists(params[:feeling_id].to_i)\r\n errors.push(I18n.t(\"errors.messages.element_not_id\"))\r\n end\r\n if params[:item_id].blank? &&ContentItem.isExists(params[:item_id].to_i)\r\n errors.push(I18n.t(\"errors.messages.element_not_id\"))\r\n end\r\n if params[:content].blank?\r\n params[:content] = ''\r\n end\r\n if params[:ue_id].blank? &&UsersExprience.isExists(params[:ue_id].to_i)\r\n params[:ue_id] = nil\r\n end\r\n if errors.length == 0 \r\n Posts.create({user_id: params[:user].id ,asset_id:0, feeling_id:params[:feeling_id].to_i, content_item_id:params[:item_id].to_i,content:params[:content], userExprience_id:params[:ue_id].to_i})\r\n ContentItem.markAsFeelike(params[:user].id,params[:feeling_id].to_i,params[:ue_id],params[:item_id].to_i,0)\r\n self.default_response\r\n else\r\n render :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['formInputError'],I18n.t(\"errors.messages.feelike.input_error\"), errors).to_json\r\n end\r\n end", "def create\n @requisition = Requisition.new(params[:requisition])\n\n respond_to do |format|\n if @requisition.save\n format.html { redirect_to(@requisition, :notice => 'Requisition was successfully created.') }\n format.xml { render :xml => @requisition, :status => :created, :location => @requisition }\n else\n format.html { render \"new\" }\n format.xml { render :xml => @requisition.errors, :status => :unprocessable_entity }\n end\n end\n end", "def submit\n @new = New.new\n end", "def recommendation_params\n params.require(:recommendation).permit(:note, :user_id, :movie_id)\n end", "def create\n @opinion = Opinion.new(opinion_params)\n\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to @opinion, notice: 'Opinion was successfully created.' }\n format.json { render action: 'show', status: :created, location: @opinion }\n else\n format.html { render action: 'new' }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @practitioner = Practitioner.new(practitioner_params)\n\n respond_to do |format|\n if @practitioner.save\n format.html { redirect_to @practitioner, notice: 'Practitioner was successfully created.' }\n format.json { render :show, status: :created, location: @practitioner }\n else\n format.html { render :new }\n format.json { render json: @practitioner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \"\"\"\n on save of researcher form, send the researcher's email \n and their current question number (0) to the researcher\n rankings controller\n \"\"\"\n @researcher = Researcher.new(researcher_params)\n\n respond_to do |format|\n\n if @researcher.save\n format.html { redirect_to controller: 'instruction', action: 'show', email: @researcher.email }\n\n format.json { render action: 'show', status: :created, location: @researcher }\n else\n format.html { render action: 'new' }\n format.json { render json: @researcher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @restaurant_table_rating = RestaurantTableRating.new(restaurant_table_rating_params)\n\n respond_to do |format|\n if @restaurant_table_rating.save\n format.html { redirect_to @restaurant_table_rating, notice: 'Restaurant table rating was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant_table_rating }\n else\n format.html { render :new }\n format.json { render json: @restaurant_table_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questionnaire = Questionnaire.new(questionnaire_params)\n\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to questionnaires_url, notice: \"Questionnaire was successfully created.\" }\n else\n # format.html { render :new, status: :unprocessable_entity }\n format.html { redirect_to new_questionnaire_url, alert: @questionnaire.errors.full_messages.first }\n end\n end\n end", "def new\n\t\tlogger.info \"Before Materialization\"\n\t\tformObject = @client.materialize(\"TQM_Form__c\")\n\t\t#myForm = formObject.find(\"a0AU0000000zrwg\")\n\t\tmyForm = formObject.new\n\t\tmyForm[\"iForm_Table_Name__c\"]=\"test\"\n\t\tmyForm[\"Salesforce_Object__c\"]=\"test\"\n\t\tmyForm.name = \"my name\"\n\t\tmyForm.save\n\t\tputs \"After Materialization\"\n\t\tlogger.info \"After Materialization\"\n\t\tlogger.info myForm[\"name\"]\n\t\tlogger.info myForm[\"iForm_Table_Name__c\"]\n\t\t@lead = Lead.new\n\t\t@lead['OwnerId'] = '005U0000000ZSTx'\n\t\t@lead['IsConverted'] = false\n\t\t@lead['IsUnreadByOwner'] = true\n\t\trespond_to do |format|\n\t\t format.html # new.html.erb\n\t\t format.json { render json: @lead }\n\t\tend\n\tend", "def create\n @paragraph_rating = ParagraphRating.new(params[:paragraph_rating])\n\n respond_to do |format|\n if @paragraph_rating.save\n format.html { redirect_to @paragraph_rating, notice: 'Paragraph rating was successfully created.' }\n format.json { render json: @paragraph_rating, status: :created, location: @paragraph_rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paragraph_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @submitted_exam_regis_form = SubmittedExamRegisForm.new(submitted_exam_regis_form_params)\n\n respond_to do |format|\n if @submitted_exam_regis_form.save\n format.html { redirect_to @submitted_exam_regis_form, notice: 'Submitted exam regis form was successfully created.' }\n format.json { render :show, status: :created, location: @submitted_exam_regis_form }\n else\n format.html { render :new }\n format.json { render json: @submitted_exam_regis_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @frequently_asked = FrequentlyAsked.new(frequently_asked_params)\n\n respond_to do |format|\n if @frequently_asked.save\n format.html { redirect_to @frequently_asked, notice: 'Frequently asked was successfully created.' }\n format.json { render :show, status: :created, location: @frequently_asked }\n else\n format.html { render :new }\n format.json { render json: @frequently_asked.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @favorite_recipe = FavoriteRecipe.new(favorite_recipe_params)\n\n respond_to do |format|\n if @favorite_recipe.save\n format.html { redirect_to @favorite_recipe, notice: 'Favorite recipe was successfully created.' }\n format.json { render :show, status: :created, location: @favorite_recipe }\n else\n format.html { render :new }\n format.json { render json: @favorite_recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @innovation = Innovation.new(innovation_params)\n\n respond_to do |format|\n if @innovation.save\n format.html { redirect_to @innovation, notice: 'Innovation was successfully created.' }\n format.json { render :show, status: :created, location: @innovation }\n else\n format.html { render :new }\n format.json { render json: @innovation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n # Not generally used. Most people want to vote via AJAX calls.\n end", "def create\n @advancement = Advancement.new(params[:advancement])\n\n respond_to do |format|\n if @advancement.save\n format.html { redirect_to @advancement, notice: 'Advancement was successfully created.' }\n format.json { render json: @advancement, status: :created, location: @advancement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @advancement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @food_review = FoodReview.new(food_review_params)\n\n respond_to do |format|\n if @food_review.save\n format.html { redirect_to @food_review, notice: 'Food review was successfully created.' }\n format.json { render :show, status: :created, location: @food_review }\n else\n format.html { render :new }\n format.json { render json: @food_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @create_rating = CreateRating.new(params[:create_rating])\n\n respond_to do |format|\n if @create_rating.save\n format.html { redirect_to(@create_rating, :notice => 'Create rating was successfully created.') }\n format.xml { render :xml => @create_rating, :status => :created, :location => @create_rating }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @create_rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @schooldef = ['FGV', 'other']\n @professor = Professor.new(professor_params)\n @review = Review.new\n respond_to do |format|\n if verify_recaptcha(model: @professor) && @professor.save\n format.html { redirect_to controller: 'reviews', action: 'new', professor_id: @professor.id, notice: 'O professor foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @professor }\n else\n format.html { render :edit, notice: 'Por favor, preencha o captcha.' }\n format.json { render json: @professor.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @designation = Designation.new\n @form_id = 'add-form'\n \n respond_to do |fmt|\n fmt.html { render :partial => 'form' }\n fmt.json { render :json => @designation }\n end\n end", "def create\n @credibility_rating = CredibilityRating.new(credibility_rating_params)\n\n respond_to do |format|\n if @credibility_rating.save\n format.html { redirect_to @credibility_rating, notice: 'Credibility rating was successfully created.' }\n format.json { render :show, status: :created, location: @credibility_rating }\n else\n format.html { render :new }\n format.json { render json: @credibility_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @opinion = Opinion.new(params[:opinion])\n\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to @opinion, notice: 'Opinion was successfully created.' }\n format.json { render json: @opinion, status: :created, location: @opinion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recommendation = current_user.recommendations.new(\n :article_id => params[:article_id])\n authorize @recommendation\n if @recommendation.save\n ArticleRankingWorker.perform_async(params[:article_id])\n render 'api/v1/recommendations/show', status: :created\n else\n render json: @recommendation.errors, status: :unprocessable_entity\n end\n end", "def create\n if params[:recommend][:recommended_type] ==\"Item\"\n @object_id=Item.find_by_url(params[:recommend][:recommended_id]).id\n elsif params[:recommend][:recommended_type] ==\"Matter\" \n @object_id=Matter.find_by_id(params[:recommend][:recommended_id]).id\n elsif params[:recommend][:recommended_type] ==\"Brand\"\n @object_id=Brand.find_by_id(params[:recommend][:recommended_id]).id\n else\n @object_id=params[:recommend][:recommended_id].to_i\n end\n\n params[:recommend][:recommended_id]=@object_id\n @recommend = Recommend.new(params[:recommend]) unless \\\n Recommend.find_by_recommended_type_and_recommended_id(params[:recommend][:recommended_type], @object_id )\n\n respond_to do |format|\n if @recommend and @recommend.save\n format.json { render json: @recommend, status: :created, location: @recommend }\n else\n format.json { render json: @recommend.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @requisicion = Requisicion.new(params[:requisicion])\n\n respond_to do |format|\n if @requisicion.save\n format.html { redirect_to(@requisicion, :notice => 'Requisicion was successfully created.') }\n format.xml { render :xml => @requisicion, :status => :created, :location => @requisicion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @requisicion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vote = Vote.new(vote_params)\n @vote.save\n redirect_to :action => :thanks\n end", "def create\n @requisition = @profile.requisitions.new(requisition_params)\n respond_to do |format|\n if @requisition.save\n format.html { redirect_to @profile, notice: 'Tu solicitid ha sido creada' }\n format.json { render :show, status: :created, location: @requisition }\n else\n format.html do \n flash[:req] = @requisition \n redirect_to action: :new\n # render :new \n end\n format.json { render json: @requisition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @confidence_rating = ConfidenceRating.new(confidence_rating_params)\n\n respond_to do |format|\n if @confidence_rating.save\n format.html { redirect_to @confidence_rating, notice: 'Confidence rating was successfully created.' }\n format.json { render :show, status: :created, location: @confidence_rating }\n else\n format.html { render :new }\n format.json { render json: @confidence_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @adviser = Adviser.new adviser_params\n\n if @adviser.save\n redirect_to advisers_url\n else\n render 'new'\n end\n end", "def create\n @suggested_category = SuggestedCategory.new(suggested_category_params)\n\n respond_to do |format|\n if @suggested_category.save\n format.html { redirect_to @suggested_category, notice: 'Suggested category was successfully created.' }\n format.json { render :show, status: :created, location: @suggested_category }\n else\n format.html { render :new }\n format.json { render json: @suggested_category.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7032842", "0.7019406", "0.70150524", "0.7005337", "0.6943381", "0.6895716", "0.6862189", "0.68396866", "0.68253726", "0.67107415", "0.66553706", "0.6653533", "0.66033715", "0.6578308", "0.6578308", "0.65775067", "0.65510046", "0.6534104", "0.6496202", "0.64802897", "0.64229685", "0.6416874", "0.6360329", "0.63590467", "0.6337563", "0.6330027", "0.62596244", "0.6249458", "0.6226126", "0.6192513", "0.61578256", "0.61295885", "0.60906446", "0.60874325", "0.6083345", "0.60742307", "0.60641396", "0.60596585", "0.6047783", "0.60440624", "0.604262", "0.60205966", "0.601952", "0.5997698", "0.5972341", "0.5965192", "0.59604275", "0.59575254", "0.59518075", "0.5950586", "0.5947106", "0.59386086", "0.5938228", "0.5938228", "0.59294397", "0.5922558", "0.59193677", "0.59126526", "0.5905537", "0.5894213", "0.58902365", "0.58892816", "0.5886535", "0.5886509", "0.5883931", "0.58819854", "0.588093", "0.58806956", "0.58741903", "0.5871801", "0.5871538", "0.5871285", "0.5857629", "0.5856831", "0.58562875", "0.58561724", "0.58551437", "0.58518934", "0.58511", "0.585079", "0.5850294", "0.5847763", "0.5843734", "0.58436203", "0.583789", "0.5836876", "0.5832561", "0.5830311", "0.58291256", "0.58262604", "0.58249974", "0.5822092", "0.5814053", "0.5807739", "0.58066386", "0.5806454", "0.580563", "0.5805423", "0.5803732", "0.57999325" ]
0.6403965
22
wired to app/views/recommendations/update.html.erb by default (naming convention) that view GET a filled form for updating an recommendation, submitting with PUT
def edit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @recommend = Recommend.find(params[:id])\n\n respond_to do |format|\n if @recommend.update_attributes(params[:recommend])\n format.html { redirect_to @recommend, notice: 'Recommend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book_recommendation.update(book_recommendation_params)\n format.html { redirect_to @book_recommendation, notice: 'Book recommendation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n if @recommendation.update_attributes(params[:recommendation])\n format.html { redirect_to @recommendation, notice: 'Recommendation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recommended.update(recommended_params)\n format.html { redirect_to @recommended, notice: 'Recommended was successfully updated.' }\n format.json { render :show, status: :ok, location: @recommended }\n else\n format.html { render :edit }\n format.json { render json: @recommended.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n if @recommendation.update_attributes(params[:recommendation])\n format.html { redirect_to(@recommendation, :notice => 'Recommendation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recommendation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @recommend_recommend_other = Recommend::RecommendOther.find(params[:id])\n\n respond_to do |format|\n if @recommend_recommend_other.update_attributes(params[:recommend_recommend_other])\n format.html { redirect_to @recommend_recommend_other, notice: 'Recommend other was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend_recommend_other.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n if @recommendation.update_attributes(params[:recommendation])\n flash[:notice] = 'Recommendation was successfully updated.'\n format.html { redirect_to(@recommendation) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recommendation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recommendation.update(recommendation_params)\n format.html { redirect_to @recommendation, notice: \"Recommendation was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recommendation }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inchef_recommendation.update(inchef_recommendation_params)\n format.html { redirect_to @inchef_recommendation, notice: 'Inchef recommendation was successfully updated.' }\n format.json { render :show, status: :ok, location: @inchef_recommendation }\n else\n format.html { render :edit }\n format.json { render json: @inchef_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommend_recommend_tag = Recommend::RecommendTag.find(params[:id])\n\n respond_to do |format|\n if @recommend_recommend_tag.update_attributes(params[:recommend_recommend_tag])\n format.html { redirect_to @recommend_recommend_tag, notice: 'Recommend tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend_recommend_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_recommend\n if params[:recommender_id]\n begin\n\t@reservation = get_reservation\n rescue ActiveRecord::RecordNotFound\n\terror \"cannot find reservation #{session[:reservation_id]}\"\n\trender(:nothing => true) and return\n end\n @reservation.update_attributes :recommender_id => params[:recommender_id].to_i\n end\n render(:nothing => true)\n rescue => err\n error err.to_s\n end", "def update\n\t\t@recommendation = Recommendation.find(params[:id])\n\t\t#sleep 1\n\t\t#render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)\n\n\t\trespond_to do |format|\n\t\t\tif @recommendation.update_attributes(params[:recommendation])\n\t\t\t\tformat.html { redirect_to @recommendation, notice: 'Recommendation 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: @recommendation.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n\t\t# Attempts to update review using user inputs\n\t\tif @review.update(review_params)\n\t\t\t# Once updated, redirected to show page of car\n\t\t\tredirect_to car_path(@car)\n\t\telse\n\t\t\t# If not updated, edit form is loaded once again\n\t\t\trender 'edit'\n\t\tend\n\tend", "def update\n @recommend_recommend_ptag = Recommend::RecommendPtag.find(params[:id])\n\n respond_to do |format|\n if @recommend_recommend_ptag.update_attributes(params[:recommend_recommend_ptag])\n format.html { redirect_to @recommend_recommend_ptag, notice: 'Recommend ptag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend_recommend_ptag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommendation = Recommendation.find(params[:id])\n @users=User.all\n @products=Product.all\n @occasions=Occasion.all\n respond_to do |format|\n if @recommendation.update_attributes(params[:recommendation])\n format.html { redirect_to occasion_path(@recommendation.occasion_id) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommend_recommend_quiz = Recommend::RecommendQuiz.find(params[:id])\n\n respond_to do |format|\n if @recommend_recommend_quiz.update_attributes(params[:recommend_recommend_quiz])\n format.html { redirect_to @recommend_recommend_quiz, notice: 'Recommend quiz was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend_recommend_quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to :back, notice: 'Rating was successfully updated.' }\n\n else\n format.html { render :edit }\n\n end\n end\n end", "def update\n @recommendation_to_update = Recommendation.find(params[:id])\n @recommendation_to_update.update(:nameDotNumber => params[:app][:nameDotNumber])\n @recommendation_to_update.update(:course => params[:app][:course])\n @recommendation_to_update.save\n\n redirect_to home_url\n\n end", "def update\n respond_to do |format|\n if @blog_recommendation.update(blog_recommendation_params)\n format.html { redirect_to @blog_recommendation, notice: 'Recommendation was successfully updated.' }\n format.json { render :show, status: :ok, location: @blog_recommendation }\n else\n format.html { render :edit }\n format.json { render json: @blog_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.find(params[:id])\n\n respond_to do |format|\n if @recommender.update_attributes(params[:recommender])\n format.html { redirect_to collection_recommenders_path(@collection), notice: 'Recommender was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommender.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n # Broadcast updated review on list from model.\n format.turbo_stream\n format.html { redirect_to recipe_path(@recipe, anchor: \"review_#{@review.id}\"), notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.turbo_stream do\n # Display errors.\n render turbo_stream: turbo_stream.replace(\"review_form_review_#{@review.id}\",\n partial: \"reviews/form\", locals: { recipe: @recipe, review: @review })\n end\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_recommendation\n user = current_user\n user_interest = UserInterest.find(params[:answer_reco][:user_interest_id])\n authorize user_interest\n user_interest.recommendation == 'Pending' ? @switch = 'false' : @switch = 'true'\n user_interest.update(recommendation: params[:answer_reco][\"answer-#{user_interest.id}\"], comments: params[:answer_reco][:comments])\n\n @recommendations = UserInterest.where(user_id: current_user)\n @pending_recommendations = @recommendations.where(recommendation: \"Pending\")\n @accepted_recommendations = @recommendations.where(recommendation: \"Yes\")\n @declined_recommendations = @recommendations.where(recommendation: \"No\")\n respond_to do |format|\n format.html {redirect_to trainings_path}\n format.js\n end\n end", "def update\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating_alt.update_attributes(params[:rating_alt])\n format.html { redirect_to @rating_alt, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating_alt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reviews_and_rating.update(reviews_and_rating_params)\n format.html { redirect_to @reviews_and_rating, notice: 'Reviews and rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @reviews_and_rating }\n else\n format.html { render :edit }\n format.json { render json: @reviews_and_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @movie_user_recommendation.update(movie_user_recommendation_params)\n format.html { redirect_to @movie_user_recommendation, notice: 'Recommendation was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie_user_recommendation }\n else\n format.html { render :edit }\n format.json { render json: @movie_user_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommend_recommend_subject = Recommend::RecommendSubject.find(params[:id])\n\n respond_to do |format|\n if @recommend_recommend_subject.update_attributes(params[:recommend_recommend_subject])\n format.html { redirect_to @recommend_recommend_subject, notice: 'Recommend subject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend_recommend_subject.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @suggest.update(suggest_params)\n format.html { redirect_to @suggest, notice: 'Suggest was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggest }\n else\n format.html { render :edit }\n format.json { render json: @suggest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @submission = @recommendation.submission\n\n respond_to do |format|\n if @recommendation.update(recommendation_params)\n RecommendationMailer.recommendation_confirmation(@recommendation).deliver\n format.html { redirect_to root_url, notice: 'Recommendation was successfully updated.' }\n format.json { render :show, status: :ok, location: @recommendation }\n else\n format.html { render :edit }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n #If the params are filled in and valid, it redirects to the review page and shows the notice\n if @review.update(review_params)\n format.html { redirect_to @review, notice: t('review.update') }\n format.json { render :show, status: :ok, location: @review }\n #If it doesnt update then it refreshes the edit review page\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @future_recipe.update(future_recipe_params)\n format.html { redirect_to @future_recipe, notice: 'Future link was successfully updated.' }\n format.json { render :show, status: :ok, location: @future_recipe }\n else\n format.html { render :edit }\n format.json { render json: @future_recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ingredient_suggestion.update(ingredient_suggestion_params)\n format.html { redirect_to @ingredient_suggestion, notice: 'Ingredient suggestion was successfully updated.' }\n format.json do\n render :nothing => true, :status => 200\n # render :show, status: :ok, location: @ingredient_suggestion\n end\n else\n format.html { render :edit }\n format.json { render json: @ingredient_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opinion.update(opinion_params)\n format.html { redirect_to @opinion, notice: 'Opinion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @favorite_recipe.update(favorite_recipe_params)\n format.html { redirect_to @favorite_recipe, notice: 'Favorite recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @favorite_recipe }\n else\n format.html { render :edit }\n format.json { render json: @favorite_recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n if @suggestion.update_attributes(params[:suggestion])\n #flash[:notice] = 'Suggestion was successfully updated.'\n format.html { redirect_to(root_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #before action\n #Also in update we need to include the whitelisted fields\n if @recipe.update(recipe_params)\n flash[:success] = \"Your recipe was updated successfully\"\n #We want to redirect the user to the updated recipe. So we have to provide the object @recipe in the path method\n redirect_to recipe_path(@recipe)\n else\n render :edit\n end\n end", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to_creative :ok, 'Review was successfully updated.', :edit\n end", "def update\n @prefer = Prefer.find(params[:id])\n\n respond_to do |format|\n if @prefer.update_attributes(params[:prefer])\n format.html { redirect_to @prefer, notice: 'Prefer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prefer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to restaurent_path(@restaurent.id), notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @favourite.update(favourite_params)\n format.html { redirect_to @favourite, notice: 'Favourite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @favourite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interview.update(interview_params)\n format.html { redirect_to interviews_url, notice: 'Interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question_like.update(question_like_params)\n format.html { redirect_to @question_like, notice: 'Question like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_like.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @favourites_recipe.update(favourites_recipe_params)\n format.html { redirect_to @favourites_recipe, notice: 'Favourites recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @favourites_recipe }\n else\n format.html { render :edit }\n format.json { render json: @favourites_recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n if @suggestion.update_attributes(params[:suggestion])\n format.html { redirect_to @suggestion, notice: 'Suggestion was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n if @suggestion.update_attributes(params[:suggestion])\n flash[:notice] = 'Suggestion was successfully updated.'\n format.html { redirect_to(@suggestion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\tif @ratings.update(rating_params)\n\t\t\tredirect_to professor_url(@rating.professor), notice: 'Rating was successfully updated.'\n\t\telse\n\t\t\trender :edit\n\t\tend\n\tend", "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @food_review.update(food_review_params)\n format.html { redirect_to @food_review, notice: 'Food review was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_review }\n else\n format.html { render :edit }\n format.json { render json: @food_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @free_ebook.update(free_ebook_params)\n format.html { redirect_to @free_ebook, notice: 'Free ebook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @free_ebook.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @rate = OvertimeRate.find(params[:id])\n @form_id = 'edit-form'\n \n respond_to do |fmt|\n fmt.html { render :partial => 'form' }\n fmt.json { render :json => @rate }\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n format.js {render nothing: true}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to do |format|\n # if @attention.update(attention_params)\n # format.html { redirect_to @attention, notice: 'Attention was successfully updated.' }\n # format.json { render :show, status: :ok, location: @attention }\n # else\n # format.html { render :edit }\n # format.json { render json: @attention.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n respond_to do |format|\n debugger\n if @best_practice.update(best_practice_params)\n format.html { redirect_to @best_practice, notice: 'Best practice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @best_practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bookreview.update(bookreview_params)\n format.html { redirect_to book_path(@bookreview.book_id), notice: 'Bookreview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bookreview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @suggestion.update(suggestion_params)\n format.html { redirect_to @suggestion, notice: 'Suggestion was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggestion }\n else\n format.html { render :edit }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @favourite.update(favourite_params)\n redirect_to @favourite, notice: 'Favourite was successfully updated.'\n else\n render action: :edit\n end\n end", "def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @m_rating = MRating.find(params[:id])\n\n respond_to do |format|\n if @m_rating.update_attributes(params[:m_rating])\n format.html { redirect_to(@m_rating, :notice => 'M rating was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @m_rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #find the individual review\n @review = Review.find(params[:id])\n\n #check to see if you're the poster\n if @review.user != @current_user\n #take it back to homepage\n redirect_to root_path\n else\n #update the new info from the form - update with new info from the form\n if @review.update(form_params)\n #redirect to individual show page\n redirect_to review_path(@review)\n else\n # using this it will render any validation to the main edit page\n render \"edit\"\n end\n end\n end", "def update\n\t\t\t\trender_invalid_action(current_review) unless current_review.update(update_driver_review_params)\n\t\t\tend", "def update\n @book_review = BookReview.find(params[:id])\n\n respond_to do |format|\n if @book_review.update_attributes(params[:book_review])\n format.html { redirect_to @book_review, notice: 'Book review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n flash[:notice] = 'Rating was successfully updated.'\n format.html { redirect_to(@rating) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item_review.update(item_review_params)\n format.html { redirect_to @item_review, notice: 'Item review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @suggestion_box.update(suggestion_box_params)\n format.html { redirect_to @suggestion_box, notice: 'Suggestion box was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggestion_box }\n else\n format.html { render :edit }\n format.json { render json: @suggestion_box.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find_by(user_id: current_user.id, event_id: params[:event_id])\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_back fallback_location: root_path }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n respond_to do |format|\n if @restaurant_table_rating.update(restaurant_table_rating_params)\n format.html { redirect_to @restaurant_table_rating, notice: 'Restaurant table rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant_table_rating }\n else\n format.html { render :edit }\n format.json { render json: @restaurant_table_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @page_title = \"Edit Recipe Ingredient\"\n @recipe_ingredient = current_recipe.recipe_ingredients.find(params[:id])\n @btnText = \"Update Ingredient\"\n @obj = @recipe_ingredient\n respond_to do |f|\n f.html {render 'shared/form'}\n f.js\n end\n end", "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n attributes = recommendation_params\n if not attributes[:liked].nil?\n rec = Recommendation.find_by(id:params[:id])\n if rec && current_user.id == rec.user_id\n rec.update(recommendation_params)\n render json:rec, status:200\n else\n render json:{errors:\"Invalid recommendation_id\"},status:422\n end\n else\n render json:{errors:\"must provide liked param\"}, status:400\n end\n end", "def update\n respond_to do |format|\n if @effort_rating.update(effort_rating_params)\n format.html { redirect_to @effort_rating, notice: 'Effort rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @effort_rating }\n else\n format.html { render :edit }\n format.json { render json: @effort_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @suggestion = Suggestion.find(params[:id])\n @suggestion.user_id = current_user.id\n \n respond_to do |format|\n if @suggestion.update_attributes(params[:suggestion])\n flash[:notice] = 'Suggestion was successfully updated.'\n format.html { redirect_to(@suggestion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #@recipe = Recipe.find(params[:id])\n \n if @recipe.update(recipe_params)\n flash[:success] = \"Your recipe was updated successfully!\"\n redirect_to recipe_path(@recipe)\n \n else\n render :edit\n \n end\n \n end", "def update\n respond_to do |format|\n if @idea_rating.update(idea_rating_params)\n format.html { redirect_to idea_ratings_path(:idea_id => @idea_rating.idea_id), notice: (I18n.t :act_update) }\n format.json { render :show, status: :ok, location: @idea_rating }\n calc_idea_rating\n else\n format.html { render :edit }\n format.json { render json: @idea_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(request)\n end", "def update(request)\n end", "def edit\n respond_to do |format|\n format.html { render :action => \"edit\" and return }\n format.js { render :partial => \"scrap_form\", :layout => false and return }\n format.xml { return }\n end\n end", "def update\n respond_to do |format|\n if @interview.update(interview_params)\n format.html { redirect_to @interview, notice: 'Interview was successfully updated.' }\n format.json { render :show, status: :ok, location: @interview }\n else\n format.html { render :edit }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opinion.update(opinion_params)\n format.html { redirect_to @opinion, notice: 'Opinion was successfully updated.' }\n format.json { render :show, status: :ok, location: @opinion }\n else\n format.html { render :edit }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @change_suggestion = ChangeSuggestion.find(params[:id])\n\n respond_to do |format|\n if @change_suggestion.update_attributes(params[:change_suggestion])\n format.html { redirect_to @change_suggestion, notice: 'Change suggestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @change_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opinion.update(opinion_params)\n format.html { redirect_to opinions_path, notice: 'Opinion was successfully updated.' }\n format.json { render :show, status: :ok, location: @opinion }\n else\n format.html { render :edit }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @review.update_attributes(review_params)\n redirect_to edit_review_path(@review), notice: (\"Review was successfully updated.\")\n else\n render action: \"edit\"\n end\n end", "def update\n respond_to do |format|\n if @rating_answer.update(rating_answer_params)\n format.html { redirect_to @rating_answer, notice: 'Rating answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating_answer }\n else\n format.html { render :edit }\n format.json { render json: @rating_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html {redirect_to @rating, notice: 'Payment was successfully updated.'}\n format.json {render :show, status: :ok, location: @rating}\n else\n format.html {render :edit}\n format.json {render json: @rating.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @idea_like.update(idea_like_params)\n format.html { redirect_to @idea_like, notice: 'Idea like was successfully updated.' }\n format.json { render :show, status: :ok, location: @idea_like }\n else\n format.html { render :edit }\n format.json { render json: @idea_like.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_nature_of_review.update(admin_nature_of_review_params)\n format.html { redirect_to @admin_nature_of_review, notice: 'Nature of review was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_nature_of_review }\n else\n format.html { render :edit }\n format.json { render json: @admin_nature_of_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interview = Interview.find_by_slug(params[:id])\n\n respond_to do |format|\n if @interview.update_attributes(params[:interview])\n format.html { redirect_to admin_interviews_path, notice: 'Interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interview.update(interview_params)\n format.html { redirect_to interviews_path, notice: 'Interview was successfully updated.' }\n format.json { render :show, status: :ok, location: @interview }\n else\n format.html { render :edit }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7669512", "0.73655653", "0.7292783", "0.7273938", "0.726564", "0.7188805", "0.7153184", "0.7153006", "0.7068589", "0.694214", "0.6856132", "0.6799903", "0.67891777", "0.67732835", "0.6760946", "0.67606205", "0.670224", "0.66717964", "0.6662548", "0.6653837", "0.66175264", "0.6599624", "0.65832525", "0.6564914", "0.6554222", "0.65436476", "0.65103865", "0.6496975", "0.6493646", "0.6484046", "0.64711493", "0.64648825", "0.6461245", "0.64193124", "0.6418339", "0.6405965", "0.6402217", "0.63962835", "0.6387815", "0.6387004", "0.63857013", "0.6379111", "0.6379111", "0.6379111", "0.63712424", "0.6364304", "0.6362662", "0.63625586", "0.6353729", "0.6346075", "0.6341532", "0.6331771", "0.63307375", "0.63285255", "0.6311301", "0.63075095", "0.63037485", "0.6300001", "0.6298926", "0.6296989", "0.6295226", "0.6291296", "0.6286386", "0.62837017", "0.62753636", "0.6267395", "0.6261332", "0.62611336", "0.6259061", "0.62564147", "0.62557334", "0.62529814", "0.62492776", "0.624753", "0.6245198", "0.6245086", "0.6244047", "0.6244047", "0.6242959", "0.623938", "0.62364256", "0.62284315", "0.6228382", "0.6226308", "0.6223562", "0.6222788", "0.6222788", "0.6222788", "0.6222788", "0.6220963", "0.62199676", "0.6218218", "0.6218218", "0.6218218", "0.6218218", "0.6218218", "0.6218218", "0.6218218", "0.6215628", "0.621528", "0.62087846" ]
0.0
-1
PUT the edited form to update a recommendation
def update @recommendation_to_update = Recommendation.find(params[:id]) @recommendation_to_update.update(:nameDotNumber => params[:app][:nameDotNumber]) @recommendation_to_update.update(:course => params[:app][:course]) @recommendation_to_update.save redirect_to home_url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @recommend = Recommend.find(params[:id])\n\n respond_to do |format|\n if @recommend.update_attributes(params[:recommend])\n format.html { redirect_to @recommend, notice: 'Recommend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n if @recommendation.update_attributes(params[:recommendation])\n format.html { redirect_to @recommendation, notice: 'Recommendation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n if @recommendation.update_attributes(params[:recommendation])\n format.html { redirect_to(@recommendation, :notice => 'Recommendation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recommendation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n if @recommendation.update_attributes(params[:recommendation])\n flash[:notice] = 'Recommendation was successfully updated.'\n format.html { redirect_to(@recommendation) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recommendation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recommended.update(recommended_params)\n format.html { redirect_to @recommended, notice: 'Recommended was successfully updated.' }\n format.json { render :show, status: :ok, location: @recommended }\n else\n format.html { render :edit }\n format.json { render json: @recommended.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recommendation.update(recommendation_params)\n format.html { redirect_to @recommendation, notice: \"Recommendation was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recommendation }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book_recommendation.update(book_recommendation_params)\n format.html { redirect_to @book_recommendation, notice: 'Book recommendation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommend_recommend_other = Recommend::RecommendOther.find(params[:id])\n\n respond_to do |format|\n if @recommend_recommend_other.update_attributes(params[:recommend_recommend_other])\n format.html { redirect_to @recommend_recommend_other, notice: 'Recommend other was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend_recommend_other.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inchef_recommendation.update(inchef_recommendation_params)\n format.html { redirect_to @inchef_recommendation, notice: 'Inchef recommendation was successfully updated.' }\n format.json { render :show, status: :ok, location: @inchef_recommendation }\n else\n format.html { render :edit }\n format.json { render json: @inchef_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommend_recommend_quiz = Recommend::RecommendQuiz.find(params[:id])\n\n respond_to do |format|\n if @recommend_recommend_quiz.update_attributes(params[:recommend_recommend_quiz])\n format.html { redirect_to @recommend_recommend_quiz, notice: 'Recommend quiz was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend_recommend_quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommendation = Recommendation.find(params[:id])\n @users=User.all\n @products=Product.all\n @occasions=Occasion.all\n respond_to do |format|\n if @recommendation.update_attributes(params[:recommendation])\n format.html { redirect_to occasion_path(@recommendation.occasion_id) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommend_recommend_tag = Recommend::RecommendTag.find(params[:id])\n\n respond_to do |format|\n if @recommend_recommend_tag.update_attributes(params[:recommend_recommend_tag])\n format.html { redirect_to @recommend_recommend_tag, notice: 'Recommend tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend_recommend_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@recommendation = Recommendation.find(params[:id])\n\t\t#sleep 1\n\t\t#render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)\n\n\t\trespond_to do |format|\n\t\t\tif @recommendation.update_attributes(params[:recommendation])\n\t\t\t\tformat.html { redirect_to @recommendation, notice: 'Recommendation 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: @recommendation.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @recommend_recommend_ptag = Recommend::RecommendPtag.find(params[:id])\n\n respond_to do |format|\n if @recommend_recommend_ptag.update_attributes(params[:recommend_recommend_ptag])\n format.html { redirect_to @recommend_recommend_ptag, notice: 'Recommend ptag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend_recommend_ptag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @movie_user_recommendation.update(movie_user_recommendation_params)\n format.html { redirect_to @movie_user_recommendation, notice: 'Recommendation was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie_user_recommendation }\n else\n format.html { render :edit }\n format.json { render json: @movie_user_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommend_recommend_subject = Recommend::RecommendSubject.find(params[:id])\n\n respond_to do |format|\n if @recommend_recommend_subject.update_attributes(params[:recommend_recommend_subject])\n format.html { redirect_to @recommend_recommend_subject, notice: 'Recommend subject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend_recommend_subject.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n attributes = recommendation_params\n if not attributes[:liked].nil?\n rec = Recommendation.find_by(id:params[:id])\n if rec && current_user.id == rec.user_id\n rec.update(recommendation_params)\n render json:rec, status:200\n else\n render json:{errors:\"Invalid recommendation_id\"},status:422\n end\n else\n render json:{errors:\"must provide liked param\"}, status:400\n end\n end", "def update\n respond_to do |format|\n if @blog_recommendation.update(blog_recommendation_params)\n format.html { redirect_to @blog_recommendation, notice: 'Recommendation was successfully updated.' }\n format.json { render :show, status: :ok, location: @blog_recommendation }\n else\n format.html { render :edit }\n format.json { render json: @blog_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @submission = @recommendation.submission\n\n respond_to do |format|\n if @recommendation.update(recommendation_params)\n RecommendationMailer.recommendation_confirmation(@recommendation).deliver\n format.html { redirect_to root_url, notice: 'Recommendation was successfully updated.' }\n format.json { render :show, status: :ok, location: @recommendation }\n else\n format.html { render :edit }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating_alt.update_attributes(params[:rating_alt])\n format.html { redirect_to @rating_alt, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating_alt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_recommend\n if params[:recommender_id]\n begin\n\t@reservation = get_reservation\n rescue ActiveRecord::RecordNotFound\n\terror \"cannot find reservation #{session[:reservation_id]}\"\n\trender(:nothing => true) and return\n end\n @reservation.update_attributes :recommender_id => params[:recommender_id].to_i\n end\n render(:nothing => true)\n rescue => err\n error err.to_s\n end", "def update\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.find(params[:id])\n\n respond_to do |format|\n if @recommender.update_attributes(params[:recommender])\n format.html { redirect_to collection_recommenders_path(@collection), notice: 'Recommender was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommender.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opinion.update(opinion_params)\n format.html { redirect_to @opinion, notice: 'Opinion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @suggest.update(suggest_params)\n format.html { redirect_to @suggest, notice: 'Suggest was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggest }\n else\n format.html { render :edit }\n format.json { render json: @suggest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opinion.update(opinion_params)\n format.html { redirect_to @opinion, notice: 'Opinion was successfully updated.' }\n format.json { render :show, status: :ok, location: @opinion }\n else\n format.html { render :edit }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_recommendation\n user = current_user\n user_interest = UserInterest.find(params[:answer_reco][:user_interest_id])\n authorize user_interest\n user_interest.recommendation == 'Pending' ? @switch = 'false' : @switch = 'true'\n user_interest.update(recommendation: params[:answer_reco][\"answer-#{user_interest.id}\"], comments: params[:answer_reco][:comments])\n\n @recommendations = UserInterest.where(user_id: current_user)\n @pending_recommendations = @recommendations.where(recommendation: \"Pending\")\n @accepted_recommendations = @recommendations.where(recommendation: \"Yes\")\n @declined_recommendations = @recommendations.where(recommendation: \"No\")\n respond_to do |format|\n format.html {redirect_to trainings_path}\n format.js\n end\n end", "def update\n @opinion = Opinion.find(params[:id])\n\n respond_to do |format|\n if @opinion.update_attributes(params[:opinion])\n format.html { redirect_to @opinion, notice: 'Opinion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opinion.update(opinion_params)\n format.html { redirect_to opinions_path, notice: 'Opinion was successfully updated.' }\n format.json { render :show, status: :ok, location: @opinion }\n else\n format.html { render :edit }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n if @suggestion.update_attributes(params[:suggestion])\n format.html { redirect_to @suggestion, notice: 'Suggestion was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @opinion = Opinion.find(params[:id])\n\n respond_to do |format|\n if @opinion.update_attributes(params[:opinion])\n format.html { redirect_to(@opinion, :notice => 'Opinion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @opinion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opinion.update(opinion_params)\n format.html { redirect_to @opinion, notice: 'Opinion was successfully updated.' }\n format.json { render :show, status: :ok, location: @opinion }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opinion.update(opinion_params)\n format.html { redirect_to @opinion, notice: 'Opinion was successfully updated.' }\n format.json { render :show, status: :ok, location: @opinion }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @suggestion = Suggestion.find(params[:id])\n @suggestion.user_id = current_user.id\n \n respond_to do |format|\n if @suggestion.update_attributes(params[:suggestion])\n flash[:notice] = 'Suggestion was successfully updated.'\n format.html { redirect_to(@suggestion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @terms_of_use = TermsOfUse.find(params[:id])\n\n respond_to do |format|\n if @terms_of_use.update_attributes(params[:terms_of_use])\n format.html { redirect_to @terms_of_use, notice: 'Terms of use was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @terms_of_use.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prefer = Prefer.find(params[:id])\n\n respond_to do |format|\n if @prefer.update_attributes(params[:prefer])\n format.html { redirect_to @prefer, notice: 'Prefer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prefer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n if @suggestion.update_attributes(params[:suggestion])\n flash[:notice] = 'Suggestion was successfully updated.'\n format.html { redirect_to(@suggestion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @m_rating = MRating.find(params[:id])\n\n respond_to do |format|\n if @m_rating.update_attributes(params[:m_rating])\n format.html { redirect_to(@m_rating, :notice => 'M rating was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @m_rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\tif @ratings.update(rating_params)\n\t\t\tredirect_to professor_url(@rating.professor), notice: 'Rating was successfully updated.'\n\t\telse\n\t\t\trender :edit\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to :back, notice: 'Rating was successfully updated.' }\n\n else\n format.html { render :edit }\n\n end\n end\n end", "def update\n respond_to do |format|\n if @effort_rating.update(effort_rating_params)\n format.html { redirect_to @effort_rating, notice: 'Effort rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @effort_rating }\n else\n format.html { render :edit }\n format.json { render json: @effort_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reviews_and_rating.update(reviews_and_rating_params)\n format.html { redirect_to @reviews_and_rating, notice: 'Reviews and rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @reviews_and_rating }\n else\n format.html { render :edit }\n format.json { render json: @reviews_and_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def recommendation_params\n params.require(:recommendation).permit(:name, :detail, :rating)\n end", "def update\n @suggestion = Suggestion.find(params[:id])\n\n respond_to do |format|\n if @suggestion.update_attributes(params[:suggestion])\n #flash[:notice] = 'Suggestion was successfully updated.'\n format.html { redirect_to(root_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @suggestion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @recommended_link = RecommendedLink.find(params[:id])\n\n if @recommended_link.update(recommended_link_params)\n head :no_content\n else\n render json: @recommended_link.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n debugger\n if @best_practice.update(best_practice_params)\n format.html { redirect_to @best_practice, notice: 'Best practice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @best_practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rationale.update(rationale_params)\n format.html { redirect_to @rationale, notice: 'Rationale was successfully updated.' }\n format.json { render :show, status: :ok, location: @rationale }\n else\n format.html { render :edit }\n format.json { render json: @rationale.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @suggestion.update(suggestion_params)\n flash[:notice]='Suggestion was successfully updated.'\n redirect_to '/'\n else\n flash[:notice]=\"Suggestion could not be updated\"\n end\n end", "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n flash[:notice] = 'Rating was successfully updated.'\n format.html { redirect_to(@rating) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @paragraph_rating = ParagraphRating.find(params[:id])\n\n respond_to do |format|\n if @paragraph_rating.update_attributes(params[:paragraph_rating])\n format.html { redirect_to @paragraph_rating, notice: 'Paragraph rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paragraph_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @confidence_rating.update(confidence_rating_params)\n format.html { redirect_to @confidence_rating, notice: 'Confidence rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @confidence_rating }\n else\n format.html { render :edit }\n format.json { render json: @confidence_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @idea_rating.update(idea_rating_params)\n format.html { redirect_to idea_ratings_path(:idea_id => @idea_rating.idea_id), notice: (I18n.t :act_update) }\n format.json { render :show, status: :ok, location: @idea_rating }\n calc_idea_rating\n else\n format.html { render :edit }\n format.json { render json: @idea_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @engine_rating.update(engine_rating_params)\n format.html { redirect_to @engine_rating, notice: 'Engine rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @engine_rating }\n else\n format.html { render :edit }\n format.json { render json: @engine_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @advocacy = Advocacy.find(params[:id])\n\n respond_to do |format|\n if @advocacy.update_attributes(params[:advocacy])\n format.html { redirect_to @advocacy, notice: 'Advocacy was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @advocacy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @innovation.update(innovation_params)\n format.html { redirect_to @innovation, notice: 'Innovation was successfully updated.' }\n format.json { render :show, status: :ok, location: @innovation }\n else\n format.html { render :edit }\n format.json { render json: @innovation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @suggestion.update(suggestion_params)\n format.html { redirect_to @suggestion, notice: 'Suggestion was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggestion }\n else\n format.html { render :edit }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @intention = Intention.find(params[:id])\n\n respond_to do |format|\n if @intention.update_attributes(params[:intention])\n format.html { redirect_to @intention, notice: 'Intention was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @intention.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\treview = Review.find(params['id'].to_i) if params['id']\n\t\treview.review_text = params['review_text'] if params['review_text']\n\t\treview.rating = params['rating'] if params['rating']\n\t\treview.reviewer_id = params['reviewer_id'] if params['reviewer_id']\n\t\treview.user_id = params['user_id'].to_i if params['user_id']\n\t\treview.trip_id = params['trip_id'].to_i if params['trip_id']\n\t\treview.save\n\tend", "def update\n @favor = Favor.find(params[:id])\n\n respond_to do |format|\n if @favor.update_attributes(params[:favor])\n format.html { redirect_to @favor, notice: 'Favor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @favor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rating_answer.update(rating_answer_params)\n format.html { redirect_to @rating_answer, notice: 'Rating answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating_answer }\n else\n format.html { render :edit }\n format.json { render json: @rating_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @favourite.update(favourite_params)\n format.html { redirect_to @favourite, notice: 'Favourite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @favourite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @intelligence = Intelligence.find(params[:id])\n\n respond_to do |format|\n if @intelligence.update_attributes(params[:intelligence])\n flash[:notice] = 'Intelligence was successfully updated.'\n format.html { redirect_to(intelligences_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @intelligence.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @favourite.update(favourite_params)\n redirect_to @favourite, notice: 'Favourite was successfully updated.'\n else\n render action: :edit\n end\n end", "def update\n respond_to do |format|\n if @admin_nature_of_review.update(admin_nature_of_review_params)\n format.html { redirect_to @admin_nature_of_review, notice: 'Nature of review was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_nature_of_review }\n else\n format.html { render :edit }\n format.json { render json: @admin_nature_of_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @favoriten.update(favoriten_params)\n format.html { redirect_to @favoriten, notice: 'Favoriten was successfully updated.' }\n format.json { render :show, status: :ok, location: @favoriten }\n else\n format.html { render :edit }\n format.json { render json: @favoriten.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question_like.update(question_like_params)\n format.html { redirect_to @question_like, notice: 'Question like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_like.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @change_suggestion = ChangeSuggestion.find(params[:id])\n\n respond_to do |format|\n if @change_suggestion.update_attributes(params[:change_suggestion])\n format.html { redirect_to @change_suggestion, notice: 'Change suggestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @change_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_recommendation\n @recommendation = Recommendation.find(params[:id])\n end", "def update\n @skill_suggestion = SkillSuggestion.find(params[:id])\n\n respond_to do |format|\n if @skill_suggestion.update_attributes(params[:skill_suggestion])\n format.html { redirect_to @skill_suggestion, notice: 'Skill suggestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @skill_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question_learned.update(question_learned_params)\n format.html { redirect_to @question_learned, notice: 'Question learned was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_learned.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ingredient_suggestion.update(ingredient_suggestion_params)\n format.html { redirect_to @ingredient_suggestion, notice: 'Ingredient suggestion was successfully updated.' }\n format.json do\n render :nothing => true, :status => 200\n # render :show, status: :ok, location: @ingredient_suggestion\n end\n else\n format.html { render :edit }\n format.json { render json: @ingredient_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating = @skate_spot.ratings.find(params[:id])\n if @rating.update(rating_params)\n flash[:success] = \"Rating has been successfully updated!\"\n redirect_to skate_spot_path(@skate_spot)\n #redirect_to([@rating.skate_spot, @rating], :notice => 'Rating has been successfully updated!') \n else\n flash[:danger] = \"Rating has been unsuccesfully updated. Please try again.\"\n redirect_to skate_spot_path(@skate_spot)\n end\n end", "def update\n respond_to do |format|\n if @finale_rating.update(finale_rating_params)\n format.html { redirect_to @finale_rating, notice: 'Finale rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @finale_rating }\n else\n format.html { render :edit }\n format.json { render json: @finale_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @idea_like.update(idea_like_params)\n format.html { redirect_to @idea_like, notice: 'Idea like was successfully updated.' }\n format.json { render :show, status: :ok, location: @idea_like }\n else\n format.html { render :edit }\n format.json { render json: @idea_like.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offense.update(offense_params)\n format.html { redirect_to @offense, notice: 'Offense was successfully updated.' }\n format.json { render :show, status: :ok, location: @offense }\n else\n format.html { render :edit }\n format.json { render json: @offense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n respond_to do |format|\n if @suggestion.update(suggestion_params)\n format.html { redirect_to [@document, @suggestion], notice: 'Suggestion was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggestion }\n else\n format.html { render :edit }\n format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @favorito = Favorito.find(params[:id])\n\n respond_to do |format|\n if @favorito.update_attributes(params[:favorito])\n format.html { redirect_to @favorito, notice: 'Favorito was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @favorito.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rating_reason.update(rating_reason_params)\n format.html { redirect_to @rating_reason, notice: 'Rating reason was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating_reason }\n else\n format.html { render :edit }\n format.json { render json: @rating_reason.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ocs_rating_factor = OcsRatingFactor.find(params[:id])\n\n respond_to do |format|\n if @ocs_rating_factor.update_attributes(params[:ocs_rating_factor])\n format.html { redirect_to(@ocs_rating_factor, :notice => 'OcsRatingFactor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ocs_rating_factor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inspiration.update(inspiration_params)\n format.html { redirect_to @book, notice: 'Inspiration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inspiration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pending_recommended_link = PendingRecommendedLink.find(params[:id])\n\n if @pending_recommended_link.update(pending_recommended_link_params)\n head :no_content\n else\n render json: @pending_recommended_link.errors, status: :unprocessable_entity\n end\n end", "def update\n @participant_rating = ParticipantRating.find(params[:id])\n\n respond_to do |format|\n if @participant_rating.update_attributes(params[:participant_rating])\n format.html { redirect_to @participant_rating, notice: 'Participant rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @participant_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @learn = Learn.find(params[:id])\n\n respond_to do |format|\n if @learn.update_attributes(params[:learn])\n format.html { redirect_to @learn, notice: 'Learn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @learn.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @favorite_recipe.update(favorite_recipe_params)\n format.html { redirect_to @favorite_recipe, notice: 'Favorite recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @favorite_recipe }\n else\n format.html { render :edit }\n format.json { render json: @favorite_recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_recommendation\n @recommendation = Recommendation.find(params[:id])\n end", "def set_recommendation\n @recommendation = Recommendation.find(params[:id])\n end", "def update\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n if @practice.update_attributes(params[:practice])\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contribucion.update(contribucion_params)\n format.html { redirect_to @contribucion, notice: 'Contribucion was successfully updated.' }\n format.json { render :show, status: :ok, location: @contribucion }\n else\n format.html { render :edit }\n format.json { render json: @contribucion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@review = Review.find(params[:id])\n\t\[email protected] = Establishment.find(params[:establishment])\n\t\[email protected] = Category.find(params[:category])\n\t\[email protected] = Clientele.find(params[:clientele])\n\t\[email protected]_level = SoundLevel.find(params[:sound_level])\n\t\[email protected] = Hygiene.find(params[:hygiene])\n\t\[email protected] = Rating.find(params[:rating])\n\n\t\trespond_to do |format|\n\t\t\tif @review.update_attributes(params[:review])\n\t\t\t\tformat.html { redirect_to(@review, :notice => 'Review 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 => @review.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n if @practice.update_attributes(params[:practice])\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @immigrant = Immigrant.find(params[:id])\n\n respond_to do |format|\n if @immigrant.update_attributes(params[:immigrant])\n format.html { redirect_to @immigrant, notice: 'Immigrant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @immigrant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @credibility_rating.update(credibility_rating_params)\n format.html { redirect_to @credibility_rating, notice: 'Credibility rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @credibility_rating }\n else\n format.html { render :edit }\n format.json { render json: @credibility_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html {redirect_to @rating, notice: 'Payment was successfully updated.'}\n format.json {render :show, status: :ok, location: @rating}\n else\n format.html {render :edit}\n format.json {render json: @rating.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @productonegocio = Productonegocio.find(params[:id])\n\n respond_to do |format|\n if @productonegocio.update_attributes(params[:productonegocio])\n format.html { redirect_to @productonegocio, notice: 'Productonegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @productonegocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find_by(user_id: current_user.id, event_id: params[:event_id])\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_back fallback_location: root_path }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n respond_to do |format|\n if @practice.update(practice_params)\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { render :show, status: :ok, location: @practice }\n else\n format.html { render :edit }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.8095108", "0.80392814", "0.7918458", "0.786596", "0.7856543", "0.7820544", "0.7716968", "0.76070845", "0.7534149", "0.75269604", "0.75019777", "0.7447656", "0.7321776", "0.7176609", "0.7160014", "0.7087019", "0.7070621", "0.704455", "0.7034007", "0.69927377", "0.6984685", "0.69193554", "0.68867517", "0.68520594", "0.679477", "0.67832595", "0.6773335", "0.6772638", "0.674198", "0.6732411", "0.67186075", "0.67186075", "0.6714471", "0.67030525", "0.66866076", "0.6660415", "0.6653376", "0.66509557", "0.6647521", "0.66452944", "0.6637244", "0.6632422", "0.6624285", "0.6620756", "0.6599068", "0.6597826", "0.658445", "0.6580459", "0.6570372", "0.6567462", "0.6566492", "0.6566168", "0.6547756", "0.6546196", "0.65426123", "0.65332943", "0.6527206", "0.65267503", "0.6526102", "0.65160924", "0.6515251", "0.6513409", "0.6509701", "0.65061903", "0.6500839", "0.64900607", "0.6482645", "0.6473581", "0.647057", "0.6469335", "0.646709", "0.6463781", "0.64628565", "0.64599115", "0.6455287", "0.6451444", "0.64411414", "0.6428961", "0.6425868", "0.642304", "0.6413616", "0.6413429", "0.64070714", "0.6398545", "0.6396723", "0.6396239", "0.63956815", "0.6393685", "0.6393685", "0.63934255", "0.6392759", "0.63862705", "0.6385309", "0.6379485", "0.63776135", "0.63737524", "0.63721347", "0.63682634", "0.6359635", "0.6354703" ]
0.7370448
12
wired to app/views/recommendations/destroy.html.erb by default (naming convention)
def destroy @recommendation.destroy redirect_to action: :index, notice: "Successfully deleted!" # use redirect instead of render to avoid double submission (double deletion) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_view\n super\n end", "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to(recommendations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to(recommendations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @recommendation.destroy\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommendation.destroy\n respond_to do |format|\n format.html { redirect_to recommendations_url, notice: 'Recommendation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommendation.destroy\n respond_to do |format|\n format.html { redirect_to recommendations_url, notice: \"Recommendation was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @inchef_recommendation.destroy\n respond_to do |format|\n format.html { redirect_to inchef_recommendations_url, notice: 'Inchef recommendation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n recipe_index = @view.index_delete\n @cookbook.remove_recipe(recipe_index)\n @view.listing\n end", "def destroy\n @recommend_recommend_other = Recommend::RecommendOther.find(params[:id])\n @recommend_recommend_other.destroy\n\n respond_to do |format|\n format.html { redirect_to recommend_recommend_others_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book_recommendation.destroy\n respond_to do |format|\n format.html { redirect_to book_recommendations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommended.destroy\n respond_to do |format|\n format.html { redirect_to recommendeds_url, notice: 'Recommended was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommend_recommend_tag = Recommend::RecommendTag.find(params[:id])\n @recommend_recommend_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to recommend_recommend_tags_url }\n format.json { head :no_content }\n end\n end", "def confirm_destroy\n render :action => 'confirm_destroy'\n end", "def destroy\n @favorite_template.destroy\n end", "def destroy\n @recommend = Recommend.find(params[:id])\n @recommend.destroy\n\n respond_to do |format|\n format.html { render :text=>\"删除成功\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommended_link.destroy\n\n head :no_content\n end", "def destroy\n # Display list with indices\n recipes = @cookbook.all\n # Ask user for index\n index = @view.ask_user_for_index(recipes)\n # Remove from cookbook\n @cookbook.remove_recipe(index - 1)\n end", "def thumbs_down\n extract = Csvarchive.find(params[:id])\n if extract.contributor_id != current_user\n Recommendation.all(:conditions => {:user_id=>current_user.id, :recommendable_id=>extract.id, :recommendable_type=>\"Csvarchive\"})[0].destroy\n render :update do |page|\n page.replace_html 'recommended', :partial=>\"recommendations/thumbs_up\", :locals=>{:item=>extract}\n page.replace_html 'award', :partial => \"recommendations/awards\", :locals => { :count => extract.recommendations.size }\n end\n end\n end", "def delete_recommendation\n choose_country\n \n puts \"The recommendation for #{@chosen_country.name.capitalize} has been deleted from Traveler's Insight.\"\n crud_menu\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy # also destroys associated qfounders\n\n# flips to accel index.html, should flip to ques new.html?\n respond_to do |format|\n# format.html { redirect_to new_questionnaire_path }\n format.html { redirect_to accelerators_path }\n format.xml { head :ok }\n end\n end", "def destroy\n @blog_recommendation.destroy\n respond_to do |format|\n format.html { redirect_to blog_recommendations_url, notice: 'Recommendation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @movie_user_recommendation.destroy\n respond_to do |format|\n format.html { redirect_to movie_user_recommendations_url, notice: 'Recommendation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@recommendation = Recommendation.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to recommendations_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n @review.destroy\n\n head :no_content\n end", "def destroy\n @review.destroy\n\n head :no_content\n end", "def destroy\n @review.destroy\n\n head :no_content\n end", "def destroy\n @recommend_recommend_ptag = Recommend::RecommendPtag.find(params[:id])\n @recommend_recommend_ptag.destroy\n\n respond_to do |format|\n format.html { redirect_to recommend_recommend_ptags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_nature_of_review.destroy\n respond_to do |format|\n format.html { redirect_to admin_nature_of_reviews_url, notice: 'Nature of review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_to do |f|\n if !(already_liked?)\n f.html {redirect_to :back, notice: \"Already unliked.\"}\n else\n @like.destroy\n end\n f.html {redirect_to :back}\n end\n end", "def destroy\n @suggest.destroy\n respond_to do |format|\n format.html { redirect_to suggests_url, notice: 'Suggest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review_template.destroy\n respond_to do |format|\n format.html { redirect_to review_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recruiter.destroy\n respond_to do |format|\n format.html { redirect_to admin_recruiters_url, notice: 'Recruiter was successfully destroyed.' }\n end\n end", "def destroy\n @favorite_recipe.destroy\n respond_to do |format|\n format.html { redirect_to favorite_recipes_url, notice: 'Favorite recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_book(book_id)\n erb :\"partials/_delete_book\", locals: { book_id: book_id }\n end", "def destroy\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.find(params[:id])\n @recommender.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_recommenders_path(@collection) }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n flash[:notice]='Suggestion was successfully deleted.'\n redirect to '/'\n end", "def destroy\n ## Fetching the <%= instance_name %>\n @<%= instance_name %> = <%= model_class %>.find(params[:id])\n \n respond_to do |format|\n ## Destroying the <%= instance_name %>\n @<%= instance_name %>.destroy\n \n # Fetch the <%= instances_name %> to refresh ths list and details box\n get_collections\n @<%= instance_name %> = @<%= instances_name %>.first\n \n # Setting the flash message\n message = translate(\"forms.destroyed_successfully\", :item => \"<%= instance_name.titleize %>\")\n store_flash_message(message, :success)\n \n format.html { \n redirect_to <%= resource_link('index', 'url') %> notice: message\n }\n format.json { head :no_content }\n format.js {}\n \n end\n end", "def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'La recette a été supprimée.' }\n end\n end", "def destroy\n ## Fetching the <%= instance_name %>\n @<%= instance_name %> = <%= model_class %>.find(params[:id])\n\n respond_to do |format|\n ## Destroying the <%= instance_name %>\n @<%= instance_name %>.destroy\n @<%= instance_name %> = <%= model_class %>.new\n\n # Fetch the <%= instances_name %> to refresh ths list and details box\n get_collections\n @<%= instance_name %> = @<%= instances_name %>.first if @<%= instances_name %> and @<%= instances_name %>.any?\n\n # Setting the flash message\n message = translate(\"forms.destroyed_successfully\", :item => \"<%= instance_name.titleize %>\")\n store_flash_message(message, :success)\n\n format.html {\n redirect_to <%= resource_link('index', 'url') %> notice: message\n }\n format.json { head :no_content }\n format.js {}\n\n end\n end", "def destroy\n @recommendation = Recommendation.find(params[:id])\n authorize @recommendation\n if @recommendation.destroy\n flash[:notice] = \"Deleted from recommendations\"\n redirect_to root_path\n else\n flash[:notice] = \"Couldn't delete recommendation\"\n redirect_back(fallback_location: root_path)\n return\n end\n end", "def destroy\n @rationale.destroy\n respond_to do |format|\n format.html { redirect_to rationales_url, notice: 'Rationale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n render('destroy')\n end", "def destroy\n @suggested_category.destroy\n respond_to do |format|\n format.html { redirect_to suggested_categories_url, notice: 'Suggested category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @appreciation.destroy\n respond_to do |format|\n format.html { redirect_to appreciations_url, notice: 'Appreciation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lecturer.destroy\n respond_to do |format|\n flash[:notice] = \"Record dosen berhasil dihapus, #{undo_link(@lecturer)}\"\n format.html { redirect_to lecturers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n redirect_to root_url\n end", "def delete_product_2_review\n review = Review.find(params[:id])\n product = Product.find(params[:product_id])\n review.product_ids.delete(product.id)\n review.product_idurls.delete(product.idurl) \n review.save\n render :update do |page|\n page.replace(\"products_4_review\",\n :partial => \"/reviews/products_4_review\",\n :locals => { :review => review } )\n end\n end", "def destroy\n\t\[email protected]\n\t\tredirect_to car_path(@car)\n\tend", "def destroy\n render \"destroy.js.coffee\"\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Rating was successfully destroyed.' }\n\n end\n end", "def destroy\n @review = find_review\n @review.destroy\n redirect_to reviews_path\n end", "def destroy\n @favorite.destroy\n\n head :no_content\n end", "def destroy\n @<%= orm_instance.destroy %>\n respond_with @<%= singular_table_name %>\n end", "def destroy\n @discount_template = DiscountTemplate.find(params[:id])\n @discount_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(discount_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @favourites_recipe.destroy\n respond_to do |format|\n format.html { redirect_to favourites_recipes_url, notice: 'Favourites recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pending_recommended_link.destroy\n\n head :no_content\n end", "def destroy\n @suggestion.destroy\n respond_to do |format|\n format.html { redirect_to suggestions_url, notice: 'Suggestion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Review was successfully destroyed.' }\n end\n end", "def destroy\n @food_review.destroy\n respond_to do |format|\n format.html { redirect_to food_reviews_url, notice: 'Food review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @suggestion = Suggestion.find(params[:id])\n @suggestion.destroy\n\n respond_to do |format|\n format.html { redirect_to(root_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n @suggestion = Suggestion.find(params[:id])\n @suggestion.destroy\n\n respond_to do |format|\n format.html { redirect_to(suggestions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @recommend_other_column = Recommend::OtherColumn.find(params[:id])\n @recommend_other_column.destroy\n\n respond_to do |format|\n format.html { redirect_to recommend_other_columns_url }\n format.json { head :no_content }\n end\n end", "def destroy \n @establishment = Establishment.find(params[:establishment_id])\n @reviews = @establishment.reviews.find(params[:id])\n @reviews.destroy\n redirect_to @establishment\n \n=begin\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n=end\n end", "def destroy\n Article.destroy(params[:id])\n render :inline => \"Статья удалена\"\n end", "def destroy\n @traditional_literature_book.destroy\n respond_to do |format|\n format.html { redirect_to traditional_literature_books_url, notice: \"Traditional literature review was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\[email protected]\n\t\tredirect_to admins_path\n\tend", "def destroy\n\t\t\t\tDriverReview.destroy(current_review)\n\t\t\t\trender_success\n\t\t\tend", "def destroy\n @tips_trick.destroy\n\n respond_to do |format|\n format.html { redirect_to tips_tricks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ingredient_suggestion.destroy\n respond_to do |format|\n format.html { redirect_to ingredient_suggestions_url, notice: 'Ingredient suggestion was successfully destroyed.' }\n format.json do\n # head :no_content\n render :nothing => true, :status => 200\n end\n end\n end", "def destroy\n @knowledge.destroy\n respond_to do |format|\n format.html { redirect_to knowledges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n respond_to do |format|\n format.html { redirect_to @review.lecture, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n render :nothing => true\n end", "def drop_view(name)\n unless @enduser\n raise Empire::MissingEnduserError.new\n end\n path = \"view/#{name}\"\n request path, :delete\n end", "def destroy\n if !@is_author\n redirect_to document_suggestions_url, notice: 'You can not destroy if you are not author'\n else\n @suggestion.destroy\n respond_to do |format|\n format.html { redirect_to document_suggestions_url, notice: 'Suggestion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @suggestion = Suggestion.find(params[:id])\n @suggestion.destroy\n\n\t\tflash[:notice] = 'Suggestion was successfully removed.'\n\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end", "def destroy\n @recommendation = Recommendation.find(params[:id])\n authorize @recommendation\n if @recommendation.destroy\n ArticleRankingWorker.perform_async(@recommendation.article_id)\n end\n\n head :no_content\n end", "def destroy\n @recipe.destroy\n redirect_to recipes_path, notice: 'Recipe successfully deleted!!'\n end", "def destroy\n @review.destroy\n respond_to do |format|\n # Broadcast remove review on list from model.\n format.turbo_stream { render turbo_stream: \"\" }\n format.html { redirect_to recipe_path(@recipe, anchor: \"reviews_header\"), notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @future_recipe.destroy\n respond_to do |format|\n format.html { redirect_to future_recipes_url, notice: 'Future link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def original_destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to(recipes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @favor.destroy\n\n respond_to do |format|\n format.html { redirect_to favors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommend_recommend_quiz = Recommend::RecommendQuiz.find(params[:id])\n @recommend_recommend_quiz.destroy\n\n respond_to do |format|\n format.html { redirect_to recommend_recommend_quizzes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @yourview.destroy\n respond_to do |format|\n format.html { redirect_to yourviews_url, notice: 'Your view was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_learned.destroy\n respond_to do |format|\n format.html { redirect_to question_question_learneds_path(@question) }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe.destroy\n redirect_to recipes_url, notice: \"Recipe was successfully destroyed.\"\n end", "def destroy\n @product.destroy\n prepare_products(25,'any')\n render :template => 'manage/products/index' and return\n end", "def destroy\n notice = '\"'[email protected]+'\" was successfully removed.'\n @fooddrink.destroy\n if request.referrer.eql?(request.base_url+\"/admin/fooddrink\")\n redirect_url = :back\n else\n redirect_url = root_url\n end\n \n respond_to do |format|\n format.html { redirect_to redirect_url, notice: notice }\n format.json { head :no_content }\n end\n end", "def destroy\n @favourite_drink.destroy\n respond_to do |format|\n format.html { redirect_to favourite_drinks_url, notice: 'Favourite drink was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pug.destroy\n\n head :no_content\n end", "def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n format.js { render action: \"index\" }\n end\n end", "def destroy\n\n @recipe.destroy\n redirect_to root_path, notice: \"Succesfully deleted Question\"\nend", "def destroy\n @interview = Interview.find_by_slug(params[:id])\n @interview.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_interviews_path, notice: 'Interview was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @prefer = Prefer.find(params[:id])\n @prefer.destroy\n\n respond_to do |format|\n format.html { redirect_to prefers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n redirect_to \"/\"\n # @vote_d.destroy\n # respond_to do |format|\n # format.html { redirect_to vote_ds_url, notice: 'Vote d was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @alternative_tag_name.destroy\n respond_to do |format|\n format.html { redirect_to alternative_tag_names_url, notice: \"Alternative tag name was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'Rating was successfully destroyed.' }\n end\n end", "def destroy\n @challenge.destroy\n render :index\n \n end", "def destroy\n @question_like.destroy\n respond_to do |format|\n format.html { redirect_to question_question_likes_path(@question) }\n format.json { head :no_content }\n end\n end" ]
[ "0.6771026", "0.6476143", "0.6476143", "0.6451297", "0.64286983", "0.6419741", "0.63975173", "0.6362883", "0.6356044", "0.6321648", "0.62987703", "0.6298714", "0.62985754", "0.6293573", "0.62812376", "0.6242178", "0.62248", "0.6218811", "0.61885214", "0.61388904", "0.610874", "0.60975987", "0.60630834", "0.6055673", "0.60386354", "0.6013231", "0.6013231", "0.6013231", "0.60037047", "0.5989638", "0.59860665", "0.59835404", "0.5966316", "0.59440106", "0.59425485", "0.59351224", "0.5924564", "0.592388", "0.5920667", "0.5916903", "0.59073055", "0.5905874", "0.5896014", "0.58953965", "0.58940274", "0.58891183", "0.58668184", "0.58598894", "0.58584136", "0.5856644", "0.5850424", "0.5844276", "0.5841779", "0.5817362", "0.5812207", "0.5801405", "0.57980555", "0.5795595", "0.5788379", "0.5784279", "0.57840097", "0.5780724", "0.5777498", "0.57728213", "0.57715", "0.5767184", "0.5766649", "0.5763665", "0.5762912", "0.5759938", "0.5750635", "0.57426155", "0.5740934", "0.57307374", "0.5728037", "0.5723448", "0.5720565", "0.57182175", "0.5715738", "0.571239", "0.57117367", "0.5710965", "0.570956", "0.5708058", "0.5697841", "0.56977844", "0.56973344", "0.5696149", "0.56941193", "0.56929624", "0.5692717", "0.5691579", "0.5691222", "0.56849545", "0.5684453", "0.5684275", "0.5681984", "0.5680226", "0.56788635", "0.5678392" ]
0.6862138
0
the snippet below is shared by show, edit, update, destroy
def set_application @application = Application.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_show\n\tend", "def update_show\n\tend", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n\t\t\n\tend", "def edit\r\n \r\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def editing ; view.editing ; end", "def edit\n\n\tend", "def edit\n\n\tend", "def edit\n\n\tend", "def edit\n\n\tend", "def edit \n end", "def edit \n end", "def edit\n #Nothing necessary\n end", "def edit\r\n end", "def edit\n\n end", "def show\n update\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.7237227", "0.7237227", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.69837564", "0.6869316", "0.6869316", "0.6869316", "0.6869316", "0.6869316", "0.6869316", "0.6869316", "0.68372494", "0.6709547", "0.6688182", "0.6688182", "0.6688182", "0.6688182", "0.6688182", "0.6688182", "0.6688182", "0.6688182", "0.6688182", "0.6688182", "0.6688182", "0.6688182", "0.6688182", "0.6688182", "0.6662313", "0.66550094", "0.66550094", "0.66550094", "0.66550094", "0.66427976", "0.66427976", "0.6625561", "0.6620217", "0.6602045", "0.65996474", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027", "0.65794027" ]
0.0
-1
1. serve(dispatcher) 2. serve(obj, accept = obj.public_methods)
def serve(obj, accept = obj.public_methods) if obj.is_a?(Dispatcher) # 2. @dispatcher = obj else # 1. @dispatcher = ObjectDispatcher.new(obj, accept) end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serves(&method_def)\n this.module_eval(&method_def)\n end", "def router; end", "def do_dispatch(env)\n path = env['PATH_INFO']\n\n # Try to serve a public file\n ret = dispatch_public(env, path)\n return ret if not ret.nil?\n\n log.debug \"Checking for routes that match: #{path}\"\n route = router.match(env)\n\n if route.has_key? :ok\n dispatch_controller(route, env)\n else\n [404, {\"Content-Type\" => \"text/plain\"}, [\"404 Not Found: #{path}\"]]\n end\n end", "def autoroute_methods\n self.public_instance_methods.select{|m|m.to_s.start_with?(AutoRouter::Router::METHOD_PREFIX)}\n end", "def handlers; end", "def handlers; end", "def handlers; end", "def _routes; end", "def method_missing(method, *args)\n @server.send(method, *args)\n end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def __send__(*rest) end", "def dispatch!\n \n # negotiates initial configuration\n @meta = self.negotiate!\n \n # dispatches hash set to the server\n self.dispatch_hashing!\n self.dispatch_hashset!\n \n # dispatches orders\n self.dispatch_orders!\n \n # dispatches messages\n self.handle_messages!\n \n end", "def api\n methods - Object.public_methods\n end", "def define_routable_methods router_class\n define_method router_class.route_name_method_name do \n router_class.route_name self\n end\n \n define_method router_class.url_method_name do \n router_class.url self\n end\n \n define_method router_class.path_method_name do \n router_class.path self\n end\n end", "def respond(); end", "def handler_method; end", "def dispatch(name, req, res); end", "def route\n #TODO\n end", "def __apply__(rule) = public_send(rule)", "def accept *args\n @actor.gate.accept( :object, *args )\n end", "def any(path, &block)\n route 'GET', path, &block\n route 'POST', path, &block\n end", "def routes\n raise NotImplementedError\n end", "def routes(&block); end", "def routes(&block); end", "def method_missing(method, *args, &block)\n @middlewares.send(method, *args, &block)\n end", "def middleware; end", "def route() request.route end", "def accept(*) end", "def accept(*) end", "def accept(*) end", "def method_missing(method, *args)\n self.get unless self.loaded\n\n [:attributes, :objects, :links].each do |field|\n if self.send(field).respond_to?(method)\n if self.class == HyperResource\n define_singleton_method(method) do |*argz|\n self.send(field).send(method, *argz)\n end\n else\n self.class.send(:define_method, method) do |*argz|\n self.send(field).send(method, *argz)\n end\n end\n return self.send(field).send(method, *args)\n end\n end\n super\n end", "def method_missing(method, *args, &block)\n object.public_send(method, *args, &block)\n end", "def dispatch\n Engine.instance.dispatch([self])\n end", "def handler; end", "def handler; end", "def methods() end", "def proxy; end", "def proxy; end", "def proxy; end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def accept; end", "def accept; end", "def public_class_method(*rest) end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def expose; end", "def controller_respond_to\n render :text => private_methods.collect(&:to_s).include?(params[:method]) ? '1' : '0'\n end", "def make_public(obj)\n obj.private_methods.each do |method_name|\n obj.singleton_class.class_eval { public method_name }\n end\n obj\nend", "def call(env)\n # p env.inspect\n # [200, {\"Content-Type\" => \"text/html\"}, \"DOH!!!\"]\n path = env[\"PATH_INFO\"]\n # match env.path_info against the route compile\n #p env.inspect\n route = Doozer::Routing::Routes::match(path)\n # p \"path: #{path}\"\n # p \"route: #{route.inspect}\"\n app = nil\n \n if not route.nil?\n if route.app.nil?\n extra_params = route.extra_params(path)\n controller_klass = handler(route.controller.to_sym)\n controller = controller_klass.new({:env=>env, :route=>route, :extra_params=>extra_params, :port=>@options[:Port]})\n \n # call after_initialize test for excludes\n #execution_time('controller.after_initialize',:start)\n controller.after_initialize if not controller_klass.after_initialize_exclude.include?(route.action.to_sym)\n #execution_time(nil, :end)\n \n begin\n\n # call before_filter test for excludes\n #execution_time('controller.before_filter',:start)\n controller.before_filter if not controller_klass.before_filter_exclude.include?(route.action.to_sym)\n #execution_time(nil,:end)\n \n # call the action method\n #execution_time('controller.method(route.action).call',:start)\n controller.method(route.action).call()\n #execution_time(nil,:end)\n \n # call after_filter test for excludes\n #execution_time('controller.after_filter',:start)\n controller.after_filter if not controller_klass.after_filter_exclude.include?(route.action.to_sym)\n #execution_time(nil, :end)\n \n # render controller...\n #execution_time('controller.render_result',:start)\n r = Rack::Response.new(controller.render_result, route.status, {\"Content-Type\" => route.content_type})\n #execution_time(nil,:end)\n r.set_cookie('flash',{:value=>nil, :path=>'/'})\n r.set_cookie('session',{:value=>controller.session_to_cookie(), :path=>'/'})\n r = controller.write_response_cookies(r)\n \n # finalize the request\n controller.finished!\n controller = nil\n app = r.to_a\n\n rescue Doozer::Redirect => redirect\n # set the status to the one defined in the route which type of redirect do we need to handle?\n status = (route.status==301) ? 301 : 302\n # check to make sure the status wasn't manually changed in the controller\n status = redirect.status if not redirect.status.nil?\n \n r = Rack::Response.new(\"redirect...\", status, {\"Content-Type\" => \"text/html\", \"Location\"=>redirect.url})\n # if we get a redirect we need to do something with the flash messages...\n r.set_cookie('flash',{:value=>controller.flash_to_cookie(), :path=>'/'}) # might need to set the domain from config app_name value\n r.set_cookie('session',{:value=>controller.session_to_cookie(), :path=>'/'})\n \n # finalize the request \n controller.finished!\n controller = nil\n app = r.to_a\n rescue => e\n # finalize the request\n controller.finished!\n controller = nil\n \n if Doozer::Configs.rack_env == :deployment\n logger.error(\"RuntimeError: #{e.to_s}\")\n for line in e.backtrace\n logger.error(\" #{line}\")\n end\n logger.error(\"Printing env variables:\")\n logger.error(env.inspect)\n app = [500, {\"Content-Type\" => \"text/html\"}, @@errors[500]]\n else\n raise e\n end\n end\n else\n app = route.app.call(env)\n end\n else\n app = [404, {\"Content-Type\" => \"text/html\"}, @@errors[404]]\n end\n \n # pass the app through route.middleware_after if defined\n app = route.middleware_after.new(app, {:config=>Doozer::Configs, :route=>route}).call(env) if route.middleware_after\n \n return app\n end", "def public_file_server; end", "def public_file_server; end", "def run(req, res)\n # The #run method will figure out what URL was requested, match it to\n # the path regex of one Route object, and finally ask the Route to\n # instantiate the appropriate controller, and call the appropriate method.\n end", "def dispatch\n raise NotImplementedError\n end", "def serve request, response, client, vhost\n @action.call(request, response, client, vhost) unless @action.nil?\n end", "def send(*args); __send__(*args); end", "def handle_routes\n instance_exec(@_roda_app.request, &self.class.router_block)\n end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def initialize\n @router = Router.new\n add_head_not_allowed_methods_and_options_methods\n self.class.endpoints.each do |endpoint|\n endpoint.mount_in(@router)\n end\n\n @router.compile!\n @router.freeze\n end", "def dispatcher\n endpoint_dispatch(params[:address])\n end", "def method_missing(method, *args, &block)\n return super unless object.respond_to?(method)\n\n object.public_send(method, *args, &block)\n end", "def accept\r\n end", "def forward!(receiver, *methods)\n methods.delete(\"__send__\")\n methods.delete(\"__id__\")\n methods.each {|method| forward(receiver, method)}\n end", "def method_missing(method_name, *args, &block)\n objects.send method_name, *args, &block\n end", "def accept\n\n end", "def public_methods(all=true)\n __getobj__.public_methods(all) | super\n end", "def handlers\n HTTP_METHODS.map do |sym|\n [sym, send(sym)]\n end\n end", "def add_public(context)\n FilterHolder.new(Rubylet::StaticFileFilter.new).tap do |holder|\n holder.setInitParameter 'resourceBase', public_root\n types = [DispatcherType::ASYNC,\n DispatcherType::ERROR,\n DispatcherType::FORWARD,\n DispatcherType::INCLUDE,\n DispatcherType::REQUEST]\n dispatches = Java::JavaUtil::EnumSet.of(*types)\n context.addFilter holder, url_pattern, dispatches\n end\n\n ServletHolder.new('default', DefaultServlet.new).tap do |holder|\n {\n 'acceptRanges' => true,\n 'welcomeServlets' => false,\n 'gzip' => true,\n 'resourceBase' => public_root\n }.each { |k,v| holder.setInitParameter(k, v.to_s) }\n context.addServlet holder, '/*'\n end\n end", "def expose(*meths)\n @exposed ||= []\n meths.each do |meth|\n @exposed << meth unless @exposed.include?(meth)\n end\n @exposed\n end", "def public_proxy?; end", "def public_proxy?; end", "def static_forwarding\n super\n end", "def public_methods(all=true) end", "def public_resource options\n @ins << lambda do |app|\n Rack::JSON::Filter.new(\n Rack::JSON::Resource.new(app, options),\n options.merge(:methods => [:post, :put, :delete]))\n end\n end", "def server(&blk); end", "def server(&blk); end", "def endpoints; end", "def public_instance_methods(arg0, arg1, *rest)\n end", "def process_methdef exp\n meth_name = exp.method_name\n\n Brakeman.debug \"Processing #{@current_class}##{meth_name}\"\n\n #Skip if instructed to only process a specific method\n #(but don't skip if this method was called from elsewhere)\n return exp if @current_method.nil? and @only_method and @only_method != meth_name\n\n is_route = route? meth_name\n other_method = @current_method\n @current_method = meth_name\n @rendered = false if is_route\n\n meth_env do\n if is_route\n before_filter_list(@current_method, @current_class).each do |f|\n process_before_filter f\n end\n end\n\n process_all exp.body\n\n if is_route and not @rendered\n process_default_render exp\n end\n end\n\n @current_method = other_method\n exp\n end", "def method_missing(method, *args, &block)\n if method.to_s.end_with?('_path', '_url')\n if main_app.respond_to?(method)\n main_app.send(method, *args)\n else\n super\n end\n else\n super\n end\n end" ]
[ "0.6186424", "0.6169457", "0.610142", "0.60769296", "0.6063888", "0.6063888", "0.6063888", "0.5908438", "0.58783454", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5831505", "0.5809337", "0.5807005", "0.57647324", "0.5754557", "0.572753", "0.56694525", "0.5645539", "0.56352603", "0.5616676", "0.56094384", "0.5608163", "0.559932", "0.559932", "0.5594097", "0.55910665", "0.55874795", "0.55812025", "0.55812025", "0.55812025", "0.55413216", "0.55327886", "0.5531936", "0.5519271", "0.5519271", "0.5517024", "0.55158645", "0.55158645", "0.55158645", "0.5514246", "0.5514246", "0.5514246", "0.5511388", "0.5511388", "0.55070615", "0.55052066", "0.55052066", "0.55052066", "0.55052066", "0.55052066", "0.55052066", "0.55052066", "0.55052066", "0.54927796", "0.5487964", "0.5486838", "0.5473509", "0.5473159", "0.5473159", "0.54655623", "0.5455758", "0.54556346", "0.5452201", "0.5451695", "0.54344565", "0.54344565", "0.54344565", "0.54344565", "0.543065", "0.5430425", "0.54255193", "0.542001", "0.5414496", "0.5395954", "0.5392517", "0.5392075", "0.5390077", "0.5387411", "0.53812903", "0.537071", "0.537071", "0.5363101", "0.53567183", "0.5352422", "0.53438544", "0.53438544", "0.53308684", "0.53238195", "0.5319663", "0.5316989" ]
0.8196175
0
1. listen(listener, obj = nil, accept = obj.public_methods) 2. listen(host, port, obj = nil, accept = obj.public_methods)
def listen(arg1, arg2 = nil, arg3 = nil, arg4 = nil) if arg1.respond_to?(:listen) # 1. listener = arg1 obj = arg2 accept = arg3 || obj.public_methods else # 2. listener = TCPServerTransport.new(Address.new(arg1,arg2)) obj = arg3 accept = arg4 || obj.public_methods end unless obj.nil? serve(obj, accept) end listener.listen(self) @listeners.push(listener) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listen\r\n end", "def listen(p0) end", "def listen(p0) end", "def listen(p0) end", "def listen\n # TODO\n self\n end", "def listen\n #Start listening for input.\n start_listen\n\n #Start listening for errors.\n start_listen_errors\n end", "def define_listening\n end", "def listen(port, host = \"0.0.0.0\", &hndlr)\n @j_del.listen(port, host, ARWrappedHandler.new(hndlr) { |j_del| self })\n end", "def initialize **kwargs, &block\n @accept_listeners = []\n register_accept_listener &block if block_given?\n \n # @interface = kwargs.fetch :interface, nil\n @interface = kwargs.fetch :interface, nil\n @port = kwargs.fetch :port, nil\n \n # Automatically select UDP for the multicast range. Otherwise default to TCP.\n default_protocol = :tcp\n \n if @interface\n # TODO: This ivar may be incorrect for UDP -- bound interface is not destination.\n default_protocol = :udp if Ionian::Extension::Socket.multicast? @interface\n default_protocol = :unix if @interface.start_with? '/'\n end\n \n @protocol = kwargs.fetch :protocol, default_protocol\n \n \n # TODO: Move this to #listen.\n case @protocol\n when :tcp\n @interface ||= '0.0.0.0' # All interfaces.\n \n # Parse host out of \"host:port\" if specified.\n host_port_ary = @interface.to_s.split ':'\n @interface = host_port_ary[0]\n @port ||= host_port_ary[1]\n \n raise ArgumentError, \"Port not specified.\" unless @port\n @port = @port.to_i\n \n @server = TCPServer.new @interface, @port\n @server.setsockopt ::Socket::SOL_SOCKET, ::Socket::SO_REUSEADDR, [1].pack('i')\n \n when :udp\n raise ArgumentError, \"UDP should be implemented with Ionian::Socket.\"\n \n when :unix\n raise ArgumentError, \"Path not specified.\" unless @interface\n \n @server = UNIXServer.new @interface\n end\n \n listen if block_given?\n end", "def start_listener!\n memoize(\"#{args[:bind]}-#{args[:port]}\", :global) do\n build_listener do |req|\n begin\n msg = build_message(req)\n # Start with static path lookup since it's the\n # cheapest, then fallback to iterative globbing\n msg_queue = nil\n unless(msg_queue = message_queues[\"#{req.path}-#{req.method.to_s.downcase}\"])\n message_queues.each do |k,v|\n path_glob, http_method = k.split('-')\n if(req.method.to_s.downcase == http_method && File.fnmatch(path_glob, req.path))\n msg_queue = v\n end\n end\n end\n if(msg_queue)\n if(authorized?(msg))\n msg_queue[:queue] << msg\n if(msg_queue[:config][:auto_respond])\n code = msg_queue[:config].fetch(:response, :code, 'ok').to_sym\n response = msg_queue[:config].fetch(:response, :message, 'So long and thanks for all the fish!')\n req.respond(code, response)\n end\n else\n req.respond(:unauthorized, 'You are not authorized to perform requested action!')\n end\n else\n req.respond(:not_found, 'Requested path not found!')\n end\n rescue Zoidberg::DeadException\n raise\n rescue => e\n req.respond(:bad_request, \"Failed to process request -> #{e}\")\n puts \"#{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n end\n end", "def listen(port, host = \"0.0.0.0\", &hndlr)\n @j_del.listen(port, host, ARWrappedHandler.new(hndlr) {|j_del| self})\n self\n end", "def spoof()\n\t\tlisten()\n\n\t\tlisten()\n\tend", "def listening?; end", "def listen\n raise NotImplementedError.new(\"Implement listen() in your Invoker. \")\n end", "def listen\n @multi_node.listen\n end", "def start(host, port); end", "def listen(port=nil,address=nil)\n if !block_given? && port == nil && address == nil\n @j_del.java_method(:listen, []).call()\n return self\n elsif block_given? && port == nil && address == nil\n @j_del.java_method(:listen, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxTcpEventbusBridge::TcpEventBusBridge) : nil) }))\n return self\n elsif port.class == Fixnum && !block_given? && address == nil\n @j_del.java_method(:listen, [Java::int.java_class]).call(port)\n return self\n elsif port.class == Fixnum && address.class == String && !block_given?\n @j_del.java_method(:listen, [Java::int.java_class,Java::java.lang.String.java_class]).call(port,address)\n return self\n elsif port.class == Fixnum && block_given? && address == nil\n @j_del.java_method(:listen, [Java::int.java_class,Java::IoVertxCore::Handler.java_class]).call(port,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxTcpEventbusBridge::TcpEventBusBridge) : nil) }))\n return self\n elsif port.class == Fixnum && address.class == String && block_given?\n @j_del.java_method(:listen, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(port,address,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxTcpEventbusBridge::TcpEventBusBridge) : nil) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling listen(#{port},#{address})\"\n end", "def listen(options = {}, server = nil)\n server ||= create_server(options)\n Reactor.queue_task do\n monitor = Reactor.selector.register(server, :r)\n monitor.value = proc do\n accept_socket server, options do |io| # this next block won't run until ssl (if enabled) has started\n adapter = SERVER_ADAPTER.new(io, options)\n yield(adapter.driver, adapter) if block_given?\n Reactor.queue_task do\n adapter.add_to_reactor\n end\n logger.info \"Host accepted client connection #{io} on port #{options[:port]}\"\n end\n end\n end\n Reactor.start\n logger.info \"Host listening for new connections on port \" + options[:port].to_s\n server\n end", "def listener(options={},&blk)\n raise \"Cannot call listener inside another listener block.\" if (@listener or @listener_name)\n ops = resolve_defaults(options)\n ops[:num_processors] ||= 950\n ops[:timeout] ||= 0\n\n @listener = Mongrel::HttpServer.new(ops[:host], ops[:port].to_i, ops[:num_processors].to_i, ops[:timeout].to_i)\n @listener_name = \"#{ops[:host]}:#{ops[:port]}\"\n @listeners[@listener_name] = @listener\n\n if ops[:user] and ops[:group]\n change_privilege(ops[:user], ops[:group])\n end\n\n # Does the actual cloaking operation to give the new implicit self.\n if blk\n cloaker(&blk).bind(self).call\n end\n\n # all done processing this listener setup, reset implicit variables\n @listener = nil\n @listener_name = nil\n end", "def sysaccept(*) end", "def sysaccept(*) end", "def sysaccept(*) end", "def add_tcp_listener(host, port, optimize_for_latency = T.unsafe(nil), backlog = T.unsafe(nil)); end", "def start(host = T.unsafe(nil), port = T.unsafe(nil)); end", "def socket; end", "def socket; end", "def socket; end", "def socket; end", "def socket; end", "def listen(klass, *args)\n supervise klass, name, handlers, *args\n end", "def listen parameters = {}\n\t\t# update default values\n\t\tparameters[:index_file] ||= 'index.html'\n\t\tparameters[:assets_public] ||= '/assets'\n\t\tparameters[:assets_public].chomp! '/'\n\t\tparameters[:public] ||= parameters[:root] # backwards compatability\n\t\tputs \"Warning: 'root' option is being depracated. use 'public' instead.\" if parameters[:root]\n\n\t\tunless parameters[:upgrade_handler]\n\t\t\tparameters[:http_handler] = ::Plezi::Base::HTTPRouter.new\n\t\t\tparameters[:upgrade_handler] = parameters[:http_handler].upgrade_proc\n\t\t\t#??? else @active_router.delete :alias\n\t\tend\n\t\t# check if the port is used twice.\n\t\t@routers_locker.synchronize do\n\t\t\t@active_router = GRHttp.listen(parameters)\n\t\t\t@routers << @active_router[:http_handler]\n\t\t\tif parameters != @active_router\n\t\t\t\tparameters[:http_handler] = @active_router[:http_handler]\n\t\t\t\tparameters[:upgrade_handler] = @active_router[:upgrade_handler]\n\t\t\tend\n\t\t\t@active_router = @active_router[:http_handler]\n\t\t\t@active_router.add_host( parameters[:host], parameters )\n\t\tend\n\t\t# return the current handler or the protocol..\n\t\t@active_router\n\tend", "def listen(&proc)\n @listeners << proc\n end", "def start_server(host = T.unsafe(nil), port = T.unsafe(nil)); end", "def listen(callback)\n log.debug \"carbon listener on #{@bind}:#{@port}\"\n Coolio::TCPServer.new(@bind, @port, TCPUnbufferedSocket, log, @delimiter, callback)\n end", "def listen port, &block\n if @state != :state_inited\n return\n end\n @state = :state_started\n begin\n @server = WebSocket::EventMachine::Server.start(:host => '0.0.0.0', :port => port.to_s) { |ws|\n ws_context = {\n # 'monitor' or 'client'\n :type => nil,\n # for monitor connection\n :server_id => nil, :server_type => nil, :server_info => nil,\n # for client connection\n :client_id => nil,\n # for both connection\n :username => nil, :registered => false\n }\n ws.onopen {\n @wss[ws.signature] = ws\n peer_port, peer_host = Socket.unpack_sockaddr_in ws.get_peername\n emit 'connection', { :id => ws.signature, :ip => peer_host }\n }\n ws.onmessage { |msg, type|\n begin\n event, msg = parse msg\n case event\n when 'register'\n process_register_msg ws, ws_context, msg\n when 'monitor'\n process_msg_from_monitor ws, ws_context, msg\n when 'client'\n process_msg_from_client ws, ws_context, msg\n else\n end\n rescue => err\n end\n }\n ws.onclose {\n @wss.delete ws.signature\n if ws_context[:registered]\n case ws_context[:type]\n when 'monitor'\n remove_monitor_connection(ws_context[:server_id],\n ws_context[:server_type], ws_context[:server_info])\n when 'client'\n remove_client_connection ws_context[:client_id]\n else\n end\n emit 'disconnect', ws_context\n end\n }\n ws.onerror { |err|\n emit 'err', err\n }\n }\n block_given? && yield\n rescue => err\n emit 'error', err\n end\n on('connection') { |obj| ip_filter obj }\n end", "def listen(callback)\n log.info \"listening tcp socket on #{@bind}:#{@port}\"\n\n socket_manager_path = ENV['SERVERENGINE_SOCKETMANAGER_PATH']\n if Fluent.windows?\n socket_manager_path = socket_manager_path.to_i\n end\n client = ServerEngine::SocketManager::Client.new(socket_manager_path)\n lsock = client.listen_tcp(@bind, @port)\n Coolio::TCPServer.new(lsock, nil, SocketUtil::TcpHandler, log, @delimiter, callback)\n end", "def start\n\n self.listener = Rex::Socket::TcpServer.create(\n 'LocalHost' => self.listen_host,\n 'LocalPort' => self.listen_port,\n 'Context' => self.context,\n 'SSL' => self.ssl,\n 'SSLCert' => self.ssl_cert,\n 'SSLCompression' => self.ssl_compression,\n 'SSLCipher' => self.ssl_cipher,\n 'Comm' => self.comm\n )\n\n # Register callbacks\n self.listener.on_client_connect_proc = Proc.new { |cli|\n on_client_connect(cli)\n }\n self.listener.on_client_data_proc = Proc.new { |cli|\n on_client_data(cli)\n }\n\n self.listener.start\n end", "def listeners; end", "def request_listen\n send_command RemoteListenCommand.new(@client.remote_listen_address)\n enable_tunnel_timeouts \n end", "def listening_thread(local_port)\n LOG.info(\"%06d\"%Process::pid) {\"listening on port #{local_port}...\"}\n \n # check the parameter to see if it's valid\n m = /^(([0-9a-fA-F]{0,4}:{0,1}){1,8})\\/([0-9]{1,5})|(([0-9]{1,3}\\.{0,1}){4}):([0-9]{1,5})|([0-9]{1,5})$/.match(local_port)\n #<MatchData \"2001:4800:7817:104:be76:4eff:fe05:3b18/2000\" 1:\"2001:4800:7817:104:be76:4eff:fe05:3b18\" 2:\"3b18\" 3:\"2000\" 4:nil 5:nil 6:nil 7:nil>\n #<MatchData \"23.253.107.107:2000\" 1:nil 2:nil 3:nil 4:\"23.253.107.107\" 5:\"107\" 6:\"2000\" 7:nil>\n #<MatchData \"2000\" 1:nil 2:nil 3:nil 4:nil 5:nil 6:nil 7:\"2000\">\n case\n when !m[1].nil? # its AF_INET6\n socket = bind_socket(AF_INET6,m[3],m[1])\n when !m[4].nil? # its AF_INET\n socket = bind_socket(AF_INET,m[6],m[4])\n when !m[7].nil?\n socket = bind_socket(AF_INET6,m[7],\"0:0:0:0:0:0:0:0\")\n else\n raise ArgumentError.new(local_port)\n end\n ssl_server = OpenSSL::SSL::SSLServer.new(socket, $ctx);\n\n # main listening loop starts in non-encrypted mode\n ssl_server.start_immediately = false\n loop do\n # we can't use threads because if we drop root privileges on any thread,\n # they will be dropped for all threads in the process--so we have to fork\n # a process here in order that the reception be able to drop root privileges\n # and run at a user level--this is a security precaution\n connection = ssl_server.accept\n Process::fork do\n begin\n drop_root_privileges if !UserName.nil?\n begin\n remote_hostname, remote_service = connection.io.remote_address.getnameinfo\n rescue SocketError => e\n LOG.info(\"%06d\"%Process::pid) { e.to_s }\n remote_hostname, remote_service = \"(none)\", nil\n end\n remote_ip, remote_port = connection.io.remote_address.ip_unpack\n process_call(connection, local_port, remote_port.to_s, remote_ip, remote_hostname, remote_service)\n LOG.info(\"%06d\"%Process::pid) {\"Connection closed on port #{local_port} by #{ServerName}\"}\n rescue Errno::ENOTCONN => e\n LOG.info(\"%06d\"%Process::pid) {\"Remote Port scan on port #{local_port}\"}\n ensure\n # here we close the child's copy of the connection --\n # since the parent already closed it's copy, this\n # one will send a FIN to the client, so the client\n # can terminate gracefully\n connection.close\n # and finally, close the child's link to the log\n LOG.close\n end\n end\n # here we close the parent's copy of the connection --\n # the child (created by the Process::fork above) has another copy --\n # if this one is not closed, when the child closes it's copy,\n # the child's copy won't send a FIN to the client -- the FIN\n # is only sent when the last process holding a copy to the\n # socket closes it's copy\n connection.close\n end\n end", "def listener=(_arg0); end", "def server_port; end", "def listen_to(io, &callback); end", "def initialize(host, port)\n @server = TCPServer.new(host, port)\n @handlers = []\n end", "def host_with_port; end", "def listen( *args, &blok )\n if args[0].kind_of? Symbol\n if args.size == 2\n args[1].each { |match| @procs << [args[0], match, blok] }\n else\n add( [args[0], nil, blok] )\n end\n elsif args[0].kind_of? Array\n if args.size == 2\n args[0].each { |match| add( [nil, match, args[1]] ) }\n else\n args[0].each { |match| add( [ :start_element, match, blok ] ) }\n end\n else\n add([nil, nil, args[0]])\n end\n end", "def initialize(port = 80, listen_host = '0.0.0.0', ssl = false, context = {},\n comm = nil, ssl_cert = nil, ssl_compression = false,\n ssl_cipher = nil)\n self.listen_host = listen_host\n self.listen_port = port\n self.ssl = ssl\n self.context = context\n self.comm = comm\n self.ssl_cert = ssl_cert\n self.ssl_compression = ssl_compression\n self.ssl_cipher = ssl_cipher\n self.listener = nil\n self.resources = {}\n self.server_name = DefaultServer\n end", "def connect\n start_listener!\n end", "def standard_port; end", "def listen\n @@em.schedule {\n @@em.start_server @host, @port, TCPConnection, { :rjr_node => self }\n }\n self\n end", "def start_listening\n\t\t@socket = UDPSocket.new\n\t\[email protected](@info.host, @info.port)\n\t\twhile true\n\t\t\ttext, sender = @socket.recvfrom(1024)\n\n\t\t\t\targuments = Marshal.load(text)\n\t\t\t\tmsg_type = arguments.shift\n\t\t\t\t\n\t\t\t\tputs \"Received msg: #{msg_type}, #{arguments} from remote #{sender}\"\n\n\t\t\t\tif msg_type == \"GET\"\n\t\t\t\t\tkey, port = arguments\n\t\t\t\t\tget(key.to_i, sender[3], port)\n\t\t\t\telsif msg_type == \"PUT\"\n\t\t\t\t\tkey, value = arguments\n\t\t\t\t\tput(key.to_i, value)\n\t\t\t\telsif msg_type == \"PING\"\n\t\t\t\t\tnode = arguments.first\n\t\t\t\t\tsend_message [\"OK\"], 0, node.host, node.port\n\t\t\t\telsif msg_type == \"OK\"\n\t\t\t\t\t@waiting = false\n\t\t\t\telsif msg_type == \"NEW_NODE\"\n\t\t\t\t\tnew_node_info = arguments.first\n\t\t\t\t\tnew_network_node(new_node_info)\n\t\t\t\telsif msg_type == \"ADD_NODE\"\n\t\t\t\t\tinfo = arguments.first\n\t\t\t\t\t@neighbour_nodes << info\n\t\t\t\telsif msg_type == \"DROP_NODE\"\n\t\t\t\t\tinfo = arguments\n\t\t\t\t\tto_delete = @neighbour_nodes.select { |n| n.host == info.host and n.port == info.port}\n\t\t\t\t\t@neighbour_nodes - to_delete\n\t\t\t\telsif msg_type == \"RESOURCE_TABLE\"\n\t\t\t\t\t@resource_table = arguments.first\n\t\t\t\telsif msg_type == \"ADD_RESOURCE\"\n\t\t\t\t\tresource = arguments.first\n\t\t\t\t\t@resource_table.merge!(resource)\n\t\t\t\t\tputs \"#{resource.to_a}\"\n\t\t\t\t\tputs \"#{request_queue}\"\n\t\t\t\t\tresolve_queue(resource.to_a[0][0])\n\t\t\t\tend \n\t\tend\n\tend", "def setup_socket\n self.socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)\n address = Socket.pack_sockaddr_in(@options[:port], @options[:host])\n socket.bind(address)\n socket.listen(@options[:max_connection_queue])\n log.info(\"Listening on #{@options[:host]}:#{@options[:port]}\")\n end", "def listening\n make_promise(@core.web3.JS[:net], 'getListening')\n end", "def listen\n connect do\n loop_routes do |route|\n if args = @client.retrieve(route)\n run(route, args)\n end\n end\n end\n end", "def listen &block\n register_accept_listener &block if block_given?\n \n @accept_thread ||= Thread.new do\n loop do\n # Package in an Ionian::Socket\n begin\n client = Ionian::Socket.new @server.accept\n @accept_listeners.each { |listener| listener.call client }\n rescue Errno::EBADF\n # This ignores the connection if the client closed it before it\n # could be accepted.\n rescue IOError\n # This ignores the connection if the client closed it before it\n # could be accepted.\n end\n end\n end\n end", "def connect(socket_class, host, port, nodelay = T.unsafe(nil)); end", "def listen\n @nodes.each { |node|\n node.listen\n }\n self\n end", "def socket_port; end", "def listen( sock )\n msg = sock.gets.chomp\n\n case msg\n when /^\\/([\\S]+)[\\n ]?(.+)?/\n cmd = Regexp.last_match(1)\n data = Regexp.last_match(2)\n # raise \"#{cmd} :: #{ data}\"\n execute( cmd.to_sym, find_client_by_socket(sock), data)\n when nil\n # do nothing\n when ''\n # do nothing\n else\n message( msg, find_client_by_socket(sock) ) if msg\n end\n\n end", "def startHttp(callback_opts) do\n server = TCPServer.new @host, @port\n while session = server.accept\n @implementation(session, callback_opts)\n end\n end", "def start_server!; @server = TCPServer.open($port) end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port=(_arg0); end", "def listen\n puts \"[#] rncp Listener: creating new connection\"\n l = bind_tcp\n puts \"[*] waiting for connections\" \n\n sock, info = l.accept\n printf \"[*] connection from %s:%s\\n\", info.ip_address, info.ip_port\n puts \"[*] receiving...\"\n\n data = \"\"\n while (sock.eof? == false)\n data += sock.gets()\n end\n\n untar data\n puts \"[*] received: \"\n\n puts \"[#] finished\"\n sock.close\n l.close\n end", "def server(&blk); end", "def server(&blk); end", "def bind(*) end", "def listen\n connect do\n routes.each do |route|\n @client.subscribe(route) do |args|\n run(route, args)\n end\n end\n \n loop do\n sleep 1\n end\n end\n end", "def listener; end", "def optional_port; end", "def start_client(host = T.unsafe(nil), port = T.unsafe(nil)); end", "def listen\n return @listener if @listener and @listener.alive?\n\n @listener = Thread.start do\n loop do\n response, (family, port, hostname, address) = @socket.recvfrom 1024\n\n begin\n adv = parse response\n\n info = case adv\n when Notification then adv.type\n when Response then adv.target\n when Search then adv.target\n else 'unknown'\n end\n\n response =~ /\\A(\\S+)/\n log :debug, \"SSDP recv #{$1} #{hostname}:#{port} #{info}\"\n\n @queue << adv\n rescue\n warn $!.message\n warn $!.backtrace\n end\n end\n end\n end", "def initialize_server(port)\r\n set :port, port # Specify Port For Sinatra Server\r\n set :bind, \"0.0.0.0\" # Allow Ping From External Devices\r\n set :environment, :production # Allow External Nodes To Query Websocket\r\n set :run, true # Start Sinatra Server\r\nend", "def standard_port?; end", "def connect(*) end", "def listen\n connect do\n routes.each do |queue|\n @client.subscribe(queue) do |args|\n run(queue, args)\n end\n end\n end\n while (!Thread.current[:shutdown]) do\n sleep(self.class.sleep_time)\n end\n end", "def initialize( host=\"0.0.0.0\", port=1138, interval=0.20 )\n\t\t@listener = TCPServer.new( host, port )\n\t\t@users = []\n\t\t@reactor = IO::Reactor.new\n\t\t@poll_interval = interval\n\t\t@shutting_down = false\n\n\t\t# Register for read events on the listener socket, and call the\n\t\t# 'handle_poll_event' method when a connection comes in\n\t\[email protected]( @listener, :read, &self.method(:handle_poll_event) )\n\tend", "def initialize(host = 'localhost', port = 4444, options = {})\n @host, @port, @async = host, port, options[:async]\n connect\n end", "def start_server\n @signature = EM.start_server(@host, @port, @handler) do |connection|\n setup_connection_opts(connection)\n end\n log(:info, \"Started listener #{@signature} on tcp://#{@host}:#{@port} (separator=#{@separator.inspect}).\")\n super\n end", "def port\n @hash[\"Listen\"].to_i\n end", "def socket()\n #This is a stub, used for indexing\n end", "def start_control(host = T.unsafe(nil), port = T.unsafe(nil)); end", "def listen(backlog)\r\n SocketError.check if (ret = Winsock.listen(@fd, backlog)) == -1\r\n ret\r\n end", "def bind_listen(address = '0.0.0.0:8080', opt = {})\n return address unless String === address\n\n sock = if address[0] == ?/\n if File.exist?(address)\n if File.socket?(address)\n begin\n UNIXSocket.new(address).close\n # fall through, try to bind(2) and fail with EADDRINUSE\n # (or succeed from a small race condition we can't sanely avoid).\n rescue Errno::ECONNREFUSED\n logger.info \"unlinking existing socket=#{address}\"\n File.unlink(address)\n end\n else\n raise ArgumentError,\n \"socket=#{address} specified but it is not a socket!\"\n end\n end\n old_umask = File.umask(opt[:umask] || 0)\n begin\n Kgio::UNIXServer.new(address)\n ensure\n File.umask(old_umask)\n end\n elsif /\\A\\[([a-fA-F0-9:]+)\\]:(\\d+)\\z/ =~ address\n new_tcp_server($1, $2.to_i, opt.merge(:ipv6=>true))\n elsif /\\A(\\d+\\.\\d+\\.\\d+\\.\\d+):(\\d+)\\z/ =~ address\n new_tcp_server($1, $2.to_i, opt)\n else\n raise ArgumentError, \"Don't know how to bind: #{address}\"\n end\n set_server_sockopt(sock, opt)\n sock\n end", "def listener()\n\t$server = TCPServer.open($port)\n\t#puts (\"start listening\")\n\tloop {\n\t\tclient = $server.accept()\n\t\t#puts (\"adding #{client} to reading list\")\n\t\t# synchronize reading list\n\t\t$semaphore.synchronize {\n\t\t\t$reading.push(client)\t\n\t\t}\n\t}\nend", "def use(klass, *args, &block)\n instance = klass.new(self, *args, &block)\n listen instance\n instance\n end", "def listen\n em_run do\n end\n end", "def initialize( port )\n # Setup the server:\n @server = TCPServer.new port\n end", "def listen\n @inbound = @socket.gets\n puts '>> ' << @inbound\n\n # Stay connected to the server.\n if @inbound =~ /^PING (?<msg>.*)$/\n pong = Regexp.last_match[:msg]\n send \"PONG #{pong}\"\n end\n\n # Respond to messages in the channel.\n @listeners.each do |listener|\n listener.response.call if @inbound.match listener.pattern\n end\n end", "def open_listener\n @listener = PCAPRUB::Pcap.open_live(IFACE, 65535, false, 1)\n @listener.setfilter(\"tcp port #{@port} and tcp[tcpflags] & tcp-ack != 0\")\n end", "def listen\n\n puts('listening')\n while true\n begin\n received_data = p @socket.recv(1000) # Receive\n Thread.new do # Start a new thread to handle the incoming message\n respond(JSON.parse(received_data)) # Determine how to respond to received and parsed message\n end\n rescue Errno::ECONNRESET # If there was an issue in replaying in respond function - e.g. remote host no longer up\n puts('Connection to remote host failed')\n end\n end\n end", "def handler(sock)\n end" ]
[ "0.76528496", "0.72869116", "0.72869116", "0.72869116", "0.71229774", "0.7050147", "0.7030404", "0.7012588", "0.6949588", "0.693439", "0.68662006", "0.6817472", "0.6783147", "0.67808944", "0.6667576", "0.6654661", "0.6650915", "0.6618438", "0.65849304", "0.657565", "0.657565", "0.657565", "0.65245414", "0.65098315", "0.64828044", "0.64828044", "0.64828044", "0.64828044", "0.64828044", "0.64771605", "0.64583665", "0.64326584", "0.63975406", "0.6396443", "0.63424146", "0.63322574", "0.6331855", "0.6317162", "0.63126135", "0.62915295", "0.6290874", "0.62802917", "0.62486553", "0.62473047", "0.6243589", "0.6232702", "0.61834335", "0.61760056", "0.617595", "0.6158116", "0.61576253", "0.61507446", "0.6149714", "0.61438096", "0.61436087", "0.6119914", "0.6115442", "0.6107127", "0.6106919", "0.61065155", "0.6099592", "0.60964626", "0.60964626", "0.60964626", "0.60964626", "0.60964626", "0.60964626", "0.60964626", "0.60964626", "0.60799104", "0.60696656", "0.6061774", "0.6061774", "0.60527426", "0.60479707", "0.60394096", "0.60375947", "0.6029864", "0.60296214", "0.6022882", "0.601353", "0.6008587", "0.6007814", "0.6002788", "0.60000885", "0.5998995", "0.5995485", "0.59857535", "0.59821093", "0.59802437", "0.5979942", "0.5971347", "0.59606385", "0.59427184", "0.59420973", "0.59372437", "0.59358525", "0.59300506", "0.5928956" ]
0.8365881
0
method to find the resulting array
def cartProd @items = [] @arr1.each{ |a| @arr2.each{ |b| item = [] << a << b @items << item } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_array_finding_method(source, thing_to_find)\n i = 0\n t = 0\n output_array = []\n while i < source.length\n if source[i].to_s.include?(thing_to_find)\n output_array[t] = source[i].to_s\n t += 1\n end\n i +=1\n end\n return output_array\nend", "def my_array_finding_method(source, thing_to_find)\n answer = Array.new\n source.each do |x|\n if x.to_s.include?(thing_to_find)\n answer << x\n end\n end\n p answer\nend", "def my_array_finding_method(source, thing_to_find)\n p final_array = source.select {|test| test.to_s.include?(thing_to_find.to_s)}\nend", "def my_array_finding_method(source, thing_to_find)\n p final_array = source.select {|test| test.to_s.include?(thing_to_find.to_s)}\nend", "def my_array_finding_method(source, thing_to_find)\n found_things_ary = Array.new\n\n source.each do |x|\n if x.to_s.include?(thing_to_find) == true\n found_things_ary.push(x)\n end\n end\n return found_things_ary\nend", "def my_array_finding_method(source, thing_to_find)\n new_array = source.select do |element|\n element.to_s.include? thing_to_find\n end\n return new_array\nend", "def my_array_finding_method(source, thing_to_find)\n found=[]\n source.each do |find|\n if find.to_s.include?(thing_to_find)\n found.push(find)\n end\n end\n return found\nend", "def my_array_finding_method(source, thing_to_find)\n ans = source.select {|x| x.to_s.include?(thing_to_find)}\n return ans\nend", "def my_array_finding_method(source, thing_to_find)\n result = [] # result is the output array\n source.each do |word|\n word_array = word.to_s.split(//) # This creates an array of charaters of 'word'\n if word_array.include?(thing_to_find)\n result.push(word)\n end\n end\n return result\nend", "def my_array_finding_method(source, thing_to_find)\n # Array to hold search resutls\n search_results = []\n # iterate over source\n source.each do |string|\n # if it's a number convert to a string\n if string.is_a?(Integer) == true\n string.to_s\n\n # if string is what we're looking for\n elsif string.include?(thing_to_find) == true\n # put it in our array\n search_results << string\n\n end\n\n\n end\n # return the array\n return search_results\nend", "def find(source)\n a = []\n self.each(){ |element| \n if element.source == source then\n\t #puts \"MATCH: [#{element.source}]\"\n\t a << element\n end\n }\n return a\nend", "def my_array_finding_method(source, thing_to_find)\n make_string = source.map { |e| e.to_s }\n make_string.select { |e| e.include?(thing_to_find) }\nend", "def my_array_finding_method(source, thing_to_find)\n match_words = []\n source.each do |word| \n for i in 0...word.to_s.length\n if thing_to_find === word[i]\n match_words.push(word)\n break\n end\n end\n end\n return match_words\nend", "def array_matching\n @array_matching ||= :first\n end", "def ret_array(_array, _ret, _id)\n if !_ret.nil?\n _ret.each do |_r|\n _array = _array << _r.read_attribute(_id) unless _array.include? _r.read_attribute(_id)\n end\n end\n end", "def ret_array(_array, _ret, _id)\n if !_ret.nil?\n _ret.each do |_r|\n _array = _array << _r.read_attribute(_id) unless _array.include? _r.read_attribute(_id)\n end\n end\n end", "def ret_array(_array, _ret, _id)\n if !_ret.nil?\n _ret.each do |_r|\n _array = _array << _r.read_attribute(_id) unless _array.include? _r.read_attribute(_id)\n end\n end\n end", "def ret_array(_array, _ret, _id)\n if !_ret.nil?\n _ret.each do |_r|\n _array = _array << _r.read_attribute(_id) unless _array.include? _r.read_attribute(_id)\n end\n end\n end", "def find; end", "def bsearch(array, target)\nend", "def final(arr,key)\n\tright = arr.length-1\n\tleft = 0\n\n\tresult = Array.new(2)\n\tresult[0] = -1\n\tresult[1] = -1\n\n\tsearch_range(arr,key,right,left,result)\n\tp result\nend", "def my_array_finding_method(source, thing_to_find)\n # final_array = []\n # source.each do |word|\n # if word.class == thing_to_find.class && word.include?(thing_to_find) == true\n # final_array << word\n # end\n # end\n # return final_array\n ###### refactor\n return source.grep(/#{ thing_to_find }/)\nend", "def calls_array\n a = return_array\n a[1]\n end", "def global_linear_search (object, array)\nputs \"nil\" if array.empty? == true\nputs \"nil\" if array.include?(object) == false\n\t\ni=0\nresults = []\nwhile i < array.length\nresults << i if array[i] == object\ni +=1\nend\nresults\nend", "def encontrar\t\n\t\[email protected]_i.times do |i| \n\t\t\[email protected]_i.times do |j| \t\t\t\t\n\t\t\t\tif yield(mat[i][j]) \n\t\t\t\t\treturn [i,j]\n\t\t\t\tend\t\t\t\t\t\n\t\t\tend\n\t\tend\n\tend", "def findlargestdrop(arr)\n\n\n\nend", "def match_result\n [match_x, match_y]\n end", "def my_array_finding_method(source, thing_to_find)\n result = source.select{ |word| word.to_s.include? (thing_to_find) }\n result\nend", "def my_array_finding_method(source, thing_to_find)\n source.select{|value| value.to_s.include?(\"#{thing_to_find}\")}\nend", "def returns_array?\n true\n end", "def find_array\n set_pattern\n @array.reject! do |item|\n item.match(@pattern) == nil\n end\n end", "def get_incresults(arr)\n # byebug\n if(arr.length == 0)\n 'no results available yet'\n else \n allIncorrect = arr.select do |ans|\n ans.is_right == false \n end\n end\nend", "def search_array(integers,search)\r\n\tintegers.each{|x|\r\n\t\tif x == search\r\n\t\t\treturn x\r\n\t\tend\r\n }\r\n\t return nil\r\nend", "def my_array_finding_method(source, thing_to_find)\n return source.grep(/#{thing_to_find}/)\nend", "def search_for_result(array, value)\n result = array.select {|number| number == value}\n if result.empty?\n puts \"value not found in final array\"\n else\n puts \"#{value} found in final array\"\n end\n @found = true\nend", "def find_cool(array)\n new_array = [ ]\n array.each do |x|\n if x.has_value?(\"cool\") == true\n new_array << x\n return new_array\n end\n end\nend", "def copy_and_return(result_or_array)\r\n if result_or_array.nil?\r\n nil\r\n elsif result_or_array.is_a?(Array)\r\n result_or_array.map {|r| copy_and_return(r) }\r\n else\r\n result_or_array.clone\r\n end\r\n end", "def find_result(fcn, options={})\n values = derived_values.reverse.select { |pb| pb.match(fcn, options) }\n if options[:all]\n values\n else\n return values.first unless values.empty?\n end\n end", "def rassoc obj\n @array.each do |elem|\n if elem.respond_to? :at and elem.at(1) == obj\n return elem\n end\n end\n\n nil\n end", "def my_hash_finding_method(source, thing_to_find)\n new_array = []\n source.map do |k, v|\n if v == thing_to_find\n new_array << k\n end\n end\n return new_array\nend", "def search_for_result(array, value)\n puts \"In search for result which happens when size of 2\"\n result = array.select {|number| number == value}\n if result.empty?\n puts \"value not found\"\n else\n puts \"#{value} found\"\n @found = true\n end\nend", "def find\n @hilbert_basis.find.transpose.to_a.collect{ |row|\n row_vector = Vector.elements(row.to_a, true)\n row_vector.inner_product @random_numbers\n }\n end", "def my_array_finding_method(source, thing_to_find)\n source.select { |word| word.to_s.include? thing_to_find }\nend", "def my_array_finding_method(source, thing_to_find)\n source.select { |word| word.to_s.include? thing_to_find}\nend", "def matched\n Array((operands.detect {|op| op.is_a?(Array) && op[0] == :matched} || [:matched])[1..-1])\n end", "def all\n @rarray\n end", "def find_target\n Array(target_class.find(source_ids.to_a))\n end", "def to_a\n @result\n end", "def to_a\n @result\n end", "def my_array_finding_method(source, thing_to_find)\n return source.select { |s| s.to_s.index(thing_to_find) != nil }\nend", "def get_id_result(id_array)#(id1, id2)\n return @id_formula[id_array.sort]\n end", "def array_result\n [@result['results']].flatten\n end", "def my_array_finding_method(i_want_pets, thing_to_find)\n p i_want_pets.select { |value| value.to_s.include? thing_to_find }\nend", "def my_hash_finding_method(source, thing_to_find)\n output_array = []\n i = 0\n source.each_pair { |key,value|\n if value == thing_to_find\n output_array[i] = key\n i += 1\n end\n }\n return output_array\nend", "def found\n return @found\n end", "def find_ones\n ones_arr = []\n\n @image.each_index do |row|\n @image[row].each_index do |column|\n if @image[row][column] == 1\n ones_arr << { :x => column, :y => row }\n end\n end\n end\n return ones_arr\n end", "def select_result(input, value)\n value_next = value + 1\n return @array << value if input.include?(value_next)\n\n array << value\n @result = @array if @result.size < @array.size\n @array = []\n end", "def compute_query_api_pattern_array_data(query_api_method_name, source, params_with_defaults, used_query_params)\n result = source.dup\n source.dup.each_with_index do |item, idx|\n value = compute_query_api_pattern_param(query_api_method_name, item, params_with_defaults, used_query_params)\n value == Utils::NONE ? result.delete_at(idx) : result[idx] = value\n end\n result\n end", "def get_result_array(args={})\n nums = args[:nums] \n bonus = args[:bonus]\n\n get_relevant_drawings({nums: nums, bonus: bonus}).map do |d| \n { \n :draw_date => d.draw_date.strftime('%a %b %d, %Y'), \n :pick_one => { :num => d.pick_one, :matched => is_matched?(d.pick_one,nums) }, \n :pick_two => { :num => d.pick_two, :matched => is_matched?(d.pick_two, nums) }, \n :pick_three => { :num => d.pick_three, :matched => is_matched?(d.pick_three, nums) }, \n :pick_four => { :num => d.pick_four, :matched => is_matched?(d.pick_four, nums) }, \n :pick_five => { :num => d.pick_five, :matched => is_matched?(d.pick_five, nums) }, \n :bonus_one => { :num => d.bonus_one, :matched => d.bonus_one == bonus }, \n :matches_count => d.matches_count(nums), \n :bonus_match => d.has_bonus_match(bonus)\n }\n end\n end", "def lcts(array)\nend", "def find_ones\n ones_locations = []\n # => finding index of ROW and COL for each 1 in grid and storing as row/col array pairs\n @image_array.each_index do |row|\n @image_array[row].each_index do |col|\n if @image_array[row][col] == 1\n puts \"#{row}, #{col}\" # <---this is just to display that it's working, can be removed\n ones_locations << [row, col]\n end\n end\n end\n return ones_locations\n end", "def find_unique_elements(arr)\n \nend", "def results\n\t\t\tArray(result)\n\t\tend", "def search(array, value)\n raise NotImplementedError, \"Method not implemented\"\nend", "def returns_array?\n true\n end", "def summer (array, target_number)\n\t#tracks number position in array \n\tindex = 0\n\t#array of two element arrays that is returned by function\n\tanswer_array = []\n\twhile index <= array.length\n\t \tarray.each do |number|\n\t\t\tif (((array[index].to_i + array[number].to_i) == target_number) && index != number)\n\t\t\t\tanswer_array.push([array[index], array[number]])\n\t\t\tend \n end\n index += 1 \n end \t\n answer_array\nend", "def get_contestant_name(data, occupation)\ndata.each do |season, season_array|\n season_array.each do |into_array|\n if into_array[\"occupation\"] == occupation\n job_p = []\n job_p = into_array[\"name\"]\n return job_p #WHY???\n end \n end \n end \nend", "def winner(array)\n\n win_x_combo = nil\n win_o_combo = nil\n xs = []\n os = []\n\n def x_extractor_helper(array, index) \n array.select.with_index.select do |j, index| \n j == \"X\" || j == \" X \"\n end\n end\n\n def o_extractor_helper(array, index) \n array.select.with_index.select do |j, index| #// or each_with_index\n j == \"O\" || j == \" O \"\n end\n end\n\n def array_dividing_helper_method(array) # need to go a level deeper in array to access [\"a\", 1] ?!\n output_array = []\n array.each do | index0 |\n output_array << index0[1] # need output_array to be local variable??! \n end \n #end # OLD ending to array_dividing_helper_method\n return output_array\n end # ends array_dividing_helper_method\n\n\n xs = array_dividing_helper_method(x_extractor_helper(array, array))\n os = array_dividing_helper_method(o_extractor_helper(array, array))\n\n WIN_COMBINATIONS.each do |combo|\n #os.all? # Instead, try \"os contains WIN_COMBINATIONS[i][0] and WIN_COMBINATIONS[i][1] and [i][2] \"\n if ( ( xs.include?(combo[0]) ) && ( xs.include?(combo[1]) ) ) # was win_x_combo, not xs\n if ( xs.include?(combo[2]) )\n #puts \"Winning X Combo is #{combo} \"\n win_x_combo = combo\n #return combo\n else puts \"No x Win Combination. current combo is #{combo}\"\n end\n end\n end\n \n WIN_COMBINATIONS.each do |combo|\n if ( ( os.include?(combo[0]) ) && ( os.include?(combo[1]) ) ) \n if ( os.include?(combo[2]) )\n #puts \"Winning O Combo is #{combo} \"\n win_o_combo = combo\n #return combo\n #else puts \"No o Win Combination\"\n end\n end\n end \n\n\n if ( win_x_combo != nil )\n puts \" X Won!\"\n return \"X\"\n end\n\n if ( win_o_combo != nil )\n puts \" O Won!\"\n return \"O\"\n else puts (\"No winner\") and\n return nil\n end\n\n\nend", "def search(array, value)\n raise NotImplementedError, \"Method not implemented\"\nend", "def search(array, value)\n raise NotImplementedError, \"Method not implemented\"\nend", "def find!\n @total_found = 0\n @results = nil\n return results\n end", "def results\n @results ||= with_hit.map(&:first)\n end", "def ArithGeo(arr)\n\n # code goes here\n return arr \n \nend", "def returns_array?\n false\n end", "def returns_array?\n false\n end", "def edge_array\n\t\t\t to_return = @responses.collect { |item| item.sollutions }\n\t\t\t return to_return\n\t\tend", "def nameri arr, query \n len = arr.length\n for idx in 0 .. len - 1 do\n if query == arr[idx]\n return idx \n else \n end\n end\nend", "def guess_array\n @guess_array\n end", "def test_concatonation_6\n find = Finder.new\n arr = []\n arr3 = find.concatonation(arr)\n assert_equal arr3, []\n end", "def find(key)\n root = root? key.slice(0)\n [].tap { |a| root and probe(0, root, key[1..-1], a) }\n # generate_result([], key) { |rkey, r| r.first.prepend(rkey) }\n end", "def test_finding_paths_4\n find = Finder.new\n arr = []\n arr3 = find.finding_paths(arr)\n assert_equal arr3, []\n end", "def Array(p0) end", "def search(array, length, value_to_find)\n puts \"NOT IMPLEMENTED\"\nend", "def find_a(any_array)\n any_array.find_all do |str|\n str[0] == \"a\"\n end\n end", "def find_ones\n # => Establish an empty array to hold the index positions of all the 1s\n ones_ary = []\n # => Finding the index of ROW and COL for each 1 in the grid and storing\n # => them as row/col array pairs\n\n # => |row| denotes the top-level array (could be named anything)\n @image_array.each_index do |row|\n # => |col| is the chosen variable name for the inner array\n @image_array[row].each_index do |col|\n if @image_array[row][col] == 1\n puts \"#{row}, #{col}\"\n ones_ary << [row, col]\n end\n end\n end \n return ones_ary\n end", "def search_all\n r=[]\n [:find_histogram,:find_density,:find_statistics,:find_original, :find_classification, :find_im,:find_ct].each do |m|\n r << self.send(m)\n puts \"Done with #{m}\"\n end\n r.flatten\nend", "def my_array_finding_method array, letter\n wooho = []\n array.each do |x|\n if x.class != Fixnum\n wooho << x if x.include? letter\n end\n end\n wooho\nend", "def find(input)\n end", "def find(data)\n @array.each do |element|\n return @array.index(element) if element.value == data\n end \n return nil \n end", "def another; return []; end", "def match_maker(determine, *elements)\n # Create a new array\n return_array = []\n # Loop through each item in the elements array, slicing into two\n elements.each_slice 2 do | first, last |\n # Create a variable that checks if the element is the opposite\n first = !!first\n last = !!last\n result = determine ? first != last : first == last\n # Push the result to the array\n return_array << result\n end\n # Return the array\n return_array\nend", "def my_array_finding_method(first_array, letter)\n new_array = []\n n = 0\n until n == first_array.length\n if first_array[n].to_s.include?(letter)\n new_array << first_array[n]\n end\n n += 1\n end\n return new_array\nend", "def find_a(array)\n new_a_array = []\n #binding.pry\n array.select do |item|\n if item[0]==\"a\"\n new_a_array<< item\n else\n puts \"nil\"\n end\n end\nnew_a_array\nend", "def solution \n row_search \n columns_search \n diagonal_search\n end", "def intersection(array_1, array_2)\n puts \"NOT IMPLEMENTED\"\n return []\nend", "def search(array, value)\n\ti = 0\n\treturn search_helper(array, value, i)\nend", "def combicheck(ref_arr, result)\r\n found_combi = []\r\n not_found_combi = []\r\n ref_arr.each do |item|\r\n #p item\r\n if combifind_in(item, result)\r\n found_combi << item\r\n else\r\n not_found_combi << item\r\n end\r\n end\r\n if found_combi.size == ref_arr.size\r\n log \"Combicheck is ok\"\r\n return true\r\n else\r\n log \"Combicheck failed, NOT found #{not_found_combi.size}/#{ref_arr.size} combi, they are:\"\r\n not_found_combi.each{|e| puts e.join(\",\") }\r\n end\r\n return false\r\n end", "def global_linear_search(c,bananas_arr)\n\n\tnew_array = []\n\n\tfor character in bananas_arr\n\t\tif character == c\n\t\tnum = bananas_arr.index(character)\n\t\tnew_array << num\n\t\tbananas_arr[num]=nil\n\telse\n\t\tend\n\tend\n\n\treturn new_array\nend", "def array\n @array\n end", "def find(result)\n @term_order if defined? @term_order\n \n result = result.gsub(/\\[|\\]|\\s/,'').split(',').collect!{|el|Rational(el)}\n denominators = result.collect{|r| r.denominator}\n multiplier = lcm(*denominators)\n solution = result.collect{|el| (el * multiplier).to_i}\n\n @term_order = Array.new(@hilbert_basis.basis.row_vectors.size) {|idx|\n if @supporting_hyperplane.include?(@kernel_matrix.kernel.to_a[idx])\n solution[@supporting_hyperplane.index(@kernel_matrix.kernel.to_a[idx])]\n else\n 0\n end\n }\n \n while @term_order.size < @hilbert_basis.basis.row_vectors.size\n @term_order << 0\n end\n \n @term_order\n end", "def classificateResult(label, sampleMap, foundAllArr)\n puts \"[classificateResult] started label #{label}\"\n foundArr = foundAllArr.select{|found| matchLabels?(found.label, label)}\n expRecognitionResult = Spnt::Exp::Data::ExpRecognitionResult.new()\n expRecognitionResult.falseNegative = []\n expRecognitionResult.falsePostive = []\n #missed = sampleArr - foundArr\n #1 step. filter that was found and transform to array\n substituted = sampleMap.select{|ekey, sample|\n if(matchLabels?( label, sample.label))\n nil == foundArr.detect{|found| sample.ekey == found.ekey && found.shouldStart != @@UNDEFINED_CELL} \n end\n }.collect { |k, v| v }\n deleted =foundArr.select{|found|\n found.foundStart == nil || found.foundStart == @@UNDEFINED_CELL \n }\n inserted =foundArr.select{|found|\n found.shouldStart == nil || found.shouldStart == @@UNDEFINED_CELL \n }\n \n puts \"[classificateResult] %s substituted: %i\" % [label, substituted.length]\n puts \"[classificateResult] %s deleted: %i\" % [label, deleted.length]\n puts \"[classificateResult] %s inserted: %i\" % [label, inserted.length]\n\n expRecognitionResult.falseNegative = (expRecognitionResult.falseNegative << substituted).flatten\n expRecognitionResult.falseNegative = (expRecognitionResult.falseNegative << deleted).flatten\n expRecognitionResult.falsePostive = (expRecognitionResult.falsePostive << inserted).flatten\n \n puts \"[classificateResult] %s falseNegative: %i\" % [label, expRecognitionResult.falseNegative.length]\n puts \"[classificateResult] %s falsePostive: %i\" % [label, expRecognitionResult.falsePostive.length]\n\n\n puts \"[classificateResult]substituted: \" + substituted.collect{|v| \" %i => %s[%s]\" % [v.id, v.ekey, v.foundStart]}.join(\"; \")\n\n# foundDuplicates = {}\n# expRecognitionResult.correct = foundArr.select{|found|\n# sample = sampleMap[found.ekey]\n# if(sample != nil && matchLabels?( label, found.label))\n# if(found.foundStart == nil)\n# #puts \"[classificateResult]falseNegative [#{found.ekey}] no start: #{sample.shouldStart} #{found.foundStart}\"\n# expRecognitionResult.falseNegative << sample\n# false\n# else\n# absStartDelta = (sample.shouldStart - found.foundStart).abs\n# absEndDelta = (sample.shouldEnd - found.foundEnd).abs\n# matched = sample.ekey == found.ekey && absStartDelta <= @@thresholdStart && absEndDelta <= @@thresholdEnd\n# if matched == true\n# foundDuplicateElement = foundDuplicates[found.ekey]\n# if foundDuplicateElement == nil\n# foundDuplicateElement = []\n# foundDuplicates[found.ekey] = foundDuplicateElement\n# end\n# foundDuplicateElement << found\n# #puts \"foundDuplicates[#{sample.ekey}] #{foundDuplicates[sample.ekey].length} #{matched && foundDuplicates[sample.ekey].length == 1}\"\n# end\n# matched && foundDuplicates[sample.ekey].length == 1\n# end\n# else\n# false\n# end\n# }\n #expRecognitionResult.falsePostive = foundArr.select{|found| !expRecognitionResult.correct.include?(found) && !expRecognitionResult.falseNegative.include?(found)}\n# expRecognitionResult.correct = foundArr.select{|found|\n# expRecognitionResult.falsePostive.include?(found) && expRecognitionResult.falseNegative.include?(found)\n# }\n expRecognitionResult.correct = foundArr.to_set - expRecognitionResult.falsePostive.to_set - expRecognitionResult.falseNegative.to_set;\n puts \"falsePostive[#{expRecognitionResult.falsePostive.length}] + falseNegative[#{expRecognitionResult.falseNegative.length}]+correct[#{expRecognitionResult.correct.length}] = foundArr[#{foundArr.length}]\"\n expRecognitionResult\n end" ]
[ "0.653251", "0.6500074", "0.6495656", "0.6495656", "0.6337211", "0.6333217", "0.62255305", "0.6201148", "0.6165521", "0.6163836", "0.60529613", "0.6027575", "0.6019639", "0.60153335", "0.5986668", "0.5986668", "0.5986668", "0.5986668", "0.5893575", "0.58699024", "0.58367825", "0.5829011", "0.58031297", "0.5777347", "0.57646567", "0.57630074", "0.5740219", "0.5738839", "0.5703741", "0.56682456", "0.5655566", "0.5653537", "0.5645917", "0.5643316", "0.56328213", "0.56326", "0.5619528", "0.5611025", "0.56085134", "0.5590986", "0.55901206", "0.55715317", "0.55670005", "0.55630136", "0.5561693", "0.5551148", "0.55437315", "0.55397534", "0.55397534", "0.55367965", "0.5530776", "0.552844", "0.55137473", "0.5513342", "0.5511406", "0.55068284", "0.54986334", "0.5489282", "0.5482507", "0.5480098", "0.54784787", "0.54724395", "0.547176", "0.5469966", "0.54575884", "0.54505175", "0.5444956", "0.54434395", "0.54418033", "0.54418033", "0.5439942", "0.54320365", "0.5430281", "0.54288965", "0.54288965", "0.54288846", "0.5428628", "0.54275316", "0.54162055", "0.5414486", "0.54132587", "0.54099065", "0.54004866", "0.5399059", "0.5378343", "0.5375803", "0.5373287", "0.5366808", "0.5364201", "0.53638357", "0.5363541", "0.5362186", "0.53605384", "0.5357563", "0.53508556", "0.53468305", "0.53348863", "0.5333455", "0.53300756", "0.5328579", "0.53251517" ]
0.0
-1
GET /viks GET /viks.json
def index @viks = Vik.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @ivas = Iva.all\n\n render json: @ivas\n end", "def index\n @vets = Vet.all\n end", "def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end", "def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end", "def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def show\n render json: @vat\n end", "def index\n @vdms = Vdm.all\n\n render json: @vdms\n end", "def index\n json_response(Spot.all)\n end", "def index_by_user\n @gifts = @current_user.gifts\n render json: @gifts, include: :ages, status: :ok\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 vips\n request :get, '/vips'\n end", "def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end", "def index\n tags = Tag.all\n render json: tags, status: :ok\n end", "def index\n @kids = Kid.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kids }\n end\n end", "def index\n @verbs = Verb.all\n\n render json: @verbs\n end", "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def index \n render json: Tuning.all\n end", "def index\n @varieties = Variety.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @varieties }\n end\n end", "def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end", "def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end", "def index\n\t\tvendas = Venda.all\n\t\trender json: vendas, status: :ok\n\tend", "def index\n @loves = Love.all\n render json: @loves\n end", "def index\n @venues = Venue.all\n\n render :json => @venues,\n :methods => [:average_rating,:user_count ,:avatar_picture],\n :include => :venue_photos\n end", "def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def index\n @api_v1_post_votes = PostVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_v1_post_votes }\n end\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def index\n @parks = Park.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parks }\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 index\n @used_bikes = UsedBike.all\n\n render json: @used_bikes, each_serializer: Web::V1::UsedBikeSerializer\n end", "def votd\n require 'rss'\n\n votd = RSS::Parser.parse('https://www.biblegateway.com/usage/votd/rss/votd.rdf?31', false)\n\n render json: votd\n end", "def index\n @pots = Pot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pots }\n end\n end", "def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end", "def index\n @vrhighlights = Vrhighlight.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @vrhighlights }\n end\n end", "def index\n allow :get\n expires_in 60.seconds\n\n nodes = @kavlan.nodes_vlan(params[:vlan_id])\n result = {\n 'total' => nodes.length,\n 'offset' => 0,\n 'items' => nodes.map { |n| { 'uid' => n, 'vlan' => params[:vlan_id] } },\n 'links' => links_for_collection\n }\n\n result['items'].each do |item|\n item['links'] = links_for_item(item)\n end\n\n render_result(result)\n end", "def index\n @cars = Car.all\n render json: @cars\n end", "def index\n render json: Visitor.paginate(:page => params[:page], :per_page => 300)\n end", "def index\n authenticate_request!\n @cars = Car.all\n\n render json: @cars\n end", "def index\n @vitricongviecs = Vitricongviec.all\n end", "def index\n @verbindungs = Verbindung.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbindungs }\n end\n end", "def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end", "def index\n @variants = Variant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variants }\n end\n end", "def index\n @cars = Car.all\n\n render json: @cars\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def view_api\n api_string = RestClient.get(\"https://itunes.apple.com/search?term=star+wars&entity=song&attribute=movieTerm\")\n api_hash = JSON.parse(api_string)\n\n end", "def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end", "def index\n @thumbs = Thumb.all\n\n render json: @thumbs\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 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 @virus = Virus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @virus }\n end\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def index\n if params[:genre]\n\n @tvs = Tv.tagged_with(params[:genre])\n\n elsif params[:search]\n\n @tvs = Tv.search(params[:search])\n\n else\n\n @tvs = Tv.all\n\n end\n #@tvs = Tv.search(params[:search]).paginate(:page => params[:page]) #paginate search\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tvs }\n end\n end", "def index\n @viri = Virus.all\n end", "def index\n @spots = Spot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end", "def index\n @livingexpenses = Livingexpense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @livingexpenses }\n end\n end", "def index\n @tunning_diagrams = TunningDiagram.accessible_by(current_ability).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunning_diagrams }\n format.xml { render xml: @tunning_diagrams }\n end\n end", "def index\n @pugs = Pug.all\n\n render json: @pugs\n end", "def index\n @votes = Vote.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def index\n pets = pets_from_query\n\n respond_to do |format|\n format.html do\n @pets = pets.paginate(page: params[:page], per_page: 10)\n end\n format.json do\n @pets = pets\n end\n end\n end", "def index\n @dogs = Dog.all\n render json: @dogs, each_serializer: DogSerializer, root: 'dogs'\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @places = Place.all\n render json: { places: @places }, methods: [:reviews, :visit_ids, :image_url_large]\n # render json: @places, methods: :reviews # return a place object not a places object as above\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @supervisions }\n end\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def index\n @vas_responses = VasResponse.all\n end", "def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def index\n @src_gsts = SrcGst.where(hotel_src_id: current_user.hotel_src_id).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @src_gsts }\n end\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n @parkers = Parker.all\n\t\trespond_with @parkers\n end", "def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def index\n @albums = Album.all\n render json: @albums\n end", "def index\n @archivs = Archiv.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @archivs }\n end\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 show\n @cvi = Cvi.find(params[:id])\n @animals = @cvi.animals\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cvi }\n end\n end", "def index\n @vils = Vil.all\n end", "def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end", "def index\n @players = Player.order(:gamertag_lower).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @players }\n end\n end", "def show\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koti }\n end\n end", "def index\n @trucks = Truck.all\n\n render json: @trucks\n end", "def index\n @textures = Texture.find(:all, :limit => 20, :order=> 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @textures }\n end\n end", "def index\n if params[:vid]\n @vendor = Vendor.find_by_slug(params[:vid])\n @quotations = @vendor.quotations\n end\n @quotations = @quotations.order(\"status\", sort_column + \" \" + sort_direction).page params[:page]\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quotations }\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 index\n @tracks = Track.all\n render json: {tracks: @tracks}\n end", "def index\n @videos = Video.all\n render json: @videos\n end", "def index\n render jsonapi: Book.search(params), include: [:genre, :author, :libraries]\n end", "def index\n @shots = Shot.all\n\n render json: @shots\n end", "def index\n @caption_votes = CaptionVote.all\n render json: @caption_votes\n end", "def show\n\n @venue = Venue.find(params[:id])\n render :json => @venue, \n :methods => [:average_rating,:user_count],\n :include => [:venue_photos,:parties]\n end", "def index\n @jsons = Json.all\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def index\n @pets = Pet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pets }\n end\n end" ]
[ "0.65858173", "0.6456122", "0.63259727", "0.6293573", "0.62791246", "0.62752664", "0.62547666", "0.6234687", "0.6215123", "0.61998016", "0.61779594", "0.6154071", "0.61339784", "0.61324036", "0.6128269", "0.61232793", "0.61231965", "0.61050344", "0.6099721", "0.60862076", "0.60854995", "0.60854995", "0.6083177", "0.6069112", "0.6059034", "0.60516614", "0.60515267", "0.6048888", "0.6047696", "0.6042878", "0.6036661", "0.6030597", "0.6029239", "0.60233873", "0.60233796", "0.6016856", "0.6001214", "0.5992992", "0.5992415", "0.59890527", "0.5986175", "0.5984642", "0.5980218", "0.59781414", "0.5977229", "0.5970612", "0.5967436", "0.5965551", "0.5961702", "0.5955599", "0.59540874", "0.59502405", "0.5930864", "0.59253085", "0.5924081", "0.5923954", "0.59191906", "0.5910468", "0.5904501", "0.5884036", "0.58806837", "0.5880128", "0.58798355", "0.58798355", "0.58798355", "0.5878719", "0.58779734", "0.5877744", "0.58726776", "0.5871716", "0.5871716", "0.5871716", "0.5871716", "0.5871716", "0.5871609", "0.5871238", "0.5871238", "0.5865751", "0.5865117", "0.58623767", "0.5854295", "0.5853479", "0.58530426", "0.5850537", "0.58490235", "0.58470064", "0.58440804", "0.58431774", "0.58427", "0.5842499", "0.5842168", "0.5839875", "0.58381873", "0.58348554", "0.5834846", "0.58347154", "0.58336383", "0.58326566", "0.5828784", "0.582453" ]
0.7048386
0
GET /viks/1 GET /viks/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @viks = Vik.all\n end", "def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\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 @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end", "def index\n @ivas = Iva.all\n\n render json: @ivas\n end", "def show\n @virus = Virus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @virus }\n end\n end", "def show\n render json: @vat\n end", "def show\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koti }\n end\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 show\n @cvi = Cvi.find(params[:id])\n @animals = @cvi.animals\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cvi }\n end\n end", "def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def show\n @vnic = Vnic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vnic }\n end\n end", "def index \n render json: Tuning.all\n end", "def index\n @kids = Kid.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kids }\n end\n end", "def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end", "def show\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @livro }\n end\n end", "def skjar1\n Apis.client.get('/tv/skjar1')\n end", "def index\n @vets = Vet.all\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def index\n @api_v1_post_votes = PostVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_v1_post_votes }\n end\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def index_by_user\n @gifts = @current_user.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end", "def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end", "def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end", "def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end", "def index\n @thumbs = Thumb.all\n\n render json: @thumbs\n end", "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def show\n @voc = Voc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voc }\n end\n end", "def index\n @varieties = Variety.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @varieties }\n end\n end", "def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def index\n @pots = Pot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pots }\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 index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end", "def show\n @vampire = Vampire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vampire }\n end\n end", "def index\n @textures = Texture.find(:all, :limit => 20, :order=> 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @textures }\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 index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end", "def index\n tags = Tag.all\n render json: tags, status: :ok\n end", "def show\n @tv = Tv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tv }\n end\n end", "def show\n @vodka = Vodka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vodka }\n end\n end", "def index\n @verbindungs = Verbindung.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbindungs }\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @supervisions }\n end\n end", "def show\n survivor = Suvivor.find(params[:id])\n render json: {status: 'SUCCESS', message:'Survivor founded', data:survivor},status: :ok\n end", "def index\n @vdms = Vdm.all\n\n render json: @vdms\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def show\n @kv = Kv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kv }\n end\n end", "def index_single_gift\n render json: @gift, include: :ages, status: :ok\n end", "def show\n @api_v1_post_vote = PostVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v1_post_vote }\n end\n end", "def show\n vehicle=Vehicle.where(uid: params[:id]).first\n render :json => {\"vehicle\"=>vehicle }\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\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 show\n @livestock = Livestock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @livestock }\n end\n end", "def index\n json_response(Spot.all)\n end", "def index\n @loves = Love.all\n render json: @loves\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @cars = Car.all\n render json: @cars\n end", "def show\n @vegetable = Vegetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vegetable }\n end\n end", "def index\n @viri = Virus.all\n end", "def show\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vano }\n end\n end", "def index\n @cars = Car.all\n\n render json: @cars\n end", "def show\n render json: @rock\n end", "def index\n @shots = Shot.all\n\n render json: @shots\n end", "def index\n @verbs = Verb.all\n\n render json: @verbs\n end", "def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end", "def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end", "def show\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rider }\n end\n end", "def show\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rider }\n end\n end", "def index\n @votes = Vote.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def show\n @nugget = Nugget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nugget }\n end\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def index\n @dogs = Dog.all\n render json: @dogs, each_serializer: DogSerializer, root: 'dogs'\n end", "def show\n @visit = Visit.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @visit }\n end\n end", "def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end", "def show\n @pinglun = Pinglun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinglun }\n end\n end", "def index\n @vrhighlights = Vrhighlight.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @vrhighlights }\n end\n end", "def index\n @instances = Instance.all\n render json: @instances\n end", "def index\n @variants = Variant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variants }\n end\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\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 index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def show\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_slim }\n end\n end", "def show\n @livingexpense = Livingexpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @livingexpense }\n end\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n @vitricongviecs = Vitricongviec.all\n end", "def index\n @dogs = Dog.all\n # render erb: 'dogs/index'\n render json: @dogs\n end", "def show\r\n render json: Tag.find(params[:id])\r\n end", "def index\n render json: Picture.all\n end", "def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\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" ]
[ "0.69221544", "0.6581487", "0.6558614", "0.6468531", "0.6377664", "0.63646936", "0.6353888", "0.62866795", "0.62602574", "0.6256544", "0.6234775", "0.62321854", "0.6228583", "0.6224482", "0.62148714", "0.6198122", "0.6195573", "0.61877054", "0.6175475", "0.61603016", "0.61585927", "0.61368227", "0.6135403", "0.6135096", "0.6133547", "0.61000043", "0.60860246", "0.6077053", "0.60745335", "0.60735446", "0.60717434", "0.6071453", "0.6067706", "0.6063487", "0.6062855", "0.6060018", "0.6053474", "0.6048325", "0.6047171", "0.604531", "0.60448915", "0.6030555", "0.6029389", "0.6028476", "0.6026516", "0.60254765", "0.6019063", "0.601713", "0.60144204", "0.60121524", "0.6009194", "0.60084915", "0.6008248", "0.6008248", "0.6008248", "0.60068476", "0.60046285", "0.60013956", "0.5997927", "0.59887266", "0.59887266", "0.59887266", "0.5988679", "0.5985889", "0.59831715", "0.5974641", "0.5973943", "0.59721124", "0.597169", "0.5970614", "0.5970058", "0.5970058", "0.59615666", "0.59615666", "0.5961331", "0.59564507", "0.5953619", "0.5952771", "0.5944876", "0.5943514", "0.59405166", "0.5938989", "0.5937993", "0.59377974", "0.59371006", "0.5935515", "0.5934494", "0.5934494", "0.5934494", "0.5934494", "0.5934494", "0.5931578", "0.59303373", "0.5929332", "0.5929332", "0.5927889", "0.5926562", "0.5925686", "0.59229875", "0.59216326", "0.59209126" ]
0.0
-1
POST /viks POST /viks.json
def create @vik = Vik.new(vik_params) respond_to do |format| if @vik.save format.html { redirect_to @vik, notice: 'Vik was successfully created.' } format.json { render :show, status: :created, location: @vik } else format.html { render :new } format.json { render json: @vik.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vik_params\n params.require(:vik).permit(:name, :location)\n end", "def create\n @giang_vien = GiangVien.new(params[:giang_vien])\n\n respond_to do |format|\n if @giang_vien.save \n format.json { render json: @giang_vien, status: :created, location: @giang_vien }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vet = Vet.new(params[:vet])\n\n respond_to do |format|\n if @vet.save\n format.html { redirect_to @vet, notice: 'Vet was successfully created.' }\n format.json { render json: @vet, status: :created, location: @vet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @viks = Vik.all\n end", "def create\n @vet = Vet.new(vet_params)\n\n respond_to do |format|\n if @vet.save\n format.html { redirect_to @vet, notice: 'Vet was successfully created.' }\n format.json { render :show, status: :created, location: @vet }\n else\n format.html { render :new }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sinh_vien = SinhVien.new(params[:sinh_vien])\n\n respond_to do |format|\n if @sinh_vien.save \n format.json { render json: @sinh_vien, status: :created, location: @sinh_vien }\n else \n format.json { render json: @sinh_vien.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 vig_params\n params.require(:vig).permit(:name, :date, :test_ids=>[])\n end", "def vig_params\n params.require(:vig).permit(:name, :date, :test_ids=>[])\n end", "def create\n @vestimentum = Vestimentum.new(vestimentum_params)\n\n respond_to do |format|\n if @vestimentum.save\n format.html { redirect_to @vestimentum, notice: 'Vestimentum was successfully created.' }\n format.json { render :show, status: :created, location: @vestimentum }\n else\n format.html { render :new }\n format.json { render json: @vestimentum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vil = Vil.new(vil_params)\n\n respond_to do |format|\n if @vil.save\n format.html { redirect_to @vil, notice: 'Vil was successfully created.' }\n format.json { render :show, status: :created, location: @vil }\n else\n format.html { render :new }\n format.json { render json: @vil.errors, status: :unprocessable_entity }\n end\n end\n end", "def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end", "def create\n @virus = Virus.new(params[:virus])\n\n respond_to do |format|\n if @virus.save\n format.html { redirect_to @virus, notice: 'Virus was successfully created.' }\n format.json { render json: @virus, status: :created, location: @virus }\n else\n format.html { render action: \"new\" }\n format.json { render json: @virus.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tv = Tv.new(params[:tv])\n\n respond_to do |format|\n if @tv.save\n format.html { redirect_to @tv, notice: 'Tv was successfully created.' }\n format.json { render json: @tv, status: :created, location: @tv }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tv.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n render json: Tuning.create(tuning_params)\n end", "def create\n @spice = Spice.new(spice_params)\n\n if @spice.save\n render json: @spice, status: :created\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end", "def create\n votes = params[:vote]\n voter = params[:voter_id]\n\n if votes\n votes.each do |k,v|\n @vote = Vote.new({:voter_id => voter,\n :position_id => v,\n :candidate_id => k })\n @vote.save\n end\n end\n\n\n redirect_to '/vote'\n\n #respond_to do |format|\n #if @vote.save\n #format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n #format.json { render json: @vote, status: :created, location: @vote }\n #else\n #format.html { render action: \"new\" }\n #format.json { render json: @vote.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 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 @vocalium = Vocalium.new(params[:vocalium])\n\n respond_to do |format|\n if @vocalium.save\n format.html { redirect_to @vocalium, :notice => 'Vocalium was successfully created.' }\n format.json { render :json => @vocalium, :status => :created, :location => @vocalium }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @vocalium.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @koti = Koti.new(params[:koti])\n\n respond_to do |format|\n if @koti.save\n format.html { redirect_to @koti, notice: 'Koti was successfully created.' }\n format.json { render json: @koti, status: :created, location: @koti }\n else\n format.html { render action: \"new\" }\n format.json { render json: @koti.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n vaga = Vaga.new(vaga_params)\n if vaga.save\n render json: {status: 'SUCCESSO', message:'Vaga adicionada com sucesso!', data:vaga},status: :ok\n else\n render json: {status: 'ERRO', message:'Houve um erro ao adicionar a vaga.', data:vaga.errors},status: :unprocessable_entity\n end\n end", "def create\n @onske = Onske.new(params[:onske])\n\n respond_to do |format|\n if @onske.save\n format.html { redirect_to @onske, notice: 'Onske was successfully created.' }\n format.json { render json: @onske, status: :created, location: @onske }\n else\n format.html { render action: \"new\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n species = Faker::Games::Pokemon.name\n nickname = Faker::Name.first_name\n trainer = Trainer.find(params[:trainer_id])\n if trainer.pokemons.length < 6\n pokemon = Pokemon.create(nickname: nickname, species: species, trainer_id: params[:trainer_id])\n render json: pokemon\n else\n render json: {message: \"Pokemon cannot be created\"}, status: 400\n end\n end", "def create\n @api_v1_answer_upvote = Api::V1::AnswerUpvote.new(api_v1_answer_upvote_params)\n\n respond_to do |format|\n if @api_v1_answer_upvote.save\n format.html { redirect_to @api_v1_answer_upvote, notice: 'Answer upvote was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_answer_upvote }\n else\n format.html { render :new }\n format.json { render json: @api_v1_answer_upvote.errors, status: :unprocessable_entity }\n end\n end\n end", "def POST; 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 data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end", "def create\n @virus = Virus.new(virus_params)\n\n respond_to do |format|\n if @virus.save\n format.html { redirect_to @virus, notice: 'Virus was successfully created.' }\n format.json { render action: 'show', status: :created, location: @virus }\n else\n format.html { render action: 'new' }\n format.json { render json: @virus.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vodka = Vodka.new(params[:vodka])\n\n respond_to do |format|\n if @vodka.save\n format.html { redirect_to @vodka, notice: 'Vodka was successfully created.' }\n format.json { render json: @vodka, status: :created, location: @vodka }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vodka.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @vineyard = Vineyard.new(vineyard_params)\n\n @vineyard = Vineyard.new(vineyard_params)\n @vineyard.user = current_user\n\n if @vineyard.save\n render json: @vineyard, status: :created, location: @vineyard\n else\n render json: @vineyard.errors, status: :unprocessable_entity\n end\n end", "def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end", "def create\n @tv = Tv.new(tv_params)\n\n respond_to do |format|\n if @tv.save\n format.html { redirect_to @tv, notice: 'Tv was successfully created.' }\n format.json { render :show, status: :created, location: @tv }\n else\n format.html { render :new }\n format.json { render json: @tv.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\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 set_vik\n @vik = Vik.find(params[:id])\n end", "def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end", "def create\n #birdspotter id must be present\n if params[:birdspotter].blank?\n render json: {\n status: 400,\n message: \"Skaparens id saknas.\" \n }\n end\n \n #at least one bird must be present\n if params[:bird].blank?\n render json: {\n status: 400,\n message: \"En birdspot måste innehålla minst en fågel.\" \n }\n end\n \n #latitude and longitude must be present\n if params[:latitude].blank? || params[:longitude].blank?\n render json: {\n status: 400,\n message: \"En birdspot måste innehålla latitud och longitude.\" \n }\n end\n \n #check if birdspotter exists\n if Api::V1::Birdspotter.exists?(params[:birdspotter])\n \n #if exists find birdspotter\n @birdspotter = Api::V1::Birdspotter.find_by_id(params[:birdspotter])\n \n #create a new spot and append to birdspotter\n @spot = Api::V1::Spot.create(:latitude => params[:latitude], :longitude => params[:longitude])\n if @spot.save\n @birdspotter.spots << @spot\n \n #iterate through all birds and append each bird to newly created spot\n params[:bird].tr(' ','').split(',').each do |bird_id|\n if Api::V1::Bird.exists?(bird_id)\n @bird = Api::V1::Bird.find_by_id(bird_id)\n @spot.birds << @bird\n else\n render json: {\n status: 404,\n message: \"En eller flera fåglar med det id:t finns inte.\"\n }\n end\n end\n else\n render json: {\n status: 400,\n message: @spot.errors.full_messages \n }\n end\n else\n render json: {\n status: 404,\n message: \"Skapare med det id:t finns inte.\" \n }\n \n end\n \n render json: { \n status: 201,\n message: \"Din birdspot är registerad. Tack!\", \n spots: Api::V1::SpotSerializer.new(@spot) \n }\n end", "def create\n @vestment = Vestment.new(vestment_params)\n\n respond_to do |format|\n if @vestment.save\n format.html { redirect_to @vestment, notice: \"Vestment was successfully created.\" }\n format.json { render :show, status: :created, location: @vestment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @vestment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vik.update(vik_params)\n format.html { redirect_to @vik, notice: 'Vik was successfully updated.' }\n format.json { render :show, status: :ok, location: @vik }\n else\n format.html { render :edit }\n format.json { render json: @vik.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vampire = Vampire.new(params[:vampire])\n\n respond_to do |format|\n if @vampire.save\n format.html { redirect_to @vampire, notice: 'Vampire was successfully created.' }\n format.json { render json: @vampire, status: :created, location: @vampire }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vampire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def CreateView params = {}\n \n APICall(path: 'views.json',method: 'POST',payload: params.to_json)\n \n end", "def create_parks_from_api\n url = \"https://developer.nps.gov/api/v1/parks?limit=500&api_key=GhGhpL8DrRdsEAwfu0Mn4gXuhgkdnhVnrEnNfmRx\"\n resp = RestClient.get(url)\n json_hash = JSON.parse(resp)\n park_codes = []\n\n json_hash.each do |data_key, value|\n if data_key[\"data\"]\n value.each do |hash_keys|\n Park.create(park_name: hash_keys[\"fullName\"], park_code: hash_keys[\"parkCode\"])\n \n end\n end\n end\n\nend", "def create\n @tags_of_novel = TagsOfNovel.new(params[:tags_of_novel])\n\n respond_to do |format|\n if @tags_of_novel.save\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully created.' }\n format.json { render json: @tags_of_novel, status: :created, location: @tags_of_novel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @avert = Avert.new(params[:avert])\n\n respond_to do |format|\n if @avert.save\n format.html { redirect_to @avert, notice: 'Avert was successfully created.' }\n format.json { render json: @avert, status: :created, location: @avert }\n else\n format.html { render action: \"new\" }\n format.json { render json: @avert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vitamina = Vitamina.new(vitamina_params)\n\n respond_to do |format|\n if @vitamina.save\n format.html { redirect_to @vitamina, notice: 'Vitamina was successfully created.' }\n format.json { render :show, status: :created, location: @vitamina }\n else\n format.html { render :new }\n format.json { render json: @vitamina.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n p = prediction_params\n\n p[:tags] = [p[:tags]]\n puts \"BLAH\"\n puts p\n @prediction = current_user.predictions.create(p)\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to action: 'index' }\n format.json { render action: 'show', status: :created, location: @prediction }\n else\n format.html { render action: 'new' }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def create\n @rock = Rock.new(rock_params)\n\n if @rock.save\n render json: @rock, status: :created\n else\n render json: @rock.errors, status: :unprocessable_entity\n end\n end", "def create\r\n\t\t\t\tsurvivor = Survivor.new(survivor_create_params)\r\n\t\t\t\tsurvivor.abducted = false\r\n\t\t\t\tsurvivor.abduction_reports = 0\r\n\t\t\t\tif survivor.save\r\n\t\t\t\t\trender json: {status: 'SUCCESS', message:'Survivor Registrado', data:survivor},status: :ok\r\n\t\t\t\telse\r\n\t\t\t\t\trender json: {status: 'ERROR', message:'Survivor não registrado com sucesso', data:survivor.erros},status: :unprocessable_entity\r\n\t\t\t\tend\r\n\t\t\tend", "def create\n @vongdau = Vongdau.new(vongdau_params)\n\n respond_to do |format|\n if @vongdau.save\n format.html { redirect_to @vongdau, notice: 'Vongdau was successfully created.' }\n format.json { render :show, status: :created, location: @vongdau }\n else\n format.html { render :new }\n format.json { render json: @vongdau.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dang_vien = DangVien.new(dang_vien_params)\n\n respond_to do |format|\n if @dang_vien.save\n format.html { redirect_to @dang_vien, notice: 'Dang vien was successfully created.' }\n format.json { render :show, status: :created, location: @dang_vien }\n else\n format.html { render :new }\n format.json { render json: @dang_vien.errors, status: :unprocessable_entity }\n end\n end\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 @souvenir = Souvenir.new(souvenir_params)\n\n respond_to do |format|\n if @souvenir.save\n format.html { redirect_to @souvenir, notice: 'Souvenir was successfully created.' }\n format.json { render :show, status: :created, location: @souvenir }\n else\n format.html { render :new }\n format.json { render json: @souvenir.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @question = Question.new(question_params)\n @question.zavrseno = \"N\"\n @question.user = @current_user\n @question.uposlenik = User.find(params[:uposlenik_id])\n respond_to do |format|\n if @question.save\n format.json { render json: @question, status: :created, location: api_question_url(@question) }\n else\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n Rentlinx.client.post(self)\n end", "def create\n @ink_varnish = InkVarnish.new(params[:ink_varnish])\n\n respond_to do |format|\n if @ink_varnish.save\n format.html { redirect_to @ink_varnish, notice: 'Ink Varnish was successfully created.' }\n format.json { render json: @ink_varnish, status: :created, location: @ink_varnish }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ink_varnish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @park = Park.new(params[:park])\n\n respond_to do |format|\n if @park.save\n format.html { redirect_to @park, notice: 'Park was successfully created.' }\n format.json { render json: @park, status: :created, location: @park }\n else\n format.html { render action: \"new\" }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Crear nuevo voto\n @voto = Voto.new(params[:voto])\n\n # Asociarlo con el usuario\n @voto.usuario_id = current_usuario.id\n\n # Asociarlo con la Pregunta o Respuesta\n votable_type = params[:voto][:votable_type]\n votable_id = params[:voto][:votable_id]\n if votable_type=='Pregunta'\n @voto.votable = Pregunta.find(votable_id)\n else\n @voto.votable = Respuesta.find(votable_id)\n end\n\n respond_to do |format|\n if @voto.save\n resp = {\n :votos_total => @voto.votable.votos_total,\n :votos_menos => @voto.votable.votos_menos,\n :votos_mas => @voto.votable.votos_mas\n }\n format.json { render json: resp, status: :created, location: @voto }\n else\n format.json { render json: @voto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_appdefn(to_hash)\n end", "def create\n @kv = Kv.new(params[:kv])\n\n respond_to do |format|\n if @kv.save\n format.html { redirect_to @kv, notice: 'Kv was successfully created.' }\n format.json { render json: @kv, status: :created, location: @kv }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kv.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vnic = Vnic.new(params[:vnic])\n\n respond_to do |format|\n if @vnic.save\n format.html { redirect_to @vnic, notice: 'Vnic was successfully created.' }\n format.json { render json: @vnic, status: :created, location: @vnic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vnic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rigging = Rigging.new(rigging_params)\n\n respond_to do |format|\n if @rigging.save\n format.html { redirect_to @rigging, notice: 'Rigging was successfully created.' }\n format.json { render :show, status: :created, location: @rigging }\n else\n format.html { render :new }\n format.json { render json: @rigging.errors, status: :unprocessable_entity }\n end\n end\n end", "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\n @test = Test.create!(test_params)\n\n render json: @test\n end", "def index\n @api_v1_post_votes = PostVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_v1_post_votes }\n end\n end", "def create\n @vice = Vice.new(vice_params)\n\n respond_to do |format|\n if @vice.save\n format.html { redirect_to @vice, notice: 'Vice was successfully created.' }\n format.json { render :show, status: :created, location: @vice }\n else\n format.html { render :new }\n format.json { render json: @vice.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @vet = Vet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vet }\n end\n end", "def create\n @iva = Iva.new(iva_params)\n\n if @iva.save\n render json: @iva, status: :created, location: @iva\n else\n render json: @iva.errors, status: :unprocessable_entity\n end\n end", "def create\n @idea = Idea.find(params[:idea_id])\n @vote = @idea.votes.new(params[:vote])\n @vote.username = current_user.to_s\n respond_to do |format|\n if @vote.save \n format.json { render json: @vote, status: :created, location: @vote }\n else \n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vanguard = Vanguard.new(vanguard_params)\n\n respond_to do |format|\n if @vanguard.save\n format.html { redirect_to @vanguard, notice: 'Vanguard was successfully created.' }\n format.json { render :show, status: :created, location: @vanguard }\n else\n format.html { render :new }\n format.json { render json: @vanguard.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @uzser = Uzser.new(uzser_params)\n\n respond_to do |format|\n if @uzser.save\n format.html { redirect_to @uzser, notice: 'Uzser was successfully created.' }\n format.json { render :show, status: :created, location: @uzser }\n else\n format.html { render :new }\n format.json { render json: @uzser.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quiver = Quiver.new(quiver_params)\n\n respond_to do |format|\n if @quiver.save\n format.html { redirect_to @quiver, notice: 'Quiver was successfully created.' }\n format.json { render :show, status: :created, location: @quiver }\n else\n format.html { render :new }\n format.json { render json: @quiver.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vote = @votable.votes.new(vote_params)\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to build_path_vote(@vote), notice: 'Vote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vote }\n else\n format.html { render action: 'new' }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end", "def create\n render json: Post.create(params[\"post\"])\n end", "def create\n @verse = Verse.new(params[:verse])\n\n respond_to do |format|\n if @verse.save\n format.html { redirect_to @verse, notice: 'Verse was successfully created.' }\n format.json { render json: @verse, status: :created, location: @verse }\n else\n format.html { render action: \"new\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @verse = Verse.new(params[:verse])\n\n respond_to do |format|\n if @verse.save\n format.html { redirect_to @verse, notice: 'Verse was successfully created.' }\n format.json { render json: @verse, status: :created, location: @verse }\n else\n format.html { render action: \"new\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vano = Vano.new(params[:vano])\n\n respond_to do |format|\n if @vano.save\n format.html { redirect_to @vano, notice: 'Vano was successfully created.' }\n format.json { render json: @vano, status: :created, location: @vano }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vano.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n tag = Tag.new(params.permit(:name))\n \n if tag.save\n render json: tag, status: :created\n else\n render json: tag.errors, status: :unprocessable_entity\n end\n end", "def create\n @postvote = Postvote.new(params[:postvote])\n\n respond_to do |format|\n if @postvote.save\n format.html { redirect_to @postvote, notice: 'Postvote was successfully created.' }\n format.json { render json: @postvote, status: :created, location: @postvote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @postvote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vrsta_inventara = VrstaInventara.new(vrsta_inventara_params)\n\n respond_to do |format|\n if @vrsta_inventara.save\n format.html { redirect_to vrsta_inventaras_url, notice: 'Vrsta inventara je uspješno stvorena.' }\n format.json { render :show, status: :created, location: @vrsta_inventara }\n else\n format.html { render :new }\n format.json { render json: @vrsta_inventara.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @moniker = Moniker.new(moniker_params)\n\n respond_to do |format|\n if @moniker.save\n format.html { redirect_to @moniker, notice: \"Moniker was successfully created.\" }\n format.json { render :show, status: :created, location: @moniker }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @moniker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "def create\n @pokemon = Pokemon.new(pokemon_info)\n \n #check if the pokemon was saved\n #everything went fine\n if @pokemon.save\n render json:{\n status: \"success\",\n message: \"Pokemon was saved, and sent to the PC Storage\",\n data: @pokemon \n }\n else\n render json:{\n status: \"error\",\n message: \"Pokemon ran away...\",\n data: @pokemon.errors\n } \n\n \n end \n end", "def create\n @park = Park.new(park_params)\n\n respond_to do |format|\n if @park.save\n format.html { redirect_to @park, notice: \"Park was successfully created.\" }\n format.json { render :show, status: :created, location: @park }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @song = Song.new(song_params)\n # Get user\n @user = current_user\n # Get song/s\n song_lyricsimage = song_params[:image]\n original_filename = \"something.png\"\n # Create temporary file\n @file = PullTempfile.pull_tempfile(url: song_lyricsimage, original_filename: original_filename)\n # Create empty array for lyrics text\n @lyrics_array = [];\n # Hit the cloud vision API with wrapper\n @song_tags = GoogleCloudVision::Classifier.new(ENV[\"API_KEY\"],\n [{ image: @file, detection: 'TEXT_DETECTION', max_results: 10 }]).response[\"responses\"][0][\"textAnnotations\"].each do |tag|\n @lyrics_array.push(tag[\"lyrics\"])\n end\n\n p @lyrics_array\n\n # if @song.save\n # @lyrics_array.each do |value|\n # @tag = Tag.new({song_id: @song.id, lyrics: value})\n # end\n\n # end\n\n respond_to do |format|\n if @song.save\n @user.songs.push(@song)\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render :show, status: :created, location: @song }\n else\n format.html { render :new }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n # redirect_to '/'\n end\n end", "def create\n @veterinario = Veterinario.new(veterinario_params)\n\n respond_to do |format|\n if @veterinario.save\n format.html { redirect_to @veterinario, notice: \"Veterinario was successfully created.\" }\n format.json { render :show, status: :created, location: @veterinario }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @veterinario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @singer = Singer.new(singer_params)\n\n respond_to do |format|\n if @singer.save\n format.html { redirect_to @singer, notice: \"Singer was successfully created.\" }\n format.json { render :show, status: :created, location: @singer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @singer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create body = {}\n @connection.request(method: :post, path: \"/volumes/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def create\n @visiter = Visiter.new(visiter_params)\n\n respond_to do |format|\n if @visiter.save\n format.html { redirect_to @visiter, notice: 'Visiter was successfully created.' }\n format.json { render :show, status: :created, location: @visiter }\n else\n format.html { render :new }\n format.json { render json: @visiter.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @park = Park.new(park_params)\n\n respond_to do |format|\n if @park.save\n format.html { redirect_to @park, notice: 'Park was successfully created.' }\n format.json { render :show, status: :created, location: @park }\n else\n format.html { render :new }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @veterinario = Veterinario.new(veterinario_params)\n\n respond_to do |format|\n if @veterinario.save\n format.html { redirect_to @veterinario, notice: 'Veterinario was successfully created.' }\n format.json { render :show, status: :created, location: @veterinario }\n else\n format.html { render :new }\n format.json { render json: @veterinario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\treview = Review.create(:user_id=>params[:review][:user_id], :note_id=>params[:review][:note_id], :status=>params[:review][:status])\n\t\treview.save!\n\n render json: []\n\tend", "def create\n @park = Park.new(park_params)\n\n respond_to do |format|\n if @park.save\n format.html { redirect_to @park, notice: 'Park was successfully created.' }\n format.json { render :show, status: :created, location: @park }\n else\n format.html { render :new }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\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 create\n @votable_item = VotableItem.new(votable_item_params)\n\n respond_to do |format|\n if @votable_item.save\n format.html { redirect_to @votable_item, notice: 'Votable item was successfully created.' }\n format.json { render :show, status: :created, location: @votable_item }\n else\n format.html { render :new }\n format.json { render json: @votable_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def create\n @visto = Visto.new(visto_params)\n\n\n respond_to do |format|\n if @visto.save\n format.html { redirect_to @visto, notice: 'Visto was successfully created.' }\n format.json { render :show, status: :created, location: @visto }\n else\n format.html { render :new }\n format.json { render json: @visto.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6172804", "0.58882076", "0.5830775", "0.57994336", "0.56898636", "0.5686878", "0.56786937", "0.56700015", "0.56625277", "0.55536073", "0.55027765", "0.54527456", "0.54484797", "0.54446036", "0.54393137", "0.5434924", "0.5427928", "0.5426976", "0.5415377", "0.53994936", "0.5393309", "0.5383554", "0.53784513", "0.53729934", "0.5361669", "0.53401434", "0.5329783", "0.5326443", "0.5311859", "0.53094774", "0.5309265", "0.5293615", "0.5275257", "0.5275175", "0.5274577", "0.5271932", "0.526622", "0.52654797", "0.5252868", "0.5252535", "0.5247494", "0.5247435", "0.52427226", "0.5235625", "0.5230384", "0.52257395", "0.521869", "0.52178156", "0.5210667", "0.52056605", "0.52019036", "0.51894397", "0.5180251", "0.5178618", "0.5178376", "0.5177791", "0.517523", "0.5172628", "0.517158", "0.517154", "0.5170561", "0.51619947", "0.5160601", "0.5156238", "0.5155359", "0.5155008", "0.51492554", "0.5141007", "0.5138921", "0.5137203", "0.5132897", "0.5126685", "0.51230997", "0.51203775", "0.5114661", "0.5113599", "0.5105464", "0.5101109", "0.5101109", "0.5095258", "0.50949526", "0.509489", "0.5093146", "0.5093027", "0.50895005", "0.5089473", "0.5084366", "0.5083173", "0.5082965", "0.508238", "0.5080169", "0.5079923", "0.507904", "0.50767297", "0.5076533", "0.5076396", "0.5072502", "0.50718355", "0.5061473", "0.5057139" ]
0.70241755
0
PATCH/PUT /viks/1 PATCH/PUT /viks/1.json
def update respond_to do |format| if @vik.update(vik_params) format.html { redirect_to @vik, notice: 'Vik was successfully updated.' } format.json { render :show, status: :ok, location: @vik } else format.html { render :edit } format.json { render json: @vik.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def patch!\n request! :patch\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def put!\n request! :put\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n put :update\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def patch(path, **args); end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "def update\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n if @koti.update_attributes(params[:koti])\n format.html { redirect_to @koti, notice: 'Koti was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @koti.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(*args)\n put(*args)\n end", "def update(*args)\n put(*args)\n end", "def update(path)\n output { patch(path, params) }\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def put(*args)\n request :put, *args\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "def update_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n\n respond_to do |format|\n if @instrument_version.update_attributes(params[:instrument_version])\n flash[:notice] = 'InstrumentVersion was successfully updated.'\n format.html { redirect_to(@instrument_version) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instrument_version.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n 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 update attrs\n put '', :body => {self.class.api_name => self.class.opts_to_query_opts(attrs)}\n end", "def update\n @api_v1_post_vote = PostVote.find(params[:id])\n\n respond_to do |format|\n if @api_v1_post_vote.update_attributes(params[:api_v1_post_vote])\n format.html { redirect_to @api_v1_post_vote, notice: 'Post vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v1_post_vote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def update\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n if @vet.update_attributes(params[:vet])\n format.html { redirect_to @vet, notice: 'Vet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format|\n if @giang_vien.update_attributes(params[:giang_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def patch\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def patch(path, opts = {})\n request(:patch, path, opts).body\n end", "def update(request)\n end", "def update(request)\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def update_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend", "def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update!(sobject, attrs)\n id = attrs.has_key?(:Id) ? attrs.delete(:Id) : attrs.delete('Id')\n raise 'Id field missing.' unless id\n api_patch \"sobjects/#{sobject}/#{id}\", attrs\n true\n end", "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def update\n @kv = Kv.find(params[:id])\n\n respond_to do |format|\n if @kv.update_attributes(params[:kv])\n format.html { redirect_to @kv, notice: 'Kv was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kv.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pet_true.update(pet_true_params)\n format.html { redirect_to @pet_true, notice: 'Pet true was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pet_true.errors, status: :unprocessable_entity }\n end\n end\n end", "def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end", "def update\n tag = Tag.find_by_id(params[:id])\n if tag.update(params.permit(:name))\n render json: tag, status: :ok\n else\n respond_with tag.errors, status: :unprocessable_entity\n end\n end" ]
[ "0.6780158", "0.66067696", "0.6600787", "0.6560724", "0.6530162", "0.65068805", "0.6479475", "0.6433835", "0.64264435", "0.6409649", "0.6301586", "0.6284471", "0.62842095", "0.62006736", "0.6155299", "0.6155299", "0.61254007", "0.6120311", "0.6092638", "0.60796314", "0.60581344", "0.60581344", "0.6049874", "0.6030736", "0.5999285", "0.5999285", "0.59819436", "0.5972688", "0.5972688", "0.59695536", "0.5967037", "0.5958553", "0.59240925", "0.5913207", "0.59085697", "0.5902212", "0.58953315", "0.5891199", "0.5888997", "0.58808756", "0.5874749", "0.5869802", "0.5868812", "0.5866633", "0.58516246", "0.58499837", "0.5837693", "0.5828754", "0.5824938", "0.5824938", "0.58111423", "0.5809604", "0.579315", "0.5787166", "0.57866746", "0.5782982", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.57797086", "0.5772633", "0.5772537", "0.5771262", "0.5771262", "0.57704645", "0.5769711", "0.57659876", "0.5762877", "0.5761409", "0.5755713" ]
0.6187387
14
DELETE /viks/1 DELETE /viks/1.json
def destroy @vik.destroy respond_to do |format| format.html { redirect_to viks_url, notice: 'Vik was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete\n request(:delete)\n end", "def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\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 delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend", "def delete\n \n end", "def destroy\n @vocalium = Vocalium.find(params[:id])\n @vocalium.destroy\n\n respond_to do |format|\n format.html { redirect_to vocalia_url }\n format.json { head :no_content }\n end\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n @instrument_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(instrument_versions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n\n end", "def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @c_rodinny_stav.destroy\n respond_to do |format|\n format.html { redirect_to c_rodinny_stavs_url }\n format.json { head :no_content }\n end\n end", "def delete(vmname)\n uri = @uri + \"/#{vmname}?api-version=#{api_version}\"\n uri\n end", "def delete!\n request! :delete\n end", "def destroy; delete end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @virus = Virus.find(params[:id])\n @virus.destroy\n\n respond_to do |format|\n format.html { redirect_to viri_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 delete\n render json: Like.delete(params[\"id\"])\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete\n \n end", "def delete(path)\n request 'DELETE', path\n end", "def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def destroy\n @jedi = Jedi.find(params[:id])\n @jedi.destroy\n\n respond_to do |format|\n format.html { redirect_to jedis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_post_vote = PostVote.find(params[:id])\n @api_v1_post_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_post_votes_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def destroy\n @vil.destroy\n respond_to do |format|\n format.html { redirect_to vils_url, notice: 'Vil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @vet = Vet.find(params[:id])\n @vet.destroy\n\n respond_to do |format|\n format.html { redirect_to vets_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 @vint = Vint.find(params[:id])\n @vint.destroy\n\n respond_to do |format|\n format.html { redirect_to vints_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 @kv = Kv.find(params[:id])\n @kv.destroy\n\n respond_to do |format|\n format.html { redirect_to kvs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @koti = Koti.find(params[:id])\n @koti.destroy\n\n respond_to do |format|\n format.html { redirect_to kotis_url }\n format.json { head :no_content }\n end\n end", "def delete(*rest) end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def destroy\n @vibe.destroy\n respond_to do |format|\n format.html { redirect_to vibes_url }\n format.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @status_ativ = StatusAtiv.find(params[:id])\n @status_ativ.destroy\n\n respond_to do |format|\n format.html { redirect_to status_ativs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vodka = Vodka.find(params[:id])\n @vodka.destroy\n\n respond_to do |format|\n format.html { redirect_to vodkas_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_rede.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_redes_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def destroy\n render status: 200, json: @request_item.destroy\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end", "def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @svote.destroy\n respond_to do |format|\n format.html { redirect_to svotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vampire = Vampire.find(params[:id])\n @vampire.destroy\n\n respond_to do |format|\n format.html { redirect_to vampires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rayon = Rayon.find(params[:id])\n @rayon.destroy\n\n respond_to do |format|\n format.html { redirect_to rayons_url }\n format.json { head :no_content }\n end\n end", "def delete\n delete_from_server single_url\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def destroy\n @vitabus.destroy\n respond_to do |format|\n format.html { redirect_to vitabus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fast.destroy\n respond_to do |format|\n format.html { redirect_to fasts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @virus.destroy\n respond_to do |format|\n format.html { redirect_to viri_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kv.destroy\n respond_to do |format|\n format.html { redirect_to kvs_url, notice: 'Kv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end" ]
[ "0.7256057", "0.6970375", "0.688252", "0.6804187", "0.6804187", "0.6804187", "0.6804187", "0.6798722", "0.6796759", "0.67771894", "0.67722774", "0.6752068", "0.6714451", "0.67109984", "0.66842383", "0.6680114", "0.6680101", "0.6666853", "0.6665063", "0.66644883", "0.6658954", "0.6647303", "0.6563121", "0.65551233", "0.6545417", "0.6538504", "0.65243655", "0.6520104", "0.6520104", "0.65156454", "0.65155536", "0.65067065", "0.6504538", "0.6499506", "0.64991", "0.64971215", "0.64965785", "0.6496564", "0.64956146", "0.6495179", "0.6493731", "0.64745504", "0.64724493", "0.6470305", "0.6465371", "0.64559567", "0.6455492", "0.64536786", "0.6452576", "0.6446182", "0.64427257", "0.6441159", "0.6441159", "0.6440442", "0.64399457", "0.64399457", "0.64399457", "0.64399457", "0.64399457", "0.64399457", "0.64399457", "0.64382243", "0.64321625", "0.6428322", "0.6427778", "0.6417003", "0.6413106", "0.64123565", "0.6411617", "0.64113957", "0.64111334", "0.64101535", "0.64100236", "0.6400147", "0.6396942", "0.639561", "0.6395016", "0.6394739", "0.63946795", "0.6390844", "0.63849264", "0.6380083", "0.6373674", "0.6372578", "0.63714343", "0.6369164", "0.63686645", "0.6368227", "0.6362325", "0.6361864", "0.63610363", "0.63600266", "0.6353946", "0.63523054", "0.6334823", "0.63309425", "0.6325512", "0.63246685", "0.63241565", "0.6324062" ]
0.70095015
1
Use callbacks to share common setup or constraints between actions.
def set_vik @vik = Vik.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 vik_params params.require(:vik).permit(:name, :location) 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
This is the worker bee decoding the html into our "standard" document. Future implementations could simply override this implementationspecific code to help this grow more widely.
def parse_response(response) Lita.logger.debug "parse_response started." gimme_what_you_got = {} valid_products = {} products = {} response.split(/\n/).each do |line| if matches = line.match(/window.siteData = (.*)/) site_hash = JSON.parse matches[1].sub /;$/, '' valid_products = site_hash['page']['properties']['contentAreas']['userContent']['content']['cells'][0]['content']['properties']['products'] end if matches = line.match(/window.__BOOTSTRAP_STATE__ = (.*)/) whatevenintheshitsquarespace = JSON.parse matches[1].sub /;$/, '' products = whatevenintheshitsquarespace['commerceLinks']['products'] end end valid_products products live_products = [] valid_products.each do |p| live_products.push products[p] unless products[p].nil? end live_products.each_with_index do |beer, idx| tap = idx + 1 tap_type = '' beer_name = beer['name'].sub(/ 32oz Crowler/, '') full_text_search = "#{tap} #{beer_name}" gimme_what_you_got[tap] = { type: tap_type, name: beer_name.to_s, search: full_text_search } end gimme_what_you_got end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_html\n @document.encoding = 'UTF-8'\n @best_candidate = nil\n end", "def html_parser; end", "def parse_page\n @doc = Nokogiri::HTML(@html)\n end", "def decode_html html\n coder = HTMLEntities.new\n coder.decode html\n end", "def normalize!\n data = read\n html = Nokogiri::XML.parse(data)\n html.encoding = 'utf-8'\n\n # Process the @DOM\n standardize_dom(html)\n remove_scripts(html)\n change_hrefs(html)\n\n write(html.to_s)\n end", "def convert_to_document() \n Nokogiri::HTML.parse(convert())\n end", "def bend_html\n\t\t@bendable_html = Nokogiri::HTML(@unbendable_html.body)\n\tend", "def to_html\n self.load_page!\n self.parsed_page.to_xhtml indent: 3, indent_text: \" \"\n end", "def html_reducer(html_doc)\n html_doc_chars = html_doc.strip.split(\"\")\n\n self_closing_tags = [\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\",\"command\",\"keygen\",\"menuitem\"]\n reopenable_tags = [\"b\",\"i\",\"a\",\"font\",\"em\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"pre\",\"strong\",\"u\"]\n nestable_tags = [\"div\"]\n\n element_stack = [] # stack of open elements\n reduction = [] # results array\n buffer = \"\"\n\n while html_doc_chars.length > 0\n buffer << html_doc_chars.shift # get another char\n\n closing_script_regex = /<\\/script\\s*>\\z/i\n closing_script_match = buffer.match(closing_script_regex)\n\n closing_style_regex = /<\\/style\\s*>\\z/i\n closing_style_match = buffer.match(closing_style_regex)\n\n self_closing_tag_regex = /<[a-z][^>]*\\/\\s*>\\z/i\n self_closing_tag_match = buffer.match(self_closing_tag_regex)\n\n tag_regex = /<[a-z][^>]*>\\z/i\n tag_match = buffer.match(tag_regex)\n\n closing_tag_regex = /<\\/[a-z][^>]*>\\z/i\n closing_tag_match = buffer.match(closing_tag_regex)\n\n doctype_regex = /<!doctype\\s*[^>]*>\\z/i\n doctype_match = buffer.match(doctype_regex)\n\n comment_regex = /<!--.*?-->\\z/\n comment_match = buffer.match(comment_regex)\n\n # closing script tag\n if closing_script_match\n text = buffer.split(closing_script_regex).first.to_s.strip\n if text != \"\"\n element_stack.last.contents << text\n end\n buffer = \"\"\n element_stack.pop\n\n # closing style tag\n elsif closing_style_match\n text = buffer.split(closing_style_regex).first.to_s.strip\n if text != \"\"\n element_stack.last.contents << text\n end\n buffer = \"\"\n element_stack.pop\n\n # comment\n elsif comment_match\n contents = (element_stack.last&.contents) || reduction\n text = buffer.split(comment_regex).first.to_s.strip\n if text != \"\"\n contents << text\n end\n contents << comment_match.to_s\n\n buffer = \"\"\n\n # inside a script\n elsif tag_in_stack(element_stack,\"script\")\n # do nothing\n\n elsif tag_in_stack(element_stack,\"style\")\n # do nothing\n\n elsif buffer.include?(\"<!--\")\n # do nothing\n\n # self closing tag containing /> (doesn't get pushed to the stack)\n elsif self_closing_tag_match\n text = buffer.split(self_closing_tag_regex).first.to_s.strip\n contents = (element_stack.last&.contents) || reduction\n if text != \"\"\n contents << text\n end\n contents << HTML_element.from_string(self_closing_tag_match.to_s)\n buffer = \"\"\n \n # tag\n elsif tag_match\n text = buffer.split(tag_regex).first.to_s.strip\n contents = (element_stack.last&.contents) || reduction\n if text != \"\"\n contents << text\n end\n elem = HTML_element.from_string(tag_match.to_s)\n\n if !self_closing_tags.include?(elem.tag) # push to the stack\n # check whether nesting is possible\n if tag_in_stack(element_stack,elem.tag) && !nestable_tags.include?(elem.tag)\n tmp_stack = []\n while tag_in_stack(element_stack,elem.tag)\n tmp = element_stack.pop\n contents = (element_stack.last&.contents) || reduction\n if reopenable_tags.include?(tmp.tag) && (tmp.tag != elem.tag)\n tmp_stack << tmp\n end\n end\n \n contents << elem\n element_stack.push(elem)\n contents = (element_stack.last&.contents) || reduction\n while tmp_stack.length > 0\n new_elem = HTML_element.from_html_element(tmp_stack.pop)\n contents << new_elem\n element_stack.push(new_elem)\n contents = (element_stack.last&.contents) || reduction\n end\n else\n contents << elem\n element_stack.push(elem)\n end\n else\n contents << elem\n end\n\n buffer = \"\"\n\n # closing tag\n elsif closing_tag_match\n text = buffer.split(closing_tag_regex).first.to_s.strip\n contents = (element_stack.last&.contents) || reduction\n if text != \"\"\n contents << text\n end\n tag = HTML_element.tag_from_string(closing_tag_match.to_s)\n if tag_in_stack(element_stack, tag)\n tmp_stack = []\n until element_stack.last.tag == tag\n tmp = element_stack.pop\n if reopenable_tags.include?(tmp.tag) && (tmp.tag != tag)\n tmp_stack << tmp\n end\n end\n element_stack.pop\n contents = (element_stack.last&.contents) || reduction\n \n while tmp_stack.length > 0\n new_elem = HTML_element.from_html_element(tmp_stack.pop)\n contents << new_elem\n element_stack.push(new_elem)\n contents = (element_stack.last&.contents) || reduction\n end\n end\n buffer = \"\"\n\n # doctype (stack must be empty)\n elsif doctype_match\n text = buffer.split(doctype_regex).first.to_s.strip\n if text != \"\"\n reduction << text\n end\n reduction << doctype_match.to_s\n buffer = \"\"\n end\n end\n\n contents = (element_stack.last&.contents) || reduction\n contents << buffer\n\n reduction\nend", "def load_html(input) # :nodoc:\n thing = nil\n\n # TODO: duplicate options\n if @options[:with_html_string] or @options[:inline] or input.respond_to?(:read)\n thing = input\n elsif @is_local_file\n @base_dir = File.dirname(input)\n thing = File.open(input, 'r')\n else\n thing = open(input)\n end\n\n if thing.respond_to?(:read)\n thing = thing.read\n end\n\n return nil unless thing\n doc = nil\n\n # Handle HTML entities\n if @options[:replace_html_entities] == true and thing.is_a?(String)\n HTML_ENTITIES.map do |entity, replacement|\n thing.gsub! entity, replacement\n end\n end\n # Default encoding is ASCII-8BIT (binary) per http://groups.google.com/group/nokogiri-talk/msg/0b81ef0dc180dc74\n # However, we really don't want to hardcode this. ASCII-8BIG should be the default, but not the only option.\n if thing.is_a?(String) and RUBY_VERSION =~ /1.9/\n thing = thing.force_encoding(@options[:input_encoding]).encode!\n doc = ::Nokogiri::HTML(thing, nil, @options[:input_encoding]) {|c| c.recover }\n else\n default_encoding = RUBY_PLATFORM == 'java' ? nil : 'BINARY'\n doc = ::Nokogiri::HTML(thing, nil, @options[:input_encoding] || default_encoding) {|c| c.recover }\n end\n\n # Fix for removing any CDATA tags from both style and script tags inserted per\n # https://github.com/sparklemotion/nokogiri/issues/311 and\n # https://github.com/premailer/premailer/issues/199\n %w(style script).each do |tag|\n doc.search(tag).children.each do |child|\n child.swap(child.text()) if child.cdata?\n end\n end\n\n doc\n end", "def html\n @html ||= process_html!\n end", "def initialize\n reset\n\n @parse_method = :HTML\n @options = ::Nokogiri::XML::ParseOptions::DEFAULT_HTML\n end", "def fix!\n fragment = Nokogiri::HTML.fragment(self.html)\n fragment.to_html\n end", "def html_decode\n require 'htmlentities'\n \n coder = HTMLEntities.new\n \n ret = coder.decode(self)\n \n return ret\n end", "def parse_html(html_body)\t\n #puts \"Parsing the html content: #{html_body}. Return DOM \" if @verbose\n\t\tbegin\n doc = Nokogiri::HTML(html_body)\n\t\t\t#puts \"Successfully crawling the url: #{url_object.base_uri.to_s}\" if @verbose\n\t\t\t#puts \"doc: #{doc}\" if @verbose\n\t\t\treturn doc\n rescue => ee\n puts \"Exception on method #{__method__}: #{ee}\" if @verbose\n return nil\n end\n\tend", "def doc\n # get_html beforehand for good output messages\n html = get_html\n print \"Parsing doc...\"\n doc = Nokogiri::HTML(html)\n puts \"done.\"\n puts\n doc\n end", "def process_html(document)\n\t\t\t\n\t\t\t# Add link and raw HTML to a hash as key/value\n\t\t\t# for later storage in database\n\t\t\tunless @raw_html.has_value?(document)\n\t\t \t\tprint \".\"\n\t\t \t\t@raw_html[@document.base_uri.to_s] = document\n\t\t\tend\n\t\t\t\t\n\t\tend", "def decode_html()\n return self.gsub('&lt;', '<').gsub('&gt;', '>').gsub('&amp;', '&')\n end", "def parse(html, options = {})\n # clean html\n clean_html = cleaner.clean(html, options)\n\n # fix html\n pdf_model = fixer.fix(clean_html, options)\n end", "def html_body\n @html_body ||= reader_doc.content.strip\n end", "def standard_html( state, encoding = nil, &body_filller )\n html(:language => state.fetch(\"request.language\"), :direction => state.fetch(\"html.direction\", \"ltr\") do\n head do\n meta :charset => @parameters.fetch(:encoding, Encoding.default_internal)\n state.fetch(\"html.headscripts\").each do |script|\n fail_todo \"what now?\"\n end\n state.fetch(\"html.css\").each do |css|\n fail_todo \"what now?\"\n end\n end\n body do\n capture(&body_filler)\n \n state.fetch(\"html.tailscripts\").each do |script|\n fail_todo \"what now?\"\n end\n end\n end\n end\n\n\n #\n # Starts an HTML stream.\n \n def html( attrs = {}, &block )\n @buffer << \"<!DOCTYPE html>\"\n @buffer << \"\\n\" if @pretty_print\n make( :html, attrs, &block )\n flush\n end\n\n\n #\n # Outputs raw text to the stream.\n \n def raw( text )\n @buffer << text\n end", "def purify_html\n doc= Nokogiri::XML::DocumentFragment.parse(self.to_s)\n doc.search(\".//strong\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h4\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h3\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h2\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h1\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n\n doc.search(\".//em\").each do |e|\n e.swap \"<i>#{e.inner_html}</i>\"\n end\n\n doc.search(\".//ul\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n doc.search(\".//ol\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n doc.search(\".//li\").each do |e|\n e.swap \"<p>#{e.inner_html}</p>\"\n end\n doc.search(\".//span\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n\n doc.to_xml(:encoding => \"UTF-8\").gsub(/\\n/,\" \").gsub(/\\s+/,\" \")\n end", "def grab_html\n\t\t@raw_html = HTTParty.get(@url)\n\t\t@soft_html = Nokogiri::HTML(@raw_html.body)\n\tend", "def parse_raw_html(el, &block); end", "def body_as_html(dir)\n html = nil\n\n Dir.chdir(dir) do\n tempfile = Tempfile.new('foiextract', '.')\n tempfile.print self.body\n tempfile.flush\n\n if self.content_type == 'application/vnd.ms-word'\n # XXX do something with PNG files this spits out so they view too :)\n system(\"/usr/bin/wvHtml --charset=UTF-8 \" + tempfile.path + \" \" + tempfile.path + \".html\")\n html = File.read(tempfile.path + \".html\")\n File.unlink(tempfile.path + \".html\")\n elsif self.content_type == 'application/pdf'\n IO.popen(\"/usr/bin/pdftohtml -nodrm -zoom 1.0 -stdout -enc UTF-8 -noframes \" + tempfile.path + \"\", \"r\") do |child|\n html = child.read()\n end\n else\n raise \"No HTML conversion available for type \" + self.content_type\n end\n\n tempfile.close\n tempfile.delete\n end\n\n # We need to look at:\n # a) Any error code\n # b) The output size, as pdftohtml does not return an error code upon error.\n # c) For cases when there is no text in the body of the HTML, or\n # images, so nothing will be rendered. This is to detect some bug in\n # pdftohtml, which sometimes makes it return just <hr>s and no other\n # content.\n html.match(/(\\<body[^>]*\\>.*)/mi)\n body = $1.to_s\n body_without_tags = body.gsub(/\\s+/,\"\").gsub(/\\<[^\\>]*\\>/, \"\")\n contains_images = html.match(/<img/mi) ? true : false\n if !$?.success? || html.size == 0 || (body_without_tags.size == 0 && !contains_images)\n return \"<html><head></head><body><p>Sorry, the conversion to HTML failed. Please use the download link at the top right.</p></body></html>\"\n end\n\n return html\n end", "def preprocess!\n input_html\n nil\n end", "def to_html\n @doc.at(\"body\").children.to_html(encoding: ENCODING).lstrip\n end", "def parse_block_html; end", "def encoding\n\n position = 0\n charset = nil\n length = @html.length\n\n done = false\n\n while position < length && !done\n\n # First look for a standard HTML comment (ie <!-- blah -->)\n if @html[position, 4] == '<!--'\n\n position += 2\n\n position += (@html[position, length].index('-->') || length)\n\n # Then look for the start of a meta tag\n elsif @html[position, 6] =~ /\\A\\<meta[\\s\\/]/i\n\n charset, position_increment = charset_from_meta(@html[position + 5, length])\n\n break if charset\n\n position += position_increment\n\n # Then look for <! or </ or <?\n elsif @html[position, 2] =~ /\\A\\<[\\!\\/\\?]/\n\n # Advance position to the first > that appears next in string, or end\n position += @html[position, length].index('>') || length\n\n else\n # Do nothing. (This is just here to make the algorithm easier to follow)\n end\n\n # Advance position to next character\n position += 1\n end\n\n charset\n end", "def html_parser=(_arg0); end", "def html_parser=(_arg0); end", "def parse_html(html)\n doc = Nokogiri::HTML(html)\n\n # Removing style and script tag content such as Javascript tags in order to get rid of JUNK text\n doc.xpath(\"//script\").remove\n doc.xpath(\"//style\").remove\n begin\n text = doc.at('body').inner_text\n rescue NoMethodError\n puts \"NoMethodError\"\n # puts file_name\n #title = nil\n end\n\n return text\nend", "def to_html text\n html = (''.encode text.encoding).dup\n\n encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding]\n\n s = StringScanner.new text\n insquotes = false\n indquotes = false\n after_word = nil\n\n until s.eos? do\n case\n when s.scan(/<(tt|code)>.*?<\\/\\1>/) then # skip contents of tt\n html << s.matched.gsub('\\\\\\\\', '\\\\')\n when s.scan(/<(tt|code)>.*?/) then\n warn \"mismatched <#{s[1]}> tag\" # TODO signal file/line\n html << s.matched\n when s.scan(/<[^>]+\\/?s*>/) then # skip HTML tags\n html << s.matched\n when s.scan(/\\\\(\\S)/) then # unhandled suppressed crossref\n html << s[1]\n after_word = nil\n when s.scan(/\\.\\.\\.(\\.?)/) then\n html << s[1] << encoded[:ellipsis]\n after_word = nil\n when s.scan(/\\(c\\)/i) then\n html << encoded[:copyright]\n after_word = nil\n when s.scan(/\\(r\\)/i) then\n html << encoded[:trademark]\n after_word = nil\n when s.scan(/---/) then\n html << encoded[:em_dash]\n after_word = nil\n when s.scan(/--/) then\n html << encoded[:en_dash]\n after_word = nil\n when s.scan(/&quot;|\"/) then\n html << encoded[indquotes ? :close_dquote : :open_dquote]\n indquotes = !indquotes\n after_word = nil\n when s.scan(/``/) then # backtick double quote\n html << encoded[:open_dquote]\n after_word = nil\n when s.scan(/(?:&#39;|'){2}/) then # tick double quote\n html << encoded[:close_dquote]\n after_word = nil\n when s.scan(/`/) then # backtick\n if insquotes or after_word\n html << '`'\n after_word = false\n else\n html << encoded[:open_squote]\n insquotes = true\n end\n when s.scan(/&#39;|'/) then # single quote\n if insquotes\n html << encoded[:close_squote]\n insquotes = false\n elsif after_word\n # Mary's dog, my parents' house: do not start paired quotes\n html << encoded[:close_squote]\n else\n html << encoded[:open_squote]\n insquotes = true\n end\n\n after_word = nil\n else # advance to the next potentially significant character\n match = s.scan(/.+?(?=[<\\\\.(\"'`&-])/) #\"\n\n if match then\n html << match\n after_word = match =~ /\\w$/\n else\n html << s.rest\n break\n end\n end\n end\n\n html\n end", "def presentable_html(html)\n # sanitize edited, tags: %w(body p span a h1 h2 h3 h4 h5 h6 ul ol li) if work.file_content_html %> -->\n # doc = Nokogiri::HTML(html_junk)\n # body = doc.at_xpath(\"//body\")\n # body.css('*').remove_attr('class')\n # edited = body.to_html\n return raw html\n end", "def process_html(content)\n head, opener, tail = content.output.partition(OPENING_BODY_TAG_REGEX)\n body_content, *rest = tail.partition(\"</body>\")\n\n processed_markup = process_anchor_tags(body_content)\n\n content.output = String.new(head) << opener << processed_markup << rest.join\n end", "def html\n return @html if defined? @html\n\n @html = Henkei.read :html, data\n end", "def parser(dst_encoding = 'utf-8', src_encoding = nil)\r\n return @cache[:parser] unless @cache[:parser].nil?\r\n\r\n if dst_encoding\r\n # Converts the page's body to UTF-8.\r\n return @cache[:parser] = Nokogiri::HTML(body.encode(dst_encoding, src_encoding))\r\n\r\n elsif (@cache[:parser] = page.try(:parser))\r\n # If no source encoding is given, does no conversion.\r\n return @cache[:parser]\r\n end\r\n\r\n '' # Default return.\r\n end", "def parse_html(old_dom, path_to_article)\n # ToC and lead-in\n # NOTE: ToC may prove to be a problem because it appears in the left-hand column on the page. we may want to do some JS node swapping onDOMReady. ignoring it for now.\n # 1) get children of <ul class=\"acm\">\n # 2) remove lead-in pound-down if present (first LI)\n # 3) get .inner_html of second <p> after <a name=\"lead-in\"></a> if A exists\n\n toc_node = (old_dom/\"ul.acm\")[0]\n toc_node.children.reject! { |el| (el/\"//a[@href='#lead-in']\").length > 0 }\n\n # the (4) is because of the whitespace nodes in between the element nodes\n # NOTE: the nodes_at method is a bit noisy and outputs some text in the console. weird.\n leadin_node = (old_dom/\"//a[@name='lead-in']\")\n leadin = leadin_node.length > 0 ? remove_whitespace(leadin_node[0].nodes_at(4).inner_html) : \"\"\n\n # journal name\n # 1) get .inner_html of <div class=\"jrnl\">\n\n journal_name = remove_whitespace((old_dom/\".jrnl\")[0].inner_html)\n\n # vol, issue, page #\n # 1) get .inner_html of <div class=\"iss\">\n\n vol_issue_page = remove_whitespace((old_dom/\".iss\")[0].inner_html)\n\n # full-text Anchor / Heading structure (observed)\n # \n # lead-in => extracted\n # body-1 => kept intact, back-to-top removed\n # body-n => kept intact\n # references => kept intact\n # authorinfo => kept intact\n # footnotes => kept intact\n # figures => kept intact\n # tables => kept intact\n # sidebar-1 => kept intact\n # sidebar-n => kept intact\n # permission => kept intact, back-to-top removed\n\n # \"body-n\" section headings / back to top look like this:\n # \n # <a name=\"body-3\"></a>\n # <p>\n # <a href=\"#top\"><img src=\"http://portal.acm.org/img/arrowu.gif\" border=\"0\" alt=\"back to top\">&nbsp;</a>\n # <b>Moderator</b>\n # </p>\n # \n # 1) attempt to find each <a name=\"body-n\"></a> element\n # 2) immediately after element is the P that contains the back to top link and B tag with the section heading\n # NOTE: body-1 does not have a B tag in the P (i've seen it referenced as \"Introduction\" or \"Article\" in the ToC)... remove it.\n # 3) get inner_html of B tag\n # 4) remove P tag\n # 5) insert new back to top link before A tag\n # <p class=\"totop\"><a href=\"#PageTop\">Back to Top</a></p>\n # 6) insert new Hx tag (with contents of the B tag) after A tag \n # NOTE: we may want it in Hx tag, or give the Hx tag the ID of the old A tag and remove the A tag altogether... we'll see\n\n # known headings look like this:\n # \n # <a name=\"authorinfo\"></a>\n # <p>\n # <a href=\"#top\"><img src=\"http://portal.acm.org/img/arrowu.gif\" border=\"0\" alt=\"back to top\">&nbsp;</a>\n # <b>Author</b>\n # </p>\n # \n # (same as body-n headings except we replace them with slightly different Hx tags... TBD exactly)\n\n known_headings = %w(references authorinfo footnotes figures tables permission)\n body_regex = /^body-\\d+$/\n sidebar_regex = /^sidebar-\\d+$/\n back_to_top = %{<p class=\"totop\"><a href=\"#PageTop\">Back to Top</a></p>\\n\\n}\n\n (old_dom/\"//a[@name]\").each do |anchor|\n next unless known_headings.include?(anchor['name']) || anchor['name'].match(body_regex) || anchor['name'].match(sidebar_regex)\n\n # the (2) is because of the whitespace nodes in between the element nodes\n p = anchor.nodes_at(2)\n\n if anchor['name'] == \"body-1\"\n p.remove\n\n elsif anchor['name'] == \"permission\"\n p.remove\n anchor.before(%{<hr class=\"Separator\" />\\n})\n\n else\n heading = remove_whitespace((p/'b')[0].inner_html)\n p.remove\n # put the back-to-top link in between the comments so the soon-to-be-created DIV doesn't wrap it\n anchor.nodes_at(-2).before(back_to_top)\n classname = known_headings.include?(anchor['name']) ? ' class=\"known-headings\"' : \"\"\n anchor.after(%{\\n<h3#{classname}>#{heading}</h3>})\n end\n end\n \n # Fix Article figures and tables\n HtmlMaid.fix_figures_and_tables(old_dom)\n \n # We just gave the figures \"back to top\" link the wrong class name. Fix:\n (old_dom/\".ThumbnailParagraph\").each do |thumb_para|\n thumb_para.set_attribute :class, \"totop\" if thumb_para.inner_text.downcase.eql?(\"back to top\")\n end\n \n # Rewrites URLs and img SRCs to point to deliveryimages.org\n HtmlMaid.change_link_and_img_paths(old_dom, path_to_article)\n \n # final processing\n # 1) body.inner_html\n # 2) remove everything up to <!-- BEGIN BODY-1 -->\n\n html = (old_dom/:body).inner_html.gsub(/^.+(<!-- BEGIN BODY-1 -->)/m, '\\\\1')\n\n # add DIVs around known sections for styling purposes\n # \n # FIXME: this can probably be optimized by avoiding the ruby interator \n # and using regexp groups and backreferences to pull out the individual items\n known_headings.each do |heading|\n re = Regexp.new(\"(<!-- BEGIN #{heading.upcase} -->)(.+)(<!-- END #{heading.upcase} -->)\", Regexp::MULTILINE)\n html = html.gsub(re, %{\\\\1\\n<div id=\"article-#{heading}\">\\n\\\\2\\n</div>\\n\\\\3})\n end\n\n # do the same for sidebars, albeit a bit more complicated regex-wise\n html = html.gsub(/(<!-- BEGIN (SIDEBAR-(\\d)) -->)\\s*(<a name=\"(sidebar-\\3)\"><\\/a>)(.+)(<!-- END \\2 -->)/m, %{\\\\1\\n<div class=\"ArticleSidebar\" id=\"article-\\\\5\">\\n\\\\4\\n\\\\6\\n</div>\\n\\\\7})\n \n # Why don't all tables and figures get a \"back to top\" link? Not sure, \n # but let's give it one... unless it's a black sheep that already has one.\n \n # Now we're going to be evil and RE-parse this stuff to safely re-insert\n # some back to top links for figures and tables...\n \n new_dom = Hpricot(html)\n \n # Find the DIVs that are now wrapping the figures and tables. \n \n figures_div = new_dom.at(\"#article-figures\")\n tables_div = new_dom.at(\"#article-tables\")\n \n if figures_div\n # Don't add double back-to-top links!\n unless figures_div.children_of_type(\"p\").last.get_attribute(:class).eql?(\"totop\")\n # Just to be paranoid, let's also make sure they didn't sneak one in\n # after the wrapping div, either...\n unless figures_div.next_sibling.name.eql?(\"p\") and figures_div.next_sibling['class'].eql?(\"totop\")\n \n # Swap the ENTIRE div for the div + totop link\n # Why can't Hpricot just insert a string after an Hpricot::Elem?\n # ... I'll add that to my hpricot_extensions wish list.\n \n figures_div.swap(figures_div.to_html + '<p class=\"totop\"><a href=\"#PageTop\">Back to top</a></p>')\n end\n end\n end\n \n # Rinse, repeat\n if tables_div\n unless tables_div.children_of_type(\"p\").last.get_attribute(:class).eql?(\"totop\")\n unless tables_div.next_sibling.name.eql?(\"p\") and tables_div.next_sibling['class'].eql?(\"totop\")\n tables_div.swap(tables_div.to_html + '<p class=\"totop\"><a href=\"#PageTop\">Back to top</a></p>')\n end\n end\n end\n \n # OK, back to packaging this up...\n html = new_dom.to_html\n \n return {\n :full_text => html,\n :leadin => leadin,\n :journal_name => journal_name,\n :vol_issue_page => vol_issue_page,\n :toc => toc_node.inner_html\n }\n\n ensure\n toc_node = nil\n old_dom = nil\n leadin_node = nil\n GC.start\n end", "def parsed\n @parsed ||= Nokogiri::HTML(@document.to_s)\n end", "def to_html\n CGI.unescapeHTML(Riki::Base.api_request({'action' => 'parse', 'page' => @title}).first.find('/m:api/m:parse/m:text/text()').first.to_s)\n end", "def process_markdown\n self.data = self.class.convert_markdown(self.data)\n sanitize_html\n end", "def text_wikimedia_html page\n html = @client.text_wikimedia_html page\n # normalize html by removing <!-- html comments -->\n doc = Nokogiri.HTML html\n (doc.xpath '//comment()').remove\n doc.inner_html\n end", "def html=(b); end", "def html_markup_org(text); end", "def html= html\n native.load_html_string html, nil\n end", "def unescape_html\n CGI.unescapeHTML(self)\n end", "def parse_html(html)\n cleaned = html.gsub(/\\n/, '').gsub(/>\\s*</m, '><').gsub /\\x00/, ''\n doc = Nokogiri::HTML(cleaned, nil, nil, Nokogiri::XML::ParseOptions.new.default_html.noblanks)\n # remove all 'script' and 'style' nodes from the document\n doc.css('style').each {|n| n.remove }\n doc.css('script').each {|n| n.remove }\n doc\n end", "def process_html\n benchmark \"Process HTML for #{self.url}\" do\n doc = Readability::Document.new(self.html)\n html = doc.html\n self.title = content_for_open_graph_tag('og:title', html) || doc.title\n self.description =\n content_for_open_graph_tag('og:description', html) ||\n content_for_meta_tag('name=\"description\"', html) ||\n html.xpath('//head/meta/@description', html).first.try(:content)\n image_url = content_for_open_graph_tag('og:image', html) || doc.images.first\n self.image_url = image_url if image_url =~ URI.regexp\n self.site_name = content_for_open_graph_tag('og:site_name', html) || get_url_domain.try(:humanize)\n self.content_html = doc.content.encode_from_charset!(doc.html.encoding)\n self.content = Nokogiri::HTML(self.content_html).text\n end\n self\n end", "def parsed_document\n @parsed_document ||= Nokogiri::HTML(document)\n rescue Exception => e\n add_fatal_error \"Parsing exception: #{e.message}\"\n end", "def substitute_markdown_inside_raw_html\n each_element(:raw_html) do |e|\n html = e.parsed_html\n next unless html\n\n html.process_markdown_inside_elements(self)\n end\n end", "def parsed\n @parsed ||= Nokogiri::HTML(@document.to_s)\n rescue Exception => e\n @exception_log << e\n end", "def normalise_html(html)\n Nokogiri::HTML5.fragment(html).to_s\n end", "def compute_body(root)\n html_body, _warnings = html_converter_class.convert(root, @options)\n html_body\n end", "def html_markup_html(text); end", "def normalise(html)\n doc = Nokogiri::HTML(html)\n body = doc.xpath('//body')\n\n body.xpath('//script').each {|s| s.remove}\n body.xpath('//comment()').each {|c| c.remove}\n body.xpath('//text()').find_all {|t| t.to_s.strip == ''}.map(&:remove)\n body.xpath('//header').remove\n body.xpath('//footer').remove\n body.xpath('//div[@id = \"global-cookie-message\"]').remove\n body.xpath('//div[@id = \"global-header-bar\"]').remove\n body.xpath('//div[@class = \"phase-banner-alpha\"]').remove\n body.xpath('//@class').remove\n body.xpath('//@id').remove\n body.xpath('//a').xpath('//@href').remove\n body.xpath('//label').xpath('//@for').remove\n body.xpath('//input').xpath('//@name').remove\n body.xpath('//input').xpath('//@value').remove\n\n remove_attributes(body, 'data')\n remove_attributes(body, 'aria')\n\n body.to_s\n .gsub(/>\\s+/, '>')\n .gsub(/\\s+</, '<')\n .gsub('><', \">\\n<\")\n end", "def initialize html\n @doc = to_doc html\n @additional_namespaces = []\n end", "def trans_html\n @doc.to_html\n end", "def initialize(raw_content, options = {})\n @options = options\n @raw_content = Pismo::Document.clean_html(raw_content)\n build_doc\n end", "def parse html\n return if html.nil?\n @fragment = Nokogiri::HTML.fragment(html)\n @fragment_copy = Nokogiri::HTML.fragment(html)\n end", "def normalise_html(html)\n Nokogiri::HTML5.fragment(html).to_s.gsub(\"\\n\", \"\")\n end", "def process_html(html)\r\n html = email_process(html)\r\n process_menu(html)\r\n end", "def parse_text\n @doc = Nokogiri::HTML(wrap(@text)) do |config|\n #config.strict\n end\n rescue Exception => e\n log(\"Error parsing text, couldn't continue. #{e}\")\n end", "def to_html( *rules )\n rules = DEFAULT_RULES if rules.empty?\n # make our working copy\n text = self.dup\n \n @urlrefs = {}\n @shelf = []\n textile_rules = [:block_textile_table, :block_textile_lists,\n :block_textile_prefix, :inline_textile_image, :inline_textile_link,\n :inline_textile_code, :inline_textile_span, :glyphs_textile]\n markdown_rules = [:refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule,\n :block_markdown_bq, :block_markdown_lists, \n :inline_markdown_reflink, :inline_markdown_link]\n @rules = rules.collect do |rule|\n case rule\n when :markdown\n markdown_rules\n when :textile\n textile_rules\n else\n rule\n end\n end.flatten\n\n # standard clean up\n incoming_entities text \n clean_white_space text \n\n # start processor\n @pre_list = []\n rip_offtags text\n no_textile text\n escape_html_tags text\n hard_break text \n unless @lite_mode\n refs text\n # need to do this before text is split by #blocks\n block_textile_quotes text\n blocks text\n end\n inline text\n smooth_offtags text\n\n retrieve text\n\n text.gsub!( /<\\/?notextile>/, '' )\n text.gsub!( /x%x%/, '&#38;' )\n clean_html text if filter_html\n text.strip!\n text\n\n end", "def html(include_ocr: false)\n return @html if defined? @html\n\n @html = Henkei.read :html, data, include_ocr: include_ocr\n end", "def parse(html)\n Parser.new(self.lex(html)).parse()\n end", "def parse_markup\n @html = PARSER.parse(@markup, :base_heading_level => 1)\n end", "def call\n result = Kramdown::Document.new(@text, self.class.options.deep_merge(context[:kramdown_options] || {})).to_html\n result.rstrip!\n result\n end", "def html\n process_message_body if !@html\n @html\n end", "def wrap(html); end", "def wrap(html); end", "def html(html)\n @doc = Nokogiri::HTML(html)\n\n # return\n JSON.pretty_generate(serializer(@struct, @doc))\n end", "def parse_html_entity; end", "def convert_encoding(content); end", "def process_oldstyle_html contents\n\tdoc = Nokogiri::HTML(contents)\n\n\t# the HIB page keeps each entry in a div with class 'row'\n\t# plus a name based on the game name.\n\tdoc.css('div.row').each do |div|\n\t\tname = div['class'].sub(/\\s*row\\s*/,'')\n\t\troot = get_root name\n\t\tdiv.css('.downloads').each do |dd|\n\t\t\ttype = dd['class'].gsub(/\\s*(downloads|show)\\s*/,'')\n\t\t\tdd.css('.download').each do |dl|\n\t\t\t\taa = dl.css('a.a').first\n\t\t\t\tlink = aa['href']\n\t\t\t\tbtlink = aa['data-bt']\n\t\t\t\tif btlink.empty?\n\t\t\t\t\tbtlink = nil\n\t\t\t\tend\n\t\t\t\tmd5 = dl.css('a.dlmd5').first['href'].sub(/^#/,'') rescue nil\n\t\t\t\tts = dl.css('a.dldate').first['data-timestamp'] rescue nil\n\t\t\t\tsavepath = File.join(root, type)\n\n\t\t\t\tdl = true\n\n\t\t\t\tif link[-1] == '/'\n\t\t\t\t\tSTDERR.puts \"# No automatic downloads for #{savepath}, go to #{link}\"\n\t\t\t\t\tdl = false\n\t\t\t\tend\n\n\t\t\t\t$dirs << savepath\n\t\t\t\tif dl\n\t\t\t\t\tfname = get_filename link\n\t\t\t\t\tfkey = fname.intern\n\t\t\t\t\t$files[fkey] << Game.new(fname, md5, savepath, link, btlink)#, ts)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend", "def clean_html\n HTML::WhiteListSanitizer.allowed_protocols << 'data'\n self.content = ActionController::Base.helpers.sanitize(self.body, :tags => ALLOWED_TAGS, :attributes => ALLOWED_ATTRIBUTES)\n end", "def to_html(content)\n case @parser\n when :kramdown, 'kramdown'\n require 'kramdown'\n Kramdown::Document.new(content).to_html\n when :redcarpet, 'redcarpet'\n require 'redcarpet'\n markdown = Redcarpet::Markdown.new(\n Redcarpet::Render::HTML,\n smart: true,\n no_intra_emphasis: true,\n fenced_code_blocks: true,\n autolink: true,\n tables: true,\n with_toc_data: true\n )\n\n # add smartypants support\n Redcarpet::Render::SmartyPants.render markdown.render(content)\n when :rdiscount, 'rdiscount'\n require 'rdiscount'\n RDiscount.new(content).to_html\n when :gfm, :github, :github_markdown, 'gfm', 'github_markdown'\n require 'github/markdown'\n GitHub::Markdown.render(content)\n end\n end", "def parse_html\n return nil_elem if @word.line.match(TRANSLATED)\n return nil_elem if @word.tail.join(\" \")[/^{{.*}}$/]\n\n body = @word.tail.join(\" \")\n body, tagged_with_equals = SlimKeyfy::Transformer::Whitespacer.convert_nbsp(body, @word.head)\n\n tagged_with_equals = \"|\" if tagged_with_equals == \"=\"\n\n if body.match(LINK_TO) != nil\n body = link_tos(body)\n end\n\n translation_key = update_hashes(body)\n normalize_translation(\"#{tagged_with_equals} #{translation_key}\")\n end", "def contents()\n html = Nokogiri::HTML(@markdown_document.to_html())\n\n # Fixup refs to other markdown documents\n html.css(\"a\").each do |anchor|\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.md$}, \".html\")\n end\n\n # Since we transform device-specific $device/README.md pages into\n # discrete $device.html, we need to fixup cross-linking into its namespace\n # This could be generalized some more, to be fixed once we have other internal links to mismatched README.md/index.html locations.\n if File.dirname(relative_output) == \"devices\"\n html.css(\"a\").each do |anchor|\n if anchor[\"href\"].match(%r{\\.\\./[^\\.]+$})\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.\\./}, \"devices/\") + \".html\"\n end\n end\n end\n\n # Since Nokogiri produces a complete document from our fragment, we\n # have to pick only what's in the body; so strip the body added tags and higher-up tags.\n html\n .at_css(\"body\").to_s()\n .sub(%r{^<body>}, \"\").sub(%r{</body>$}, \"\")\n end", "def parse_page(response)\n\t\tNokogiri::HTML(response.body)\n\tend", "def parse_html(pdoc, data)\n src = ::Nokogiri::HTML(data)\n pdoc.properties[:title] = src.title\n extract_plaintext(src.root, pdoc)\n\n # css, js, images\n src.xpath('//link[@rel=\"stylesheet\"]').each do |t|\n pdoc.add_ext_ref(t[:href], PlanR::ParsedDocument::REF_STYLE)\n end\n\n src.xpath('//script[@src]').each do |t|\n pdoc.add_ext_ref(t[:src], PlanR::ParsedDocument::REF_SCRIPT)\n end\n\n src.xpath('//img[@src]').each do |t|\n pdoc.add_ext_ref(t[:src], PlanR::ParsedDocument::REF_IMAGE)\n end\n\n # links\n src.xpath('//a[@href]').each do |t|\n next if (t[:href].start_with? '#')\n next if (t[:href].start_with? 'mailto:')\n pdoc.add_ext_ref(t[:href], PlanR::ParsedDocument::REF_DOC)\n end\n\n # metadata\n meta = {}\n src.xpath('//meta').each do |t|\n last_name = name = value = nil\n t.attributes.each do |key, attr|\n if attr.name == 'content'\n value = attr.value\n elsif attr.name == 'name'\n name = attr.value\n else\n last_name = attr.value\n end\n end\n name = last_name if not name\n meta[name.downcase] = value if name && value\n end\n meta.fetch('keywords', '').split(',').each do |keyword|\n pdoc.keywords << keyword\n end\n pdoc.properties[:content_type] = meta.fetch('content-type', '')\n pdoc.properties[:description] = meta.fetch('description', '')\n end", "def html_decode(html)\n if use_htmlentities\n HTMLEntities.new.decode(html)\n else\n CGI.unescapeHTML(html)\n end\n end", "def to_html\n writer = Writer.new(StringIO.new)\n \n bookmarks.each{|b| writer << b }\n writer.done\n \n writer.io.string\n end", "def html\n @html ||= Nokogiri::HTML html_source, nil, HTML_ENCODING if html_source\n @html\n end", "def clean_up_contents()\n # very minimal\n # elements = ['p', 'b', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'], attributes={})\n\n if self.contents?\n html = self.contents\n email_regex = /<p>Email:\\s+((\\w|\\-|\\_|\\.)+\\@((\\w|\\-|\\_)+\\.)+[a-zA-Z]{2,})/i\n\n html.gsub! /\\[endif\\]--/ , ''\n html.gsub! /[\\n|\\r]/ , ' '\n html.gsub! /&nbsp;/ , ' '\n\n # this will convert UNICODE into ASCII. \n #It will also strip any possiblity of using a foreign language!\n #converter = Iconv.new('ASCII//IGNORE//TRANSLIT', 'UTF-8') \n #html = converter.iconv(html).unpack('U*').select{ |cp| cp < 127 }.pack('U*')\n # keep only the things we want.\n unless (Sanitize::Config::RELAXED[:attributes][\"table\"].include?(\"align\"))\n Sanitize::Config::RELAXED[:attributes][\"table\"] << \"align\"\n end\n\n config = Sanitize::Config::RELAXED\n if (html.encoding.name == 'ASCII-8BIT')\n config[:output_encoding] = 'ASCII'\n end\n html = Sanitize.clean( html, config)\n\n # butt up any tags\n html.gsub! />\\s+</ , '><'\n\n #remove email address lines\n html.gsub! email_regex , '<p>'\n\n # post sanitize cleanup of empty blocks\n # the order of removal is import - this is the way word stacks these elements\n html.gsub! /<i><\\/i>/ , ''\n html.gsub! /<b><\\/b>/ , ''\n html.gsub! /<\\/b><b>/ , ''\n html.gsub! /<p><\\/p>/ , ''\n html.gsub! /<p><b><\\/b><\\/p>/ , ''\n\n # misc - fix butted times\n html.gsub! /(\\d)am / , '\\1 am '\n html.gsub! /(\\d)pm / , '\\1 pm '\n # misc - remove multiple space that may cause doc specific regexs to fail (in dates for example)\n html.gsub! /\\s+/ , ' '\n\n # add new lines at the end of lines\n html.gsub! /<\\/(p|h\\d|dt|dd|dl)>/, '</\\1>' + \"\\n\"\n html.gsub! /<dl>/ , '<dl>' + \"\\n\"\n\n self.contents = html\n end\n end", "def run\n\t\t\t\tif save_file\n\t\t\t\t\tdoc = Nokogiri::HTML(open(@file,\"r\"))\n\t\t\t\t\tparse_page(doc)\n\t\t\t\t\tflush_page\n\t\t\t save_words\n\t\t\t end\n\t\t\tend", "def doc &b\n\t\t\tdoctype\n\t\t\thtml &b\n\t\tend", "def to_html\n return \"\" unless file_name\n return e if e?\n page = render.to_html\n path = File.dirname(file_path)\n # Get child content.\n # A reflexive.\n files(path).each do |file|\n doc = Document.new :base_path => self.base_path, :lang => self.lang, :indent => self.indent, :settings => self.settings, :web_path => self.web_path, :commit => self.commit, :repository => self.repository, :filename => file\n self.browsers << doc\n page += doc.to_html\n end\n dirs(path).each do |dir|\n # Plus one indent from parent. Change h[1-6] tag to h[2-7] if indent is 1.\n doc = Document.new :base_path => dir, :lang => self.lang, :indent => self.indent + 1, :settings => self.settings, :web_path => self.web_path[0..-2] + dir.gsub(self.base_path, \"\"), :commit => self.commit, :repository => self.repository\n self.childs << doc\n page += doc.to_html\n end\n page\n end", "def convert\n Converters::HtmlConverter.new(input: to_html)\n end", "def html2text(html)\n\n result = ''\n begin\n web_doc = Hpricot(html)\n web_doc.search(\"//comment()\").remove\n web_doc.search(\"script\").remove\n web_doc.search(\"style\").remove\n web_doc.search(\"noscript\").remove\n web_doc.search(\"object\").remove\n web_doc.search(\"embed\").remove\n web_doc.search(\"head\").remove\n\n web_doc.traverse_text do |e| \n\n begin\n if e.content\n result += e.content+\"\\n\"\n end\n rescue\n # ignore errors\n end\n end\n rescue Exception => e\n # ignore errors\n warn \"html2text() - Exception '#{e.message}' trying to parse '#{html}'\"\n end\n\n if result == ''\n # Use a simple regular-expression approach to remove all tags\n result = html.gsub(/<[^>]*>/, '')\n end\n\n coder = HTMLEntities.new\n result = coder.decode(result)\n\n result.gsub!(/\\n[\\r\\n \\t]*/, \"\\n\")\n\n result\nend", "def get_html\n print \"Getting doc...\"\n if File.size?(@cache)\n html = File.read(@cache)\n else\n html = open(URL).read\n IO.write(@cache, html)\n end\n puts \"done.\"\n html\n end", "def parsed_document\n @parsed_document ||= Nokogiri::HTML(document)\n\n rescue Exception => e\n warn 'An exception occurred while trying to scrape the page!'\n warn e.message\n end", "def body\n @body ||= Page.convert_raw_to_html(raw_body)\n end", "def doc\n return @doc if @doc\n @doc = Nokogiri::HTML(@body) if @body && html? rescue nil\n end", "def html2text\n doc = self.scrape.hdoc\n text = node_to_text(doc)\n# text.gsub!(NamedCharRegex){|s| \"#{lookup_named_char(s)}\"}\n # clean up white space\n text.gsub!(\"\\r\",\" \")\n text.squeeze!(\" \")\n text.strip!\n ret = ''\n text.split(/\\n/).each do |l|\n l.strip!\n next if l == ''\n next if l =~ /^\\?+$/\n ret += \"#{l}\\n\"\n end\n return ret\n end", "def html_markup_asciidoc(text); end", "def as_html_deprecated #use TextEncoder.convert_to_html instead.\n return self if self.blank?\n mytext = self\n #mytext = CGI.escapeHTML(mytext)\n mytext.gsub!(NpbConstants::URL_DETECTION){|web_link| %{ <a href=\"#{web_link.strip}\">#{web_link.strip}</a> }}\n #mytext.gsub!(NpbConstants::EMAIL_DETECTION){|email| %{\\1<a href=\"mailto:#{email.strip}\">#{email.strip}</a>}}\n mytext.gsub!(NpbConstants::EMAIL_DETECTION){|email| %{#{$1}<a href=\"mailto:#{email.strip}\">#{email.strip}</a>}}\n mytext.gsub!(/\\A +/) {|l_spaces| (\"&nbsp;\"*l_spaces.size)} \n mytext.gsub!(/\\n +/) {|l_spaces| (\"\\n\" + (\"&nbsp;\"*(l_spaces.size-1)))}\n mytext.gsub!(/\\n{2,}/,'</p><p>')\n mytext.gsub!(/(\\n)([^\\n])/, '<br/>\\2')\n mytext\n end", "def convert_html(html)\n # Sanitize the html and surround in a <span> tag to make it work with htmltolatex better\n html = \"<span>\" + sanitize(html, :tags => %w(em i sup sub)) + \"</span>\"\n\n # Create the temp files and output the html source to the first one\n raw = Tempfile.new('htmltolatex_html')\n output = Tempfile.new('htmltolatex_tex')\n raw << html; raw.flush\n \n # Run htmltolatex on the source\n path = File.join(RAILS_ROOT, \"lib\", \"htmltolatex\")\n `cd #{path} && #{File.join(path, \"htmltolatex\")} -input #{raw.path} -output #{output.path}`\n\n # Read in the results\n converted = File.open(output.path, \"rb\") { |f| f.read }\n \n # Close and unlink the files\n raw.close!\n output.close!\n \n # Return the results\n converted\n end", "def extract_content(response_doc)\n doc = Nokogiri::HTML(response_doc)\n\n doc.xpath('//javascript').remove\n doc.xpath('//script').remove\n\n doc.xpath('//head').remove\n doc.xpath('//header').remove\n doc.xpath('//footer').remove\n doc.xpath('//*[contains(@class, \"nav\")]').remove\n\n doc.xpath('//*[contains(@class, \"head\")]').each do |n|\n n.remove unless n[\"class\"].length > 9\n end\n\n doc.xpath('//*[contains(@class, \"foot\")]').each do |n|\n n.remove unless n[\"class\"].length > 9\n end\n\n doc.xpath('//input').remove\n doc.xpath('//button').remove\n\n doc.xpath('//style').remove\n\n body = doc.at_css('body')\n body = doc unless !body.blank?\n\n body.traverse do |node|\n begin\n node_content = node.content.clean\n if node_content.length > 35\n node.content = node_content + (node_content.last == \".\" ? \" \" : \". \")\n elsif node.name == \"td\"\n node.content = node_content + \" \"\n elsif node_content.to_s.count(\" \") < 1\n node.remove\n else\n node.content = node_content + \" \"\n end\n rescue Java::JavaLang::NullPointerException => e\n rescue NoMethodError => e\n # Swallow error from mutating the document while traversing it.\n end\n end\n\n return body.content.clean\n end", "def doc \n Nokogiri.parse(page.body)\n end", "def parse\n return @document if @document\n\n @document = super @text, @format\n @document.file = @location\n @document\n end", "def parse_content_from_yuletide_file(story)\n @doc = Nokogiri::HTML.parse(story) rescue \"\"\n content_table = (@doc/\"table[@class='form']/tr/td[2]\")\n content = \"\"\n unless content_table\n content = (@doc/\"body\").inner_html\n else\n centers = content_table.css(\"center\")\n centers[0].remove\n # trying to remove comment links at the bottom\n if !centers[-1].nil? && centers[-1].to_html.match(/<!-- COMMENTLINK START -->/)\n centers[-1].remove\n end\n content = content_table.inner_html\n end\n \n @storyparser ||= StoryParser.new\n content = @storyparser.clean_storytext(content)\n content.gsub!(/<a href=\"\\//, '<a href=\"http://yuletidetreasure.org/')\n content\n end" ]
[ "0.7067447", "0.6876506", "0.64721465", "0.64503837", "0.62700224", "0.6265628", "0.6217451", "0.60732317", "0.60644275", "0.60518336", "0.6009913", "0.60089463", "0.60034865", "0.5994988", "0.5970744", "0.59587073", "0.594608", "0.5942444", "0.5865918", "0.58497345", "0.5842843", "0.58221024", "0.5816191", "0.57757866", "0.5772519", "0.5736269", "0.57102716", "0.5690499", "0.568256", "0.5676329", "0.5676329", "0.56686634", "0.5660773", "0.5650761", "0.56358814", "0.56332767", "0.5612296", "0.561019", "0.5586939", "0.55853283", "0.55757457", "0.5571608", "0.5568227", "0.5564023", "0.5563202", "0.5549326", "0.554656", "0.55347335", "0.55265653", "0.55145824", "0.5513612", "0.55112857", "0.5484375", "0.5464815", "0.54620093", "0.5460745", "0.5457185", "0.5455367", "0.5454112", "0.54360014", "0.5433183", "0.5416014", "0.5407817", "0.54025584", "0.5397863", "0.53911746", "0.53670913", "0.5365057", "0.5361159", "0.5361159", "0.5360675", "0.53597695", "0.53582335", "0.5341152", "0.5339601", "0.5337469", "0.53369164", "0.53357923", "0.5328555", "0.5326966", "0.5325235", "0.5320805", "0.53192353", "0.5315756", "0.5311133", "0.5304843", "0.5302902", "0.5298879", "0.529483", "0.5292688", "0.5291032", "0.52890104", "0.5282379", "0.52793354", "0.52631634", "0.5260326", "0.525951", "0.52570105", "0.5251314", "0.5250893", "0.52492005" ]
0.0
-1
Return the desc of the beer, "Amber ale 6.9%"
def get_beer_desc(noko) beer_desc = '' if (beer_desc_matchdata = noko.to_s.gsub(/\n/, '').match(/(<br\s*\/*>)(.+%) /)) beer_desc = beer_desc_matchdata[2].gsub(/\s+/, ' ').strip end beer_desc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def energyEfficiency()\n\t\t\t\t\"Carbs \" + carbsPercent().round(2).to_s + \"%,\\nProteins \" + proteinsPercent().round(2).to_s + \"%\\nLipids \" + lipidsPercent().round(2).to_s + \"%\\n\"\n\t\t\tend", "def rating; \"Д/379 (stub)\"; end", "def description\n @beverage.description + \", Whip\"\n end", "def display_description\n @name.capitalize + \" stands here\" + ((item_for :weapon) ? (\", wielding \" + item_for(:weapon).short_display_string) : \"\") + \".\"\n end", "def description\n @beverage.description + \", Milk\"\n end", "def hp_text\n \"#@hp / #{self.max_hp}\"\n end", "def modeler_description\n return \"Grey water tank overflow will be dirrected to drainage. \"\n end", "def get_hidratos\n \"#{@hidratos}%\" \n end", "def rolf_desc\n name_descriptions(:peltigera_alt_desc)\n end", "def modeler_description\n return \"Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.\"\n end", "def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end", "def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end", "def long_desc\n desc = \"\" << super << \"\\r\\n#{self.pronoun.capitalize} is holding \"\n desc << @inventory.show << \".\\r\\n\" << @equipment.show(self)\n\n return desc\n end", "def description\n @beverage.description + \", Soy\"\n end", "def desc() summary; end", "def description\n @beverage.description\n end", "def humanized_rating\r\n rating.to_f > 0 ? sprintf(\"%.1f\", rating) : nil\r\n end", "def descriptions\n return @detail + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end", "def metric\n weight = get_weight(\"kg\")\n height = get_height(\"m\")\n\n bmi = \"#{weight / (height * height)}\"\n puts \"Your BMI is: #{bmi}\"\n return bmi\nend", "def summary\n\t\tsummary = \"\"\n\t\tget = @text.split(/ /)\n\t\tget.each_index do |word|\n\t\t\tsummary << get[word] << \" \" if word < 10\n\t\tend\n\t\tsummary.strip\n\tend", "def rating_text(rating)\n base = \" Level Opportunity\"\n if rating>9\n \"Ruby\"+base\n elsif rating>7.5\n \"Gold\"+base\n elsif rating>6\n \"Silver\"+base\n else\n \"Bronze\"+base\n end\nend", "def description\n description = puts \"Shelves containing food and other common supplies line the walls \"\\\n \"here. These things were probably stolen from the local village or nearby farms during \"\\\n \"raids. Although there doesn't seem to be anything of value here, you never know what a \"\\\n \"search will turn up.\"\n puts \"You can go back the way you came from.\"\n if @monster\n puts \"An evil #{@monster.monster} is here, ruffling for something to eat.\"\n else\n puts \"The squeek of a rat and pitter-patter of tiny rodent feet is all you hear.\"\n end\n end", "def name; nutrdesc; end", "def human_price\n #return self.price.to_s + '元' + '(待审)' if self.type_id !='团购价' or self.is_valid.nil?# and self.reviews.sum(:status) < STATUS_LOW\n self.price == 0.0 ? \"免费\" :\"#{\"%0.2f\" %self.price}元\"\n end", "def describe_price\r\n\t\ta = []\r\n\t\ta << sprintf('$%.2f per item', per_item) unless per_item.zero?\r\n\t\ta << sprintf('$%.2f per kg', per_kg) unless per_kg.zero?\r\n\t\ta << sprintf('$%.2f', flat_rate) unless flat_rate.zero?\r\n\t\tif formula and !formula.empty?\r\n\t\t\tif formula_description and !formula_description.empty?\r\n\t\t\t\ta << formula_description\r\n\t\t\telse\r\n\t\t\t\ta << formula.gsub('I', \"'number of items'\").gsub('W', \"'total weight'\").gsub('V', \"'total value'\")\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\ta.empty? ? ((name == '[ to be advised ]') ? nil : 'no charge') : a.join(' + ')\r\n\tend", "def get_proteinas\n \"#{@proteinas}%\" \n end", "def stats\n puts 'You have ' + self.health.to_s + ' health remaining and have ' + self.denarii.to_s + ' denarii to your name.'\n end", "def humanized_rating\n\t\tRATINGS.invert[self.rating]\n\tend", "def description\n pricing_db_hp_short_description.description\n end", "def best_description\n if description?\n description\n else\n additional_description\n end\n end", "def modeler_description\n return \"For each light in the model, reduce the lighting fraction by the user specified amount. The default reduction of 15% comes from ASHRAE 90.1-2010 Table G3.2, as wireless occupancy sensors should be able to control groups of lights at a more granular level, as opposed to the standard 10% reduction for large, open spaces.\"\n end", "def descr\n return text_get(2, id)\n end", "def description\n return summary\n end", "def descriptions\n \n return @detail + \": \" + \"#{@extra_cost}\" + \". \" + @basic_transfer.descriptions\n end", "def describe_paragraph(being)\n desc = ''\n continued = false\n describe(being) do |quality, key, amount|\n possessive = possessive_name_or_pronoun(being)\n possessive.capitalize! unless continued\n desc += [conjunction(continued),\n possessive,\n key,\n key.pluralize == key ? 'are' : 'is',\n strength(amount),\n quality].join(' ')\n continued = rand < 0.333 && !continued\n desc += \".\" unless continued\n end\n desc.strip\n end", "def description\n name + ': ' + resource_type.to_s + ' | Sueldo: ' + salary.to_s +\n ' | Experiencia: ' + experience.to_s + ' años'\n end", "def og_desc(desc)\n\t\tbase_desc = \"Informing and entertaining the global internet generation.\"\n\t\tif desc.empty?\n\t\t\tbase_desc\n\t\telse\n\t\t\tdesc.to_s\n\t\tend\n\tend", "def desc\n return @desc\n end", "def get_score\n \"#{@name} #{@lives}/3\"\n end", "def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_drug.details\n end", "def imperial\n weight = get_weight(\"pounds\")\n height = get_height(\"inches\")\n\n bmi = \"#{(weight * 703) / (height * height) }\"\n puts \"Your BMI is: #{bmi}\"\n return bmi\nend", "def summary\n comment = @policy.describe(@grades)\n if (comment)\n comment = \" (#{comment})\"\n else\n comment = \"\"\n end\n mygrade = grade\n if mygrade\n mygrade = \"#{mygrade.round(1)}\"\n else\n mygrade = \"[No grades available]\"\n end\n if ((0 == @percent) || (100 == @percent) || (-100 == @percent)) \n dots = @@dots[@type.length + 1 .. -1]\n puts \"#{@type} #{dots}: #{mygrade}#{comment}\"\n else\n dots = @@dots[@type.length + 9 .. -1]\n percentText = \"#{@percent.round(1)}\"\n if (@percent < 10) \n percentText = \" #{percentText}\"\n end\n puts \"#{@type} #{dots} (#{percentText}%): #{mygrade}#{comment}\"\n end\n end", "def breathe\n \"i get oxygen from the water\"\n end", "def modeler_description\n return 'This measure receives the AntiSweat heater Control from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current AntiSweat heater Control of each case and it substitute it with the one chosen by the user.'\n end", "def description\n @beverage.description + \", Mocha\"\n end", "def memer_degree\n\t\tstats = self.stats\n\t\tif stats[:general_stats].values.inject(0,:+) == 0\n\t\t\treturn \"Boring memer\"\n\t\tend\n\t\tnouns = {\n\t\t\t\"replier\" => stats[:general_stats][:comments_count], \n\t\t\t\"memer\" => stats[:general_stats][:memes_count], \n\t\t\t\"reposter\" => stats[:general_stats][:posts_count], \n\t\t\t\"reacter\" => stats[:general_stats][:reactions_count]\n\t\t}\n\t\tadjectives = {swipe_up: \"Wholesome\", swipe_down: \"Normie\", swipe_left: \"Dank\", swipe_right: \"Boring\"}\n\n\t\tuser_noun = nouns.max_by{|k,v| v }[0]\n\t\tuser_adjective = (stats[:general_stats][:reaction_counts])? adjectives[stats[:reactions_stats].max_by{|k,v| v }[0]] : \"Boring\"\n\t\tuser_adjective + \" \" + user_noun\n\tend", "def percent()\n ''\n end", "def modeler_description\n return \"This measure will demonstrate how EMS functions can be used to demonstrate how information from a sizing run can be used to select HVAC equipment from nominal product sizes where unit total capacity is directly related to the unit supply airflow (1 ton = 1200 cfm, 1.5 ton = 1600 cfm, etc.) of commercial packaged single-zone HVAC air systems. This measure is designed to work on AirLoops with packaged DX cooling equipment only. EMS functions will be used to extract the design supply airflow generated from system auto-sizing calculations. An interval variable is used to override the Sizing:System - 'Intermediate Air System Main Supply Volume Flow Rate' value variable. This measure approximates the manner that appropriate ‘real world’ equipment selections are made by HVAC design engineers. The table below will be used to map to the Maximum Flow rate of the packaged unit Fan:ConstantVolume object.\"\n end", "def modeler_description\n return 'This method calculates the annualized coefficient of performance (Btu out / Btu in) of equipment in the model from the annual simulation. This is used in Scout as the equipment efficiency for the technology competition categories.'\n end", "def percent\n self.scan(/./).join('%')\n end", "def description\n return $BlizzABS.util.add_weapon_text(@description, @id, 2)\n end", "def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to model the performance of HVAC equipment that cannot be represented well by using single “standard” performance curve objects (cubic, quadratic, biquadratic, etc.) For example, properly characterizing some HVAC equipment objects requires using different performance curves that cover operation of different parts of the performance regime. This measure will alter (overwrite) the Coil Cooling DX Single Speed Cooling Capacity as a function of temperature performance curve object and attributes used by the simulation if the outdoor air temperature falls below a user defined threshold. This measure allows the user to define the biquadratic curve coefficients associated with the Coil Cooling DX Single Speed Cooling Capacity.\"\n end", "def summary\n return \"#@name [#@num_hands hand(s)] [\\$#{@bankroll.to_s}]\"\n end", "def modeler_description\n return 'This a test measure in relation with https://github.com/NREL/OpenStudio/issues/4156'\n end", "def description\n description = \"\"\n if @monster\n puts \"An evil #{@monster.monster} is here.\"\n else\n puts \"The room is eerily quite.\"\n end\n end", "def discount_display\n if unit == :percent\n \"-#{discount.to_i}%\"\n else\n \"-#{discount.in_euro.to_yuan.display}\"\n end\n end", "def print_beer(beer)\n puts \" \"\n puts \"#{beer.name} has an ABV of \".light_blue + \"#{beer.abv}.\".light_red\n puts \" \"\n puts \"Description: \".light_blue + \"#{beer.description}\".light_yellow\n puts \" \"\n puts \"#{beer.name} pairs well with the following meals: \".light_blue + \"#{beer.meals}.\".light_yellow\n puts \" \"\n puts \"Have an ingredient from one of the meals above? Try using that in your next search!\"\n puts \" \"\n puts \" \"\n end", "def modeler_description\n return \"Change water heater efficiency and fuel type.\"\n end", "def description\n @cafePred.description \n end", "def modeler_description\n return 'This measure is used to calibrate the BRICR baseline model.'\n end", "def carbsPercent()\n\t\t\t\tplato = @alimentsList.head\n\t\t\t\tgrams = @gramsList.head\n\t\t\t\ttotalEnergy = 0.0\n\t\t\t\ttotalCarbsEnergy = 0.0\n\n\t\t\t\twhile plato != nil\n\t\t\t\t\ttotalEnergy += (plato.value.get_energia * grams.value) / 100\n\t\t\t\t\ttotalCarbsEnergy += (plato.value.get_energia_carbs * grams.value) / 100\n\n\t\t\t\t\tplato = plato.next\n\t\t\t\t\tgrams = grams.next\n\t\t\t\tend\n\n\t\t\t\treturn (totalCarbsEnergy * 100) / totalEnergy\n\t\t\tend", "def human\n @human ||= calculate_human\n end", "def test_is_steam_when_above_100()\n result = water_description(120)\n assert_equal(\"steam\",result)\n end", "def info\n \"#{name} is of breed: #{breed}\"\n end", "def describe\n return @magnitude.to_s if magnitude?\n u_descr = Units.units_descr(@units, true)\n \"#{@magnitude} #{u_descr}\"\n end", "def descriptive_text\n description.blank? && taxon ? taxon.descriptive_text : description\n end", "def description\n description = super\n if description.blank?\n if quantity.blank? || measure.blank?\n description\n else\n measure = self.measure.dup\n if quantity == '1'\n measure.slice!(measure.index('(')..-1)\n else\n measure.gsub!(/[()]/, '')\n end\n \"#{quantity} #{measure} #{variety}\".strip\n end\n else\n description\n end\n end", "def modeler_description\r\n return \"This measure imports 8760 chilled water and hot water demand profiles for use in the LoadProfilePlant. The source is a csv file with seven columns titles: timestep, chw_supply_temp_f, chw_flow_frac, chw_load_w, hw_supply_temp_f, hw_flow_frac, hw_load_w.\"\r\n end", "def get_animal_description(input)\n animal = EndangeredAnimals::Scraper.get_animal_information(input)\n\n puts \"\", \" ~* #{animal.name} *~\"\n puts \"-------------------------------------------------------------------\"\n puts \"Scientific Name: #{animal.scientific_name}\"\n puts \"Status: #{animal.status}\"\n puts \"Population: #{animal.population}\"\n puts \"Habitat: #{animal.habitat}\"\n puts \"Places: #{animal.place}\"\n puts \"-----------------\"\n puts \"| Description: |\"\n puts \"-----------------\", \"#{animal.description}\"\n end", "def description\n search_by_itemprop 'description'\n end", "def description_and_dosage\n \t\"#{self.name} #{self.dosage}#{MedicationOrder.human_enum_name(:units, self.unit)} #{MedicationOrder.human_enum_name(:routes, self.route)} #{self.order_frequency.value} #{OrderFrequency.human_enum_name(:units,self.order_frequency.unit)} to #{self.necessity}\"\n end", "def get_a_sample_note\n Card[\"Death Star uses dark side of the Force\"]\nend", "def brief_description\n call_proc_or_return_value(self::BRIEF_DESCRIPTION)\n end", "def get_grasas\n \"#{@grasas}%\" \n end", "def discount_title(scan)\n if scan.product.is_a? BuyXGetXProduct\n \"Buy #{scan.product.num_to_buy} #{scan.product.title.pluralize} Get #{scan.product.num_will_get}\"\n else\n \"#{scan.product.title} Bulk Purchase\"\n end\n end", "def description\n super + \", Milk\"\n end", "def whats_for_dessert\n \"Tonight we have #{dessert_item_count} delicious desserts: #{dessert_format_subcats}.\"\n end", "def modeler_description\n return \"Assume that the starting point technology is primarily 90.1-2013 T8 lighting, with an efficacy of 90 lm/W. According to Table 5.2, LED Efficacy Improvement, in (1), 2015 LED luminaire efficacy is 145 lm/W. Calculate the total lighting power of the model and divide by this initial efficacy to determine the total number of lumens needed. Assuming that this same number of lumens should be provided by LED lighting, divide by the LED efficacy to determine the total wattage of LEDs that would be necessary to achieve the same lighting. Reduce the overall building lighting power by the resulting multiplier. IE new LPD = old LPD * (1 - 90 lm/W /145 lm/W). This is a very crude estimate of the impact of current LED technology. In order to perform a more nuanced analysis, lighting in the prototype buildings should be broken down by use type (general space lighting, task lighting, etc.) and by currently assumed technology (T12, T8, metal halide, etc.). If this breakdown were available, each type of lighting could be modified according to its own efficacy characteristics. Additionally, this measure does not account for the impact of LEDs on outdoor lighting.\"\n end", "def details\n \"sugar: #{@sugar} / butter: #{@butter}\"\n end", "def univ_dvd_rate_str \n count = univ_dvd_rate\n \"#{count} #{'DVD'.pluralize_conditional(count)} per month\" \n end", "def average_text(score)\n case score\n when 0\n 'Not yet rated'\n when 1\n 'Not attractive'\n when 2\n 'Respectable'\n when 3\n 'Decent or Attractive'\n when 4\n 'Girlfriend Material'\n else\n 'Supper Hottie'\n end \n end", "def description\n fetch('restaurant.description')\n end", "def description()\n return \"#{@name} is a #{@color} colored planet, it has #{@moon_count} moons, and it's #{@distance_from_the_sun} from the Sun. It is #{@robots} that there are robots there, and it is #{@cats} that there are cats there.\"\n end", "def hide_rate(text)\n text.gsub(/[\\d\\.%]*/,'').strip\n end", "def modeler_description\n return \"Each DX cooling coil in the model is replaced by a membrane heat pump. To represent the membrane heat pump, the DX cooling coil COP is increased to 7.62 (26 EER). Additionally, add a water use equipment object to account for the 3 gallons of water used per ton*hr of sensible cooling process.\"\n end", "def name \n case type\n when \"percentage\"\n return \"#{@multiplier.round(0)}\\% Off\"\n when \"deduction\"\n return \"£#{@multiplier.round(0)} Off\"\n end\n end", "def details\r\n return @description + \"; \" + @firm + \": \" + \"#{@cost}\"\r\n end", "def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end", "def details\n return @description + \" Extra cost: \" + \"#{@extra_cost}\" + \". \" + @basic_booking.details\n end", "def summary\n Rumoji.decode(description)\n end", "def long_desc\n return @name << \", \" << @desc << \", has the following inventory: \" << @inv.item_list\n end", "def summary\n description.lines.first.thru { |line|\n if line\n line.split( '. ', 2 ).first\n else\n ''\n end\n }\n end", "def rating_display(rating)\n rating = default_class(rating)\n return nil if rating.nil?\n if %w[fa ga fl].include? rating\n return rating\n else\n return rating[0] # use the first letter of the rating as the abbreviated version\n end\n end", "def description; @text; end", "def modeler_description\n return 'This measure receives the power density level from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current power density of each case and it substitute it with the level chosen by the user.'\n end", "def rating_descriptions\n raters.map { |rater| rater.description }\n end", "def details\n return @description + \" extra cost: \" + \"#{@extra_cost}\" + \". \" + @basic_booking.details\n end", "def dealer_markup\n (origin_price*0.08).round\n end" ]
[ "0.6462237", "0.6441269", "0.63953495", "0.6373386", "0.63125324", "0.62942344", "0.62895375", "0.6236919", "0.62263834", "0.6210379", "0.61975354", "0.61975354", "0.61898255", "0.6172515", "0.61663246", "0.6158286", "0.61243033", "0.6109774", "0.61012185", "0.60737103", "0.60284233", "0.6012936", "0.600511", "0.5988493", "0.5980309", "0.5947841", "0.594052", "0.59195", "0.5918022", "0.5916773", "0.59154564", "0.59081376", "0.5893859", "0.5890589", "0.5881946", "0.5877602", "0.5872226", "0.5871491", "0.58674085", "0.5859587", "0.5858675", "0.5853574", "0.58526886", "0.58435017", "0.58428574", "0.5842102", "0.5841685", "0.5834889", "0.58267754", "0.57995236", "0.5788422", "0.578407", "0.5783891", "0.5774233", "0.5771023", "0.5768363", "0.5744638", "0.5726992", "0.5725617", "0.57251054", "0.5723462", "0.57229036", "0.5708603", "0.57069737", "0.5702727", "0.57017475", "0.5694753", "0.56919533", "0.5691135", "0.56870925", "0.56848127", "0.5672005", "0.5665092", "0.56630677", "0.5662865", "0.5661907", "0.5661359", "0.56585896", "0.56558865", "0.5650949", "0.56461746", "0.5645094", "0.5639478", "0.5637528", "0.5635973", "0.56283605", "0.56257206", "0.562405", "0.56156987", "0.5611219", "0.5610803", "0.56086004", "0.56064975", "0.56046414", "0.5599245", "0.5598151", "0.5597007", "0.5585512" ]
0.63752687
5
Add :dirty header to only regenerate this page after :update, :page_is_dirty
def initialize(args = {}) super args load_module end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dirty\n self.headers.first_or_create(:name => :dirty)\n end", "def not_dirty\n self.headers.first(:name => :dirty).destroy\n end", "def dirty?\n return !self.headers.first(:name => :dirty).nil?\n end", "def dirty; end", "def generate\n generate_header\n generate_content\n #not_dirty\n end", "def mark_dirty\n\t\t@dirty = true\n\tend", "def dirty!\n @dirty = true\n end", "def dirty!\n @dirty = true\n end", "def mark_page_as_modified(p)\n @pages.insert(p)\n @pages.flush\n end", "def dirty!\n @dirty = true\n end", "def content_dirty?\n @content_dirty\n end", "def reset_dirty_flag\n\t\t@dirty = false\n\tend", "def mark_modified\n @modified = true\n nil\n end", "def update\n head :no_content\n end", "def update\n head :no_content\n end", "def mark_content_clean\n @content_dirty = false\n end", "def modified?; end", "def update\n @pages_feature = Page.where(site_id: @site.id, published: true, feature_on_homepage: true).all\n @page_root = Page.where(site_id: @site.id).roots.all\n @title = @page.title\n respond_to do |format|\n session[:return_to] ||= request.referer\n if @page.update(page_params)\n format.html { redirect_to session.delete(:return_to), notice: 'Saved' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def render_page(page, format = :html, local_params = {})\n now = Time.now.to_formatted_s(:rfc822)\n response.headers[HTTP_EXPIRES] = now\n response.headers[HTTP_LAST_MODIFIED] = now\n response.headers[HTTP_CACHE_CONTROL] = HTTP_NO_CACHE\n super\n end", "def extra_head_content\n #Deprecation.warn Blacklight::LegacyControllerMethods, \"#extra_head_content is NOT deprecated\"\n @extra_head_content ||= []\n end", "def extra_head_content\n #Deprecation.warn Blacklight::LegacyControllerMethods, \"#extra_head_content is NOT deprecated\"\n @extra_head_content ||= []\n end", "def check_for_changes_affecting_cached_pdfs\n overlap = %w(branching_logic position requirement) & previous_changes.keys\n return if overlap.empty?\n\n design.touch :pdf_cache_busted_at\n end", "def repage\n with_command \"+repage\"\n end", "def is_dirty?\n return true if options[:dirty] == true\n return false\n end", "def update\n @dirty = true\n end", "def set_last_modified_headers\n\t # turned off due to weird FF3 bug\n\t #self.headers['Last-modified'] = @entity[:updated_at].httpdate \n\t end", "def render_fresh_page?\n must_not_cache? || stale?(\n etag: page_etag,\n last_modified: @page.published_at,\n public: [email protected],\n template: \"pages/show\"\n )\n end", "def clear_modification_status\r\n @modified = false\r\n end", "def add_to_history(page); end", "def dirty?\n @dirty == true\n end", "def changed?; not pristine?; end", "def activate\n Page.send :include, PageOptions::PageExtensions\n admin.page.index.add :top, \"caching_header\"\n admin.page.index.add :sitemap_head, 'caching_th', :before => 'status_column_header'\n admin.page.index.add :node, 'caching_td', :before => 'status_column'\n admin.page.edit.add :extended_metadata, 'caching_meta'\n end", "def set_page_keys\n @page_index = @vert_page_index = 0\n @item_pages = Bubs::InfoPages::ITEM_INFO_PAGES.clone\n @equipitem_pages = Bubs::InfoPages::EQUIP_INFO_PAGES.clone\n @item_pages.unshift(:ingredients)\n @equipitem_pages.unshift(:ingredients)\n refresh\n end", "def fill_resource_view_flags\n my_pub = false\n resources.each do |res|\n res.reload\n ca = res.last_curation_activity\n case ca&.status # nil for no status\n when 'withdrawn'\n res.update_columns(meta_view: false, file_view: false)\n when 'embargoed'\n res.update_columns(meta_view: true, file_view: false)\n when 'published'\n res.update_columns(meta_view: true, file_view: true)\n my_pub = true\n end\n end\n\n reload\n\n # don't see if published versions need to be excluded if there are none or if we borked the version history for curators to hide their edits\n return if my_pub == false || borked_file_history?\n\n # walk through the changes and see if no changes between the file_view (published) ones, if so, reset file_view to false\n # because there is nothing of interest to see in this version of no-file changes between published versions\n unchanged = true\n resources.each do |res|\n unchanged &&= res.files_unchanged?(association: 'data_files')\n if res.file_view == true\n res.update_column(:file_view, false) if unchanged\n unchanged = true\n end\n res.update_column(:file_view, false) unless res.current_file_uploads.present?\n end\n end", "def after_update(page)\n expire_cache_for(page)\n end", "def update_page\n if self.page && self.page.reload\n self.page.update_modified(true) unless self.page.is_modified?\n end\n rescue ActiveRecord::RecordNotFound\n nil\n end", "def form_field_changed\n return unless load_edit(\"sm_edit__#{params[:id]}\")\n get_form_vars\n changed = (@edit[:new] != @edit[:current])\n\n render :update do |page|\n page << javascript_prologue\n if changed != session[:changed]\n session[:changed] = changed\n page << javascript_for_miq_button_visibility(changed)\n end\n if @edit[:default_verify_status] != session[:verify_sm_status]\n session[:verify_sm_status] = @edit[:default_verify_status]\n if @edit[:default_verify_status]\n page << \"miqValidateButtons('show', 'default_');\"\n else\n page << \"miqValidateButtons('hide', 'default_');\"\n end\n end\n end\n end", "def dirty?\n false\n end", "def set_export_headers\n response.headers[\"Cache-Control\"] = \"cache, must-revalidate\"\n response.headers[\"Pragma\"] = \"public\"\n end", "def prerender_header_and_footer(options); end", "def freeze_header!\n @fps.freeze\n @codepage_header.freeze\n @codepage_body.freeze\n @rows.freeze\n @cols.freeze\n \n @gsi.dfc.freeze\n @gsi.cpn.freeze\n @gsi.cct.freeze\n @gsi.mnc.freeze\n @gsi.mnr.freeze\n end", "def after_update\n #If trip_report is on the front page then expire the front page trip reports fragment\n if @trip_report.created_at >= TripReport.order('created_at DESC').limit(9)[-1].created_at\n expire_fragment(:controller => 'main', :action => 'index', :part => 'trips_and_albums')\n end\n expire_fragment(:controller => 'main', :action => 'updated', :part => 'trips_and_albums')\n expire_fragment(:controller=>\"trip_reports\", :action=>\"show\", :id => @trip_report, :part => \"description_#{@trip_report.id}\")\n \n after_save()\n end", "def dirty=(_arg0); end", "def modified?\n\t\treturn @dirty ? true : false\n\tend", "def prepend(text, summary = nil, minor = true, bot = true)\n #require login\n @site.login\n result = @site.query_prop_info(@normtitle, nil, 'edit') \n token = result['query']['pages']['page']['edittoken']\n result = @site.edit(@normtitle, nil, text, token, summary, minor, nil, bot, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, text)\n if result.key?('error')\n raise RbmediawikiError, \"#{title}: \"+result['error']['code']\n else\n return true\n end\n end", "def after_update\n return unless respond_to? :expire_fragment #expire_fragment is undefined if controller is nil\n\n #If album is on the front page then expire the front page albums fragment\n if @album.created_at >= Album.order('created_at DESC').limit(9)[-1].created_at\n expire_fragment(:controller => 'main', :action => 'index', :part => 'trips_and_albums')\n end\n expire_fragment(:controller => 'main', :action => 'updated', :part => 'trips_and_albums')\n expire_fragment(:controller=>\"albums\", :action=>\"show\", :id => @album, :part => \"description_#{@album.id}\")\n \n after_save()\n end", "def dirty?\n !!culprit\n end", "def dirty?\n @dirty\n end", "def dirty?\n @dirty\n end", "def dirty?\n @dirty\n end", "def dirty?\n @dirty\n end", "def dirty?\n @dirty || false\n end", "def kopal_layout_after_page_header\n\n end", "def set_pages_flag\n @pages_flag = true\n end", "def acknowledge_item_properties!\r\n self.open_item_page_time = Time.now\r\n end", "def after_save_actions\n reset_cache(['dashboard_header']) # reset caches\n reset_cache('user_mentor') if default_mentor_id_changed?\n end", "def cache_buster\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end", "def update\n @page = Page.find(params[:id])\n\n # Update the last user that updated the content\n @page.content.user = current_user if logged_in?\n @page.content.published = true if params[:commit] == \"Publish\"\n @page.tag_list.add(params[:tags_to_apply], :parse => true)\n\t\n respond_to do |format|\n if @page.update_attributes(params[:page]) && @page.content.update_attributes(params[:content])\n notify :notice, 'Page was successfully updated.'\n \n format.html { redirect_to(@page) }\n format.xml { head :ok }\n format.js\n else\n\t\t notify :error, \"There was an error updating the page.\"\n\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def before_update\n mark_site_modified if changed_columns.include?(:slug)\n super\n end", "def before_filter_check_on_hash(hsh, nm)\n if hsh.has_key?(:content)\n cont = hsh.delete(:content)\n temp_file = \"#{base_dir}/templates/default/#{nm}.erb\"\n ::FileUtils.mkdir_p(::File.dirname(temp_file)) unless ::File.directory? temp_file\n ::File.open(temp_file, \"w+\") {|f| f.print cont }\n hsh.merge!({:source => \"#{nm}.erb\"})\n end\n # \n hsh.delete(:require) if hsh.has_key?(:require)\n hsh\n end", "def test_content_cached_on_save\n page = new_page()\n page.content = 'This is a test'\n # No content yet\n assert_nil page.content_cache\n page.save\n # Saving triggers HTML generation\n assert_not_nil page.content_cache\n end", "def set_cache_buster\n \n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n\n end", "def after_save\r\n self.blockable.touch if self.blockable_type == 'Page'\r\n end", "def set_cache_buster\n\t\t response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n\t\t response.headers[\"Pragma\"] = \"no-cache\"\n\t\t response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n\tend", "def stamp_field_changed\n return unless load_edit(\"stamp_edit__#{params[:id]}\", \"show\")\n\n assert_privileges(\"miq_request_approval\")\n @edit[:reason] = params[:reason] if params[:reason]\n render :update do |page|\n page << javascript_prologue\n page << javascript_for_miq_button_visibility(@edit[:reason].present?)\n end\n end", "def kopal_layout_before_page_header\n\n end", "def dirty?\n !!@dirty\n end", "def set_cache_buster\n\t response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n\t response.headers[\"Pragma\"] = \"no-cache\"\n\t response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end", "def page_updates\n @page_updates ||= []\n end", "def kopal_layout_before_page_meta\n\n end", "def set_cache_buster\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end", "def render_with_trigger_refresh(*options, &myblock)\n\t\tdoing_update = options.detect {|x| x==:update || (x.is_a?(Hash) && x[:update])}\n\t\tif !doing_update\n\t\t render_without_trigger_refresh(*options, &myblock)\n\t\telse\n\t\t # For repository partial\n\t\t render_without_trigger_refresh *options do |page|\n\t\t\tyield page\n\t\t\tif (@repository ||= @project.repository) && (@repository.is_a?(Repository::Git))\n\t\t\t page.replace_html \"tab-content-repository\", :partial => 'projects/settings/repository'\n\t\t\tend\n\t\t end\n\t\tend\n\t end", "def update\n @setting.value = [email protected]\n\n @setting.save\n head 200, content_type: \"text/html\"\n end", "def update\n expire_page :action => :show\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_cache_buster\n headers[\"Pragma\"] = \"no-cache\"\n headers[\"Cache-Control\"] = \"must-revalidate\" \n headers[\"Cache-Control\"] = \"no-cache\" \n headers[\"Cache-Control\"] = \"no-store\" \n end", "def header_editor_enabled=(_arg0); end", "def set_private\n response.headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'\n end", "def mark_clean\n @dirty = false\n end", "def before_update_rewrite_suggestion_handler\n generate_valid_rewrite\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to([:admin, @page], notice: 'Page was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated page: #{@page.title}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def modified_existing?\n false\n end", "def acknowledge_item_properties!\n self.open_item_page_time = Time.now\n end", "def update_paid_date\n @order = Order.find(params[:order_id])\n @order.paid_at = Time.now\n @order.save\n render(:update => true, :layout => false) do |page| \n page.replace_html \"paid_at_#{@order.id}\", \"#{@order.paid_at.strftime('%m/%d/%y')}\"\n end\n end", "def edit\n # Clear the page cache for this page... ?\n @page = ComatosePage.find params[:id]\n @root_pages = [fetch_root_page].flatten\n if request.post?\n @page.update_attributes(params[:page])\n @page.updated_on = Time.now\n @page.author = fetch_author_name\n if @page.save\n expire_cms_page @page\n expire_cms_fragment @page\n flash[:notice] = \"Saved changes to '#{@page.title}'\"\n redirect_to :controller=>self.controller_name, :action=>'index'\n end\n end\n end", "def update_page_on_show(page)\n if wants_refresh?\n page.update_frame_for(object)\n else\n page.push_frame_for(object)\n end\n end", "def render_after_update\n redirect_back_or_default(after_update_path)\n end", "def set_cache_buster\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end", "def set_cache_buster\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end", "def set_cache_buster\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end", "def set_cache_buster\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end", "def todo_reset\n @generated_todo = false\n @downloaded_a_page = false\n end", "def render_umlaut_head_content\n render_opensearch_link + render_meta_refresh\n end", "def appctrl_do_not_cache\n response.headers[ 'Pragma' ] = 'no-cache'\n response.headers[ 'Cache-Control' ] = 'no-cache, no-store, max-age=0, must-revalidate'\n response.headers[ 'Expires' ] = 'Fri, 01 Jan 1990 00:00:00 GMT'\n end", "def render_with_trigger_refresh(*options, &myblock)\n doing_update = options.detect {|x| x==:update || (x.is_a?(Hash) && x[:update])}\n if !doing_update\n render_without_trigger_refresh(*options, &myblock)\n else\n # For repository partial\n render_without_trigger_refresh *options do |page|\n yield page\n if (@repository ||= @project.repository) && (@repository.is_a?(Repository::Git))\n page.replace_html \"tab-content-repository\", :partial => 'projects/settings/repository'\n end\n end\n end\n end", "def header; end", "def header; end", "def header; end", "def set_cache_buster\n response.headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'\n response.headers['Pragma'] = 'no-cache'\n response.headers['Expires'] = 'Fri, 01 Jan 1990 00:00:00 GMT'\n end", "def header_editor_enabled; end", "def set_cache_buster\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end", "def delete_dirty?\n false\n end" ]
[ "0.6809865", "0.64503604", "0.6274907", "0.6079029", "0.5994897", "0.5992384", "0.58762354", "0.58762354", "0.5804008", "0.5747538", "0.5706043", "0.5515261", "0.54522103", "0.54360807", "0.54360807", "0.53960854", "0.537391", "0.5361784", "0.5338269", "0.53277785", "0.53277785", "0.5277699", "0.5242156", "0.5239584", "0.52359504", "0.5231976", "0.5230609", "0.52181995", "0.5209341", "0.5206545", "0.51682776", "0.515849", "0.5142021", "0.5127525", "0.5126922", "0.50692797", "0.50635046", "0.5056118", "0.50460327", "0.5045142", "0.50402284", "0.5040074", "0.5037743", "0.50285", "0.50161445", "0.50072426", "0.5003014", "0.4985412", "0.4985412", "0.4985412", "0.4985412", "0.49773425", "0.49603692", "0.49597856", "0.49539995", "0.4943412", "0.49425483", "0.49406558", "0.49402475", "0.49384725", "0.49169365", "0.49135187", "0.49099916", "0.4892516", "0.48922062", "0.4888857", "0.4888524", "0.4884577", "0.4882754", "0.48782495", "0.48734957", "0.48710033", "0.48680526", "0.48641005", "0.4864013", "0.48463434", "0.48438367", "0.4829473", "0.4828635", "0.4828534", "0.48260874", "0.48243016", "0.48223692", "0.48194927", "0.48173043", "0.48146525", "0.48126313", "0.48126313", "0.48126313", "0.48126134", "0.48051602", "0.48000932", "0.47939408", "0.47928327", "0.47907394", "0.47907394", "0.47907394", "0.47902414", "0.47893512", "0.47845986", "0.47820163" ]
0.0
-1
GET /sf_cases GET /sf_cases.json
def index @sf_cases = SFCase.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t# get the current surgeon of the all case details\n\t\tcases = current_user.cases.order_by(:schedule_date=> :asc).collect{|surgery_case| surgery_case if (surgery_case.schedule.schedule_date.to_date.past? || surgery_case.schedule.schedule_date.to_date.today?)}.reject(&:blank?).take(10)\n\t\tif cases.present?\n\t render json: { success: true, response: cases.map{ |f| CaseSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Cases are not present\" },:status=> 203\n\t end \n\tend", "def index\n render jsonapi: Seances::UseCases::FetchAll.new.call\n end", "def index\n\t\tif @cases.present?\n \t\trender json: { success: true, response: @cases.as_json(\"case_media\") },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"Cases are not present\" },:status=> 203\n\t end\n\tend", "def index\n @support_cases = SupportCase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @support_cases }\n end\n end", "def index\n if params[:problems].blank?\n @cases = Case.all\n else\n @cases = Case.as(:c).where('c.stock <= 1').pluck(:c)\n @cases.map!{|c| {\n id: c.id,\n name: c.name,\n stock: c.stock\n }}\n\n @cases.sort_by! {:name}\n\n render json: @cases\n end\n end", "def index\n @cases = Case.all\n end", "def index\n @cases = Case.all\n end", "def index\n if current_user.district_id and !current_user.admin?\n @cases = Case.where(\"district_id = #{current_user.district_id}\").order(\"id desc\").page params[:page]\n else\n # @cases = Case.all\n @cases = Case.order(\"id desc\").page params[:page]\n end\n # @cases = Case.order(\"id desc\").page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cases }\n end\n end", "def index\n @vf_cases = VfCase.all\n end", "def show\n\t\tif @case.present?\n \t\t# response to the JSON\n \trender json: { success: true, response: @case.as_json(\"case_show\") },:status=>200\n\t return\n\t else\n\t render :json=> { success: false, message: \"Case is not available\" },:status=> 404\n\t return\n\t end \n\tend", "def show\n @clientcase = Clientcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @clientcase }\n end\n end", "def show\n @use_case = UseCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @use_case }\n end\n end", "def show\n @use_case = UseCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @use_case }\n end\n end", "def index\n @cases = Case.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cases }\n end\n end", "def index\n @use_case_groups = @project.use_case_groups\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @use_cases }\n end\n end", "def index\n @code_cases = CodeCase.all\n end", "def show\n @case_entry = CaseEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_entry }\n end\n end", "def index\n @support_cases = SupportCase.all\n end", "def index\n @line_cases = LineCase.all\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\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 case_listing\n @cases = @patient.cases.all.order('created_at ASC')\n end", "def cases\n return suite.cases(data.id)\n end", "def cases; Case.get(self.cases_id); end", "def index\n @design_cases = DesignCase.all\n @code_cases = CodeCase.all\n end", "def show\n @spatial_coverage = SpatialCoverage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spatial_coverage }\n end\n end", "def index\n @case_tests = CaseTest.all\n end", "def index\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_cases = @test_suite.test_cases\n end", "def show\n @coverage = Coverage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coverage }\n end\n end", "def index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\n end", "def show\n @federal1870_census_entry = Federal1870CensusEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @federal1870_census_entry }\n end\n end", "def find_case\n\t\t# Find the case \n\t\t@case = Case.where(id:params[:case_id])[0]\n\t\trender json: {success: false, message: 'Invalid Case ID !'}, status: 400 if @case.nil?\n\tend", "def show\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @testcase }\n end\n end", "def show\n @use_case = UseCase.find(params[:id])\n\n respond_to do |format|\n format.html do \n render layout: 'outside'\n end\n format.json { render json: @use_case }\n end\n end", "def index\n @case_studies = CaseStudy.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @case_studies }\n end\n end", "def show\n render json: Seances::UseCases::AvailableSeats.new.call(id: params[:id])\n end", "def show\n @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinicalsection }\n end\n end", "def get_cases_by_title_number(title_no)\n\n response = rest_get_call($CASES_URL + '/cases/property/' + title_no)\n\n return response.body\n\nend", "def case(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get(\"cases/#{id}\",options)\n response.case\n end", "def find_case\n\t\t\t# Finding the particular case\n\t\t\t@case = Case.where( id: params[:id])[0]\n\t\t\tif @case.nil?\n\t render :json=> { success: false, message: \"Case is not available\" },:status=> 404\n\t return\n\t end\n\t\tend", "def index\n @disbursments = @case.disbursments\n end", "def show\n @ci = Ci.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ci }\n end\n end", "def case_list\n\t\t# listing the all the schedule cases with surgeon with ascending schedule date\n\t\t@cases = current_user.cases.order_by(:schedule_date=> :asc).collect{|surgery_case| surgery_case if surgery_case.schedule.schedule_date.to_date.future? || surgery_case.schedule.schedule_date.to_date.today?}.compact\n\tend", "def show\n @project = Project.find(params[:id])\n @tcs = @project.test_cases.where(\"status != 'deleted'\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @project }\n end\n end", "def show\n @county = County.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @county }\n end\n end", "def index\n @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end", "def show\n @case = Case.find(params[:id])\n if current_user.district_id and !current_user.admin? and @case.district_id != current_user.district_id\n redirect_to cases_path\n else\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case }\n end\n end\n end", "def index\n\t\t@cases = current_user.present? && current_user.admin? ? Case.all : Case.approved_cases\n\tend", "def show\n @run = Run.find(params[:id])\n @run.calculate_percents\n @rcs = @run.run_cases.all\n @rcs.each { |r| r.calculate_percents }\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @run }\n end\n end", "def show\n @cys_env = CysEnv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cys_env }\n end\n end", "def show_cities\n\n @cities = City.where(\"country_id = ?\", params[:country_id])\n\n render json: @cities\n \n end", "def case_list\n\t\t# listing the all the schedule cases with surgeon with ascending schedule date\n\t\t@cases = current_user.cases.order_by(:schedule_date=> :asc)\n\tend", "def show\n\t\trecords = University.where(['name LIKE ?', \"#{params[:name]}%\"])\n\t\tschools = Array.new\n\n\t\trecords.each do |record|\n\t\t\tcents_rating = RatesSchool.find_by_sql [\n\t\t\t\t'SELECT avg(rating) AS average\n\t\t\t\tFROM rates_schools\n\t\t\t\tWHERE university_id = ?',\n\t\t\t\trecord.id\n\t\t\t]\n\t\t\trecord = record.as_json\n\t\t\trecord[:average_rating] = cents_rating[0][:average].to_f\n\t\t\tschools << record.except('id', 'created_at', 'updated_at')\n\t\tend\n\n\t\tif schools.present?\n\t\t\treturn render json: schools, status: 200\n\t\telse\n\t\t\treturn render json: [], status: 404\n\t\tend\n\tend", "def show\n @sectioneight_form = SectioneightForm.find(params[:id])\n @states = State.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sectioneight_form }\n end\n end", "def show\n \t@case = Case.find(params[:id])\n end", "def index\n @computer_cases = ComputerCase.all\n end", "def show\n @stage_fecundity = StageFecundity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stage_fecundity }\n end\n end", "def show\n render json: @inciting_incident\n end", "def index\n @zones = Zone.all\n\n render json: @zones\n end", "def index\n @faculties = Faculty.all\n json_response(@faculties)\n end", "def index\n @contests = Contest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end", "def index\n #using kaminari for pagination\n #@use_cases = UseCase.order(:id).page(params[:page]).per(5)\n\n #search\n if params[:search]\n key = \"%#{params[:search]}%\"\n @use_cases = UseCase.where( 'use_case_no LIKE :search OR client_name LIKE :search', search: key).page(params[:page]).per(5)\n else\n @use_cases = UseCase.all.page(params[:page]).per(5)\n end\n\n #dataTable stuffs, unused.\n respond_to do |format|\n format.html\n format.json { render json: UseCaseDatatable.new(params) }\n end\n end", "def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end", "def index\n @answer_cases = AnswerCase.all\n end", "def case_search\n\t # Search cases according to the keyword\n\t cases = case_list(params[:searchterm])\n create_recent_search(params[:searchterm])\n # check condition for case is present or not.\n if cases.present?\n # response to the JSON\n render json: { success: true, response: cases.as_json('search')},:status=>200\n else\n render :json=> { success: false, message: \"Case is not present.\" },:status=> 203\n end\n \tend", "def index\n @zones = Zone.all\n render json: @zones\n #@zones\n end", "def get_results\n case_id = params[:case_id]\n lab_external_id = params[:lab_id]\n consumer_id = get_consumer_id()\n lab = Lab.find_by(lab_external_id: lab_external_id, api_consumer_id: consumer_id)\n lab_id = lab.id.to_s\n tmp_file = File.join('Data/tmp/', lab_id, case_id + '.json')\n data = File.read(tmp_file)\n send_data(data,\n disposition: 'inline',\n type: 'application/json')\n\n File.delete(tmp_file)\n end", "def get_substrates()\n\tputs \"Getting list of substrates.\"\n\tresponse = request_get('/api/partner/substrate')\n\tputs response.body\nend", "def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def index\n\n @critical_success_factors = CriticalSuccessFactor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @critical_success_factors }\n end\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def index\n @scheduled_facilities = ScheduledFacility.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scheduled_facilities }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n end", "def index\n @cys_envs = CysEnv.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cys_envs }\n end\n end", "def index\n @states = State.all\n \n render json: @states\n end", "def current_cases\n p @current_cases\n end", "def show\n @scaff = Scaff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scaff }\n end\n end", "def show\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_case = @test_suite.test_cases.find(params[:id])\n end", "def index\n @case_studies = CaseStudy.all\n end", "def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end", "def index\n @casedeals = Casedeal.all\n end", "def index\n \n @evaluation = Evaluation.find_by(user_id: params[:user_id], study_case_id: params[:study_case_id])\n\n if @evaluation.present?\n render :show\n else\n render json: nil\n end\n \n end", "def index\n @facilities = Facility.all\n respond_with @facilities\n end", "def show\n @success_case = SuccessCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @success_case }\n end\n end", "def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end", "def index\n @critical_factors = CriticalFactor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @critical_factors }\n end\n end", "def show\n @incident_kind = IncidentKind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident_kind }\n end\n end", "def index\n add_breadcrumb I18n.t(:cases_supports), :case_supports_path\n options = Hash.new\n options[:status_type] = params[:status_type]\n options[:show_case] = params[:show_case]\n options[:case_id] = params[:case_id]\n options[:appointment_id] = params[:appointment_id]\n if params[:case_id]\n @case = Case.find params[:case_id]\n end\n if params[:appointment_id]\n @appointment = Appointment.find params[:appointment_id]\n end\n options[:appointment_id] = params[:appointment_id]\n respond_to do |format|\n format.html{ }\n format.js{ render 'application/index' }\n format.pdf{}\n format.csv{\n options[:show_case] = 'true'\n params[:length] = 500\n json = CaseSupportDatatable.new(view_context, options).as_json\n send_data CaseSupport.to_csv(json[:data]), filename: \"CaseSupports-#{Date.today}.csv\"\n }\n format.json{\n render json: CaseSupportDatatable.new(view_context,options)\n }\n end\n end", "def index\n @caseworklines = Caseworkline.all\n end", "def index\n @casefiles = Casefile.all\n end", "def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end", "def situations_arrivals_countries_three\n @situations_arrivals_countries = SituationsArrivalsCountry.where(status:true, id: [1,2,3]).order('name ASC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @situations_arrivals_countries}\n end\n end", "def show\n render json: @given_circumstance\n end", "def index\n @success_cases = SuccessCase.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @success_cases }\n end\n end", "def index\n respond_to do |format|\n format.html{}\n format.pdf{\n scope = Case\n scope = case params[:status_type]\n when 'all' then scope.all_data\n when 'opened' then scope.opened\n when 'closed' then scope.closed\n when 'flagged' then scope.flagged\n else\n scope.opened\n end\n scope = scope.include_enumerations\n scope = if User.current.can?(:manage_roles)\n scope.where(assigned_to_id: User.current)\n else\n scope.visible\n end\n @cases = scope\n }\n format.csv{ params[:length] = 500\n options = Hash.new\n options[:status_type] = params[:status_type]\n json = CaseDatatable.new(view_context, options).as_json\n send_data Case.to_csv(json[:data]), filename: \"case-#{Date.today}.csv\"\n }\n format.json{\n options = Hash.new\n options[:subcases] = false\n options[:status_type] = params[:status_type]\n render json: CaseDatatable.new(view_context,options)\n }\n end\n end", "def index\n @counties = Entity.where(entity_type: 'County').order(:entity_name)\n respond_with(@counties)\n end", "def index\n @cities = City.where(state_id: params[:id])\n respond_to do |format|\n format.json { render :json => @cities.to_json }\n end\n end", "def show\n @critical_success_factor = CriticalSuccessFactor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_success_factor }\n end\n end", "def show\n @scenario = Scenario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scenario }\n end\n end" ]
[ "0.715896", "0.69107765", "0.6797807", "0.6761355", "0.657797", "0.65129423", "0.65129423", "0.6412592", "0.63628095", "0.6210903", "0.61823046", "0.61806405", "0.61806405", "0.6171995", "0.6159974", "0.6093763", "0.6049241", "0.60326046", "0.6031662", "0.5975629", "0.59545135", "0.59173745", "0.589416", "0.5885719", "0.5881554", "0.5868881", "0.58480674", "0.5808369", "0.5807952", "0.580601", "0.57875127", "0.5768421", "0.57641923", "0.5763702", "0.5751168", "0.5747119", "0.5744192", "0.5727882", "0.57224756", "0.57071924", "0.5656995", "0.56559634", "0.56554854", "0.56320727", "0.56319773", "0.5620338", "0.56161386", "0.56159073", "0.56113666", "0.5605692", "0.5604185", "0.55946785", "0.55906445", "0.5582303", "0.5579646", "0.5556711", "0.555647", "0.55407786", "0.55351186", "0.5534178", "0.5530499", "0.55202186", "0.5514082", "0.55128163", "0.5507847", "0.5506152", "0.55021626", "0.5501442", "0.5499632", "0.54971904", "0.5488621", "0.5482634", "0.5482147", "0.5478115", "0.5468546", "0.54666835", "0.54645556", "0.54485846", "0.544156", "0.54410875", "0.5440376", "0.5436066", "0.5432682", "0.5431818", "0.543024", "0.5430236", "0.54283875", "0.5425516", "0.542475", "0.5421799", "0.54160446", "0.54119575", "0.5407143", "0.53995496", "0.5397626", "0.5397202", "0.5397083", "0.5394626", "0.53926694", "0.53861666" ]
0.72299254
0
GET /sf_cases/1 GET /sf_cases/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t# get the current surgeon of the all case details\n\t\tcases = current_user.cases.order_by(:schedule_date=> :asc).collect{|surgery_case| surgery_case if (surgery_case.schedule.schedule_date.to_date.past? || surgery_case.schedule.schedule_date.to_date.today?)}.reject(&:blank?).take(10)\n\t\tif cases.present?\n\t render json: { success: true, response: cases.map{ |f| CaseSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Cases are not present\" },:status=> 203\n\t end \n\tend", "def index\n @sf_cases = SFCase.all\n end", "def index\n render jsonapi: Seances::UseCases::FetchAll.new.call\n end", "def index\n @support_cases = SupportCase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @support_cases }\n end\n end", "def show\n @clientcase = Clientcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @clientcase }\n end\n end", "def index\n\t\tif @cases.present?\n \t\trender json: { success: true, response: @cases.as_json(\"case_media\") },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"Cases are not present\" },:status=> 203\n\t end\n\tend", "def show\n @use_case = UseCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @use_case }\n end\n end", "def show\n @use_case = UseCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @use_case }\n end\n end", "def index\n if params[:problems].blank?\n @cases = Case.all\n else\n @cases = Case.as(:c).where('c.stock <= 1').pluck(:c)\n @cases.map!{|c| {\n id: c.id,\n name: c.name,\n stock: c.stock\n }}\n\n @cases.sort_by! {:name}\n\n render json: @cases\n end\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 show\n @case_entry = CaseEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_entry }\n end\n end", "def index\n if current_user.district_id and !current_user.admin?\n @cases = Case.where(\"district_id = #{current_user.district_id}\").order(\"id desc\").page params[:page]\n else\n # @cases = Case.all\n @cases = Case.order(\"id desc\").page params[:page]\n end\n # @cases = Case.order(\"id desc\").page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cases }\n end\n end", "def index\n @cases = Case.all\n end", "def index\n @cases = Case.all\n end", "def show\n\t\tif @case.present?\n \t\t# response to the JSON\n \trender json: { success: true, response: @case.as_json(\"case_show\") },:status=>200\n\t return\n\t else\n\t render :json=> { success: false, message: \"Case is not available\" },:status=> 404\n\t return\n\t end \n\tend", "def show\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @testcase }\n end\n end", "def show\n @coverage = Coverage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coverage }\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def show\n @spatial_coverage = SpatialCoverage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spatial_coverage }\n end\n end", "def find_case\n\t\t# Find the case \n\t\t@case = Case.where(id:params[:case_id])[0]\n\t\trender json: {success: false, message: 'Invalid Case ID !'}, status: 400 if @case.nil?\n\tend", "def get_cases_by_title_number(title_no)\n\n response = rest_get_call($CASES_URL + '/cases/property/' + title_no)\n\n return response.body\n\nend", "def show\n @ci = Ci.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ci }\n end\n end", "def show\n @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinicalsection }\n end\n end", "def index\n @vf_cases = VfCase.all\n end", "def show\n @federal1870_census_entry = Federal1870CensusEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @federal1870_census_entry }\n end\n end", "def index\n @cases = Case.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cases }\n end\n end", "def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end", "def show\n @county = County.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @county }\n end\n end", "def find_case\n\t\t\t# Finding the particular case\n\t\t\t@case = Case.where( id: params[:id])[0]\n\t\t\tif @case.nil?\n\t render :json=> { success: false, message: \"Case is not available\" },:status=> 404\n\t return\n\t end\n\t\tend", "def show\n @use_case = UseCase.find(params[:id])\n\n respond_to do |format|\n format.html do \n render layout: 'outside'\n end\n format.json { render json: @use_case }\n end\n end", "def show\n \t@case = Case.find(params[:id])\n end", "def index\n @use_case_groups = @project.use_case_groups\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @use_cases }\n end\n end", "def case(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get(\"cases/#{id}\",options)\n response.case\n end", "def show\n @cys_env = CysEnv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cys_env }\n end\n end", "def index\n @line_cases = LineCase.all\n end", "def cases; Case.get(self.cases_id); end", "def show\n @case = Case.find(params[:id])\n if current_user.district_id and !current_user.admin? and @case.district_id != current_user.district_id\n redirect_to cases_path\n else\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case }\n end\n end\n end", "def index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\n end", "def show\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 case_listing\n @cases = @patient.cases.all.order('created_at ASC')\n end", "def show\n @incident_kind = IncidentKind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident_kind }\n end\n end", "def show\n headers['Access-Control-Allow-Origin'] = \"*\"\n\n if params[:id]=='0'\n sql=%Q{select * from clavis.issue where manifestation_id=#{params[:manifestation_id]} and start_number notnull order by issue_id desc limit 1;}\n # logger.warn(sql)\n # @clavis_issue = ClavisIssue.all(:order=>'issue_id desc',:limit=>1,:conditions=>{:manifestation_id=>params[:manifestation_id],:start_number=>params[:start_number]})\n @clavis_issue = ClavisIssue.find_by_sql(sql)\n @clavis_issue = @clavis_issue.first if @clavis_issue!=[]\n else\n @clavis_issue = ClavisIssue.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @clavis_issue }\n end\n end", "def show\n @scenario = Scenario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scenario }\n end\n end", "def show\n @project = Project.find(params[:id])\n @tcs = @project.test_cases.where(\"status != 'deleted'\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @project }\n end\n end", "def index\n @case_studies = CaseStudy.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @case_studies }\n end\n end", "def show\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine }\n end\n end", "def show\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine }\n end\n end", "def index\n @code_cases = CodeCase.all\n end", "def show\n @routine_interview = RoutineInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine_interview }\n end\n end", "def show\n @scaff = Scaff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scaff }\n end\n end", "def show\n render json: Seances::UseCases::AvailableSeats.new.call(id: params[:id])\n end", "def show\n @success_case = SuccessCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @success_case }\n end\n end", "def show\n render json: @inciting_incident\n end", "def show\n @stage_fecundity = StageFecundity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stage_fecundity }\n end\n end", "def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end", "def index\n @support_cases = SupportCase.all\n end", "def show\n @assessment_insti_test = AssessmentInstiTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@assessment_insti_test }\n end\n end", "def show\n @clinic_timing = ClinicTiming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinic_timing }\n end\n end", "def show\n @clinician = Clinician.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinician }\n end\n end", "def show\n @patentcase = Patentcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @patentcase }\n end\n end", "def show\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident }\n end\n end", "def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end", "def show\n @test_summary = TestSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_summary }\n end\n end", "def show\n @sprint = Sprint.find(params[:id])\n @stat = Status.find(4)\n @stories = Story.where(\"status_id = ?\", @stat.id)\n @examples = @sprint.stories \n @project_id = @examples.first.project_id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprint }\n end\n end", "def show\n @scenario = Scenario.find(params[:scenario_id])\n @result = @scenario.results.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result }\n end\n end", "def index\n @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end", "def show\n \t\n @json_data = Cause.find(params[:id])\n render_json\n end", "def show\n @cds_structure = CdsStructure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cds_structure }\n end\n end", "def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end", "def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end", "def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end", "def show\n @critical_success_factor = CriticalSuccessFactor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_success_factor }\n end\n end", "def show\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n\n\n format.json { render json: @socioeconomic_study }\n end\n end", "def new\n @clientcase = Clientcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @clientcase }\n end\n end", "def index\n @design_cases = DesignCase.all\n @code_cases = CodeCase.all\n end", "def situations_arrivals_countries_three\n @situations_arrivals_countries = SituationsArrivalsCountry.where(status:true, id: [1,2,3]).order('name ASC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @situations_arrivals_countries}\n end\n end", "def show\n @run = Run.find(params[:id])\n @run.calculate_percents\n @rcs = @run.run_cases.all\n @rcs.each { |r| r.calculate_percents }\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @run }\n end\n end", "def show\n @critical_factor = CriticalFactor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_factor }\n end\n end", "def get_results\n case_id = params[:case_id]\n lab_external_id = params[:lab_id]\n consumer_id = get_consumer_id()\n lab = Lab.find_by(lab_external_id: lab_external_id, api_consumer_id: consumer_id)\n lab_id = lab.id.to_s\n tmp_file = File.join('Data/tmp/', lab_id, case_id + '.json')\n data = File.read(tmp_file)\n send_data(data,\n disposition: 'inline',\n type: 'application/json')\n\n File.delete(tmp_file)\n end", "def index\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_cases = @test_suite.test_cases\n end", "def show\n @substrate = Substrate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @substrate }\n end\n end", "def show\n @sectioneight_form = SectioneightForm.find(params[:id])\n @states = State.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sectioneight_form }\n end\n end", "def show_cities\n\n @cities = City.where(\"country_id = ?\", params[:country_id])\n\n render json: @cities\n \n end", "def show\n render status: 200, json: Training.find(params[:id])\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def show\n @study = Study.find(params[:id])\n render json: @study\n end", "def show\n render json: @given_circumstance\n end", "def show\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_case = @test_suite.test_cases.find(params[:id])\n end", "def new\n @case_study = CaseStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case_study }\n end\n end", "def new\n @case_study = CaseStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case_study }\n end\n end", "def show\n @discipline = Discipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discipline }\n end\n end", "def show\n @zone_status = ZoneStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zone_status }\n end\n end", "def show\n @case = Case.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @case }\n end\n end", "def show\n @squishee_cup = SquisheeCup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @squishee_cup }\n end\n end", "def show\n @civil_status = CivilStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @civil_status }\n end\n end", "def get_student\n @student = Student.find(params[:std_id])\n render json: @student\n end", "def show\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_assessment }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n end", "def index\n @cities = City.where(state_id: params[:id])\n respond_to do |format|\n format.json { render :json => @cities.to_json }\n end\n end", "def index\n \n @evaluation = Evaluation.find_by(user_id: params[:user_id], study_case_id: params[:study_case_id])\n\n if @evaluation.present?\n render :show\n else\n render json: nil\n end\n \n end", "def index\n @case_tests = CaseTest.all\n end" ]
[ "0.6922507", "0.68706536", "0.67165285", "0.662248", "0.656913", "0.6553731", "0.6504053", "0.6504053", "0.6438967", "0.6431048", "0.641304", "0.6373067", "0.6326853", "0.6326853", "0.62571526", "0.6208362", "0.61903924", "0.6170537", "0.61690533", "0.61580616", "0.6157325", "0.6142583", "0.6108991", "0.60725623", "0.6055828", "0.6054122", "0.6033436", "0.6027236", "0.60190344", "0.5983538", "0.59774035", "0.5957409", "0.5956113", "0.5942248", "0.59409624", "0.5911159", "0.5872356", "0.58528227", "0.58518887", "0.58502394", "0.5846388", "0.58419985", "0.58418125", "0.58307225", "0.5823248", "0.58205783", "0.58205783", "0.58191335", "0.5816433", "0.5814086", "0.57946664", "0.5793563", "0.5784881", "0.5773521", "0.5772097", "0.5765812", "0.57645506", "0.57531226", "0.5752454", "0.5749859", "0.5748701", "0.57437736", "0.57433903", "0.57432055", "0.57352376", "0.5729126", "0.5728751", "0.5714006", "0.571153", "0.57056993", "0.57056993", "0.56951946", "0.56917775", "0.56850773", "0.5684035", "0.56689245", "0.56686854", "0.56659544", "0.56549364", "0.5652861", "0.56521434", "0.565075", "0.5643917", "0.5639431", "0.56390494", "0.5635972", "0.5635874", "0.5634378", "0.5631901", "0.5631901", "0.56303966", "0.56285083", "0.562827", "0.5627325", "0.56187814", "0.5616971", "0.5613983", "0.56127864", "0.56102574", "0.5608796", "0.56060857" ]
0.0
-1
POST /sf_cases POST /sf_cases.json
def create @sf_case = SFCase.create(sf_case_params.to_h.symbolize_keys) respond_to do |format| if @sf_case.sf_valid? set_success_flash_message("Case was successfully created.") format.html { redirect_to @sf_case} format.json { render :show, status: :created, location: @sf_case.Id } else set_flash_error_message format.html { render :new } format.json { render json: @sf_case.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to cases_path, notice: 'Case was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cases_path }\n else\n format.html { render action: 'new' }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t# creating the cases with particular surgeon\n\t\tsurgery_case = current_user.cases.create(case_params)\n\t\t# Updating the patient to the particular case\n\t\tsurgery_case.update_attributes(patient_id: params[:patient_id])\n\t\t# redirect to the case index page\n\t\tif surgery_case.present?\n \t# response to the JSON\n\t \trender json: { success: true,message: \"Case Successfully Created.\", response: CaseSerializer.new(surgery_case).as_json(root: false) },:status=>200\n\t else\n\t render :json=> { success: false, message: surgery_case.errors },:status=> 203\n\t end\n\tend", "def create\n @case_test = CaseTest.new(case_test_params)\n\n respond_to do |format|\n if @case_test.save\n format.html { redirect_to @case_test, notice: 'Case test was successfully created.' }\n format.json { render :show, status: :created, location: @case_test }\n else\n format.html { render :new }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to @case, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to @case, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @seance = Seances::UseCases::Create.new.call(params: seance_params)\n\n if @seance.valid?\n render jsonapi: @seance, status: :created\n else\n render jsonapi_errors: @seance.errors, status: :unprocessable_entity\n end\n end", "def create\n @study_case = StudyCase.new(study_case_params)\n\n if @study_case.save\n render :show, status: :created\n else\n render json: @study_case.errors, status: :unprocessable_entity\n end\n end", "def create\n @clientcase = Clientcase.new(params[:clientcase])\n\n respond_to do |format|\n if @clientcase.save\n format.html { redirect_to @clientcase, :notice => 'Clientcase was successfully created.' }\n format.json { render :json => @clientcase, :status => :created, :location => @clientcase }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @clientcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vf_case = VfCase.new(vf_case_params)\n\n respond_to do |format|\n if @vf_case.save\n format.html { redirect_to @vf_case, notice: 'Vf case was successfully created.' }\n format.json { render :show, status: :created, location: @vf_case }\n else\n format.html { render :new }\n format.json { render json: @vf_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_case = TestCase.new(test_case_params)\n @test_suite = TestSuite.find(params[:test_suite_id])\n\n #Make sure the tc is linked to the ts\n @test_case.test_suite_id=@test_suite.id\n\n respond_to do |format|\n if @test_case.save\n format.html { redirect_to test_suite_test_case_path(@test_suite,@test_case), notice: 'Test case was successfully created.' }\n format.json { render :show, status: :created, location: @test_case }\n else\n format.html { render :new }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case = Case.new(case_params)\n @case.user_id = current_user.id\n respond_to do |format|\n if @case.save\n format.html { redirect_to cases_path, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case_request = CaseRequest.new(case_request_params)\n\n respond_to do |format|\n if @case_request.save\n format.html { redirect_to @case_request, notice: 'Case request was successfully created.' }\n format.json { render :show, status: :created, location: @case_request }\n else\n format.html { render :new }\n format.json { render json: @case_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @code_case = CodeCase.new(code_case_params)\n\n respond_to do |format|\n if @code_case.save\n format.html { redirect_to design_cases_path, notice: 'Code case was successfully created.' }\n format.json { render :show, status: :created, location: @code_case }\n else\n format.html { render :new }\n format.json { render json: @code_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @use_case = UseCase.new(params[:use_case])\n @use_case.project_id = params[:project_id]\n @project = Project.find(params[:project_id]) \n if @use_case.use_case_group_id.nil? then\n @use_case.use_case_group_id = params[:group_id]\n end\n @use_case.data = params[:data].to_json\n\n respond_to do |format|\n if @use_case.save\n format.html { redirect_to requirements_project_use_case_path(@use_case.project, @use_case,:type => \"step\"), notice: 'Use case was successfully created.' }\n format.json { render json: @use_case, status: :created, location: @use_case }\n else\n format.html { render action: \"new\" }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @design_case = DesignCase.new(design_case_params)\n\n respond_to do |format|\n if @design_case.save\n format.html { redirect_to @design_case, notice: 'Design case was successfully created.' }\n format.json { render :show, status: :created, location: @design_case }\n else\n format.html { render :new }\n format.json { render json: @design_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def sf_case_params\n params.require(:sf_case).permit(SFCase.attributes)\n end", "def create\n @success_case = SuccessCase.new(params[:success_case])\n\n respond_to do |format|\n if @success_case.save\n format.html { redirect_to(@success_case, :notice => 'Success case was successfully created.') }\n format.xml { render :xml => @success_case, :status => :created, :location => @success_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @success_case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @case = Case.new(case_params)\n @case.user_id = User.current.id\n respond_to do |format|\n if @case.save\n format.html { redirect_to back_url, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case_study = CaseStudy.new(params[:case_study])\n\n respond_to do |format|\n if @case_study.save\n format.html { redirect_to @case_study, notice: 'Case study was successfully created.' }\n format.json { render json: @case_study, status: :created, location: @case_study }\n else\n format.html { render action: \"new\" }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params.permit!\n @security_case = SecurityCase.new(params[:security_case])\n\n respond_to do |format|\n if @security_case.save\n format.html { redirect_to(@security_case, :notice => 'Security case was successfully created.') }\n format.xml { render :xml => @security_case, :status => :created, :location => @security_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @security_case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def cases=(value)\n @cases = value\n end", "def create_new_case(project_id,suite_id,sub_section_id,test_case)\n testrail_api_client.send_post(\"add_case/#{sub_section_id || suite_id}\",test_case_data(test_case))\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def create\n @use_case = UseCase.new(use_case_params)\n # creating hard info\n @use_case.hard_infos.new(use_case_params.except(\n :division,\n :sc_tel,\n :project_no,\n :industry,\n :service_product,\n :customer_count,\n :vendor_count,\n :product_count,\n :vehicle_count,\n :driver_count,\n :sc_name,\n :memo,\n :use_case_code\n )\n )\n @use_case.hard_infos.last.save\n #--\n respond_to do |format|\n if @use_case.save\n format.html { redirect_to @use_case }\n format.json { render :show, status: :created, location: @use_case }\n else\n format.html { render :new }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @yfcase = current_user.yfcases.build(yfcase_params)\n @yfcase.user=current_user\n respond_to do |format|\n if @yfcase.save\n format.html { redirect_to @yfcase, notice: 'Yfcase was successfully created.' }\n format.json { render :show, status: :created, location: @yfcase }\n else\n format.html { render :new }\n format.json { render json: @yfcase.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_case = TestCase.new(test_case_params)\n\n respond_to do |format|\n if @test_case.save\n TestMailer.admin_new_test_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully added.' }\n format.json { render action: 'show', status: :created, location: @test_case }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @support_case = current_user.support_cases.build(support_case_params)\n\n respond_to do |format|\n if @support_case.save\n format.html { redirect_to @support_case, notice: 'Support case was successfully created.' }\n format.json { render :show, status: :created, location: @support_case }\n else\n format.html { render :new }\n format.json { render json: @support_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case_study = CaseStudy.new(case_study_params)\n\n respond_to do |format|\n if @case_study.save\n format.html { redirect_to @case_study, notice: 'Case study was successfully created.' }\n format.json { render :show, status: :created, location: @case_study }\n else\n format.html { render :new }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case_support = CaseSupport.new(case_support_params)\n\n respond_to do |format|\n if @case_support.save\n format.html { redirect_to @case_support, notice: 'Case support was successfully created.' }\n format.json { render :show, status: :created, location: @case_support }\n else\n format.html { render :new }\n format.json { render json: @case_support.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @disbursment = Disbursment.new(disbursment_params)\n @disbursment.case_id = @case.id\n respond_to do |format|\n if @disbursment.save\n format.html { redirect_to case_disbursment_path(@case, @disbursment), notice: 'Disbursment was successfully created.' }\n format.json { render :show, status: :created, location: @disbursment }\n else\n format.html { render :new }\n format.json { render json: @disbursment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case = Case.new(params[:case])\n @case.operator_id = current_user.id\n if current_user.district_id and !current_user.admin?\n @districts = District.where(\"id = #{current_user.district_id}\")\n @phis = Phi.where(\"district_id = #{current_user.district_id}\")\n else\n @districts = District.all\n @phis = Phi.all\n @centers = Center.all\n end\n @centers = (@phis.count == 1)? Center.where(\"phi_id = #{@phis.first.id}\") : Center.all\n @hes = He.where(:center_id => @centers.map { |id| id })\n\n @laboratories = Laboratory.all\n @municipalities = Municipality.all\n @agents = Agent.all\n @doctors = User.find_all_by_user_type(1)\n @nurses = User.find_all_by_user_type(2)\n @icds = Icd.all\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to @case, notice: t(\"record_created\") }\n format.json { render json: @case, status: :created, location: @case }\n else\n format.html { render action: \"new\" }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_case = TestCase.new(params[:test_case])\n\n respond_to do |format|\n if @test_case.save\n format.html { redirect_to(@test_case, :notice => 'TestCase was successfully created.') }\n format.xml { render :xml => @test_case, :status => :created, :location => @test_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @testcase = Testcase.new(params[:testcase])\n\n respond_to do |format|\n if @testcase.save\n format.html { redirect_to @testcase, :notice => 'Test was successfully created.' }\n format.json { render :json => @testcase, :status => :created, :location => @test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @sf_cases = SFCase.all\n end", "def create\n @spatial_coverage = SpatialCoverage.new(params[:spatial_coverage])\n\n respond_to do |format|\n if @spatial_coverage.save\n format.html { redirect_to @spatial_coverage, notice: 'Spatial Coverage was successfully created.' }\n format.json { render json: @spatial_coverage, status: :created, location: @spatial_coverage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spatial_coverage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stage_fecundity = StageFecundity.new(params[:stage_fecundity])\n\n respond_to do |format|\n if @stage_fecundity.save\n format.html { redirect_to @stage_fecundity, notice: 'Stage fecundity was successfully created.' }\n format.json { render json: @stage_fecundity, status: :created, location: @stage_fecundity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stage_fecundity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "def create\n \n @casestudy = Casestudy.new(params[:casestudy])\n\n respond_to do |format|\n if @casestudy.save\n format.html { redirect_to edit_admin_casestudy_path(@casestudy), notice: '成功案例建立完成。' }\n format.json { render json: @casestudy, status: :created, location: @casestudy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @casestudy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case_type = CaseType.new(case_type_params)\n\n respond_to do |format|\n if @case_type.save\n format.html { redirect_to @case_type, notice: 'Case type was successfully created.' }\n format.json { render :show, status: :created, location: @case_type }\n else\n format.html { render :new }\n format.json { render json: @case_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @patentcase = Patentcase.new(params[:patentcase])\n\n respond_to do |format|\n if @patentcase.save\n format.html { redirect_to @patentcase, :notice => 'Patentcase was successfully created.' }\n format.json { render :json => @patentcase, :status => :created, :location => @patentcase }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @patentcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n\t\t# get the current surgeon of the all case details\n\t\tcases = current_user.cases.order_by(:schedule_date=> :asc).collect{|surgery_case| surgery_case if (surgery_case.schedule.schedule_date.to_date.past? || surgery_case.schedule.schedule_date.to_date.today?)}.reject(&:blank?).take(10)\n\t\tif cases.present?\n\t render json: { success: true, response: cases.map{ |f| CaseSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Cases are not present\" },:status=> 203\n\t end \n\tend", "def create\n @case_doc = CaseDoc.new(case_doc_params)\n\n respond_to do |format|\n if @case_doc.save\n format.html { redirect_to @case_doc, notice: 'Case doc was successfully created.' }\n format.json { render :show, status: :created, location: @case_doc }\n else\n format.html { render :new }\n format.json { render json: @case_doc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @health_case = HealthCase.new(health_case_params)\n\n respond_to do |format|\n if @health_case.save\n format.html { redirect_to @health_case, notice: 'Health case was successfully created.' }\n format.json { render :show, status: :created, location: @health_case }\n else\n format.html { render :new }\n format.json { render json: @health_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testcase = Testcase.find(params[:testcase_id])\n @step = @testcase.steps.new(step_params)\n byebug\n if @step.save\n render :show, status: :created\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def create\n @computer_case = ComputerCase.new(computer_case_params)\n\n respond_to do |format|\n if @computer_case.save\n format.html { redirect_to @computer_case, notice: 'Computer case was successfully created.' }\n format.json { render :show, status: :created, location: @computer_case }\n else\n format.html { render :new }\n format.json { render json: @computer_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n mytimestamp = Time.now.localtime.strftime(\"%y%m%d-%H%M%S\")\n mytime = \"%s\" % Time.now.to_i\n\n @case = Case.new(params[:case])\n\[email protected] = mytimestamp\n\t\n respond_to do |format|\n if @case.save\n format.js \n format.xml { render :xml => @case, :status => :created, :location => @case }\n else\n\t puts \"ERRORS ! ! ! ! ! ! : \"\n\t puts @case.errors.count\n\t\tputs @case.errors.full_messages\n format.js { render :controller => \"application\", :action => \"errdisplay\" }\n format.xml { render :xml => @loc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_post_then_get\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n id = last_response.body\n\n get \"/traces/#{id}\"\n check_valid_trace last_response.body\n end", "def create\n @casefile = Casefile.new(casefile_params)\n\n respond_to do |format|\n if @casefile.save\n format.html { redirect_to @casefile, notice: 'Casefile was successfully created.' }\n format.json { render :show, status: :created, location: @casefile }\n else\n format.html { render :new }\n format.json { render json: @casefile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(incident_params)\n\n if @incident.save\n render json: @incident, status: :created, location: @incident\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "def create\n @federal1870_census_entry = Federal1870CensusEntry.new(params[:federal1870_census_entry])\n\n respond_to do |format|\n if @federal1870_census_entry.save\n format.html { redirect_to @federal1870_census_entry, notice: 'Federal1870 census entry was successfully created.' }\n format.json { render json: @federal1870_census_entry, status: :created, location: @federal1870_census_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @federal1870_census_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @casecategory = Casecategory.new(casecategory_params)\n\n respond_to do |format|\n if @casecategory.save\n format.html { redirect_to @casecategory, notice: \"Casecategory was successfully created.\" }\n format.json { render :show, status: :created, location: @casecategory }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @casecategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case_study = CaseStudy.new(case_study_params)\n @case_study.user = current_user\n\n respond_to do |format|\n if @case_study.save\n format.html { redirect_to @case_study, notice: 'Case study was successfully created.' }\n format.json { render :show, status: :created, location: @case_study }\n else\n format.html { render :new }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident_proof = IncidentProof.new(incident_proof_params)\n\n respond_to do |format|\n if @incident_proof.save\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully created.' }\n format.json { render :show, status: :created, location: @incident_proof }\n else\n format.html { render :new }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.find(params[:quote_id])\n @use_case = @quote.use_cases.build(params[:use_case])\n\n\n respond_to do |format|\n if @use_case.save\n format.html { redirect_to @quote, notice: 'Use case was successfully created.' }\n format.json { render json: @use_case, status: :created, location: @use_case }\n else\n format.html { render action: \"new\" }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n realizarCostos\n end\n end", "def casa_case_params\n params.require(:casa_case).permit(\n :case_number,\n :transition_aged_youth,\n :birth_month_year_youth,\n :court_date,\n :court_report_due_date,\n :hearing_type_id,\n :judge_id\n )\n end", "def create\n @expensesbasis = @post.expensesbases.new(expensesbasis_params)\n\n respond_to do |format|\n if @expensesbasis.save\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully created.' }\n format.json { render :show, status: :created, location: @expensesbasis }\n else\n format.html { render :new }\n format.json { render json: @expensesbasis.errors, status: :unprocessable_entity }\n end\n end\n end", "def support_case_params\n params.require(:support_case).permit(:name, :desc, :stage, :solution, :status, :contact_id, :close_date)\n end", "def create\n @diagnosis = Diagnosis.new(params[:diagnosis])\n @diagnosis.prof_inspection_id = @prof_inspection.id\n\n respond_to do |format|\n if @diagnosis.save\n format.html { redirect_to client_prof_inspections_path(@prof_inspection.client), notice: I18n.t(:record_created) }\n format.json { render json: @diagnosis, status: :created, location: @diagnosis }\n else\n format.html { render action: \"new\" }\n format.json { render json: @diagnosis.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_case_entry = TestCaseEntry.new(params[:test_case_entry])\n\n respond_to do |format|\n if @test_case_entry.save\n format.html { redirect_to(@test_case_entry, :notice => 'Test case entry was successfully created.') }\n format.xml { render :xml => @test_case_entry, :status => :created, :location => @test_case_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_case_entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @case = Case.new\n @case.date_entry = Time.now.strftime(\"%Y-%m-%d\")\n @case.date_report = Time.now.strftime(\"%Y-%m-%d\")\n @case.date_lab = Time.now.strftime(\"%Y-%m-%d\")\n @case.date_of_dg = Time.now.strftime(\"%Y-%m-%d\")\n\n if current_user.district_id and !current_user.admin?\n @districts = District.where(\"id = #{current_user.district_id}\")\n @phis = Phi.where(\"district_id = #{current_user.district_id}\")\n else\n @districts = District.all\n @phis = Phi.all\n @centers = Center.all\n end\n @centers = (@phis.count == 1)? Center.where(\"phi_id = #{@phis.first.id}\") : Center.all\n @hes = He.where(:center_id => @centers.map { |id| id })\n\n @laboratories = Laboratory.all\n @agents = Agent.all\n @doctors = User.find_all_by_user_type(1)\n @nurses = User.find_all_by_user_type(2)\n @municipalities = Municipality.all\n # @centers = Center.all\n @icds = Icd.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case }\n end\n end", "def create\n @diagnosis_facility = DiagnosisFacility.new(diagnosis_facility_params)\n\n respond_to do |format|\n if @diagnosis_facility.save\n format.html { redirect_to @diagnosis_facility, notice: 'Diagnosis facility was successfully created.' }\n format.json { render :show, status: :created, location: @diagnosis_facility }\n else\n format.html { render :new }\n format.json { render json: @diagnosis_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @casedeal = Casedeal.new(casedeal_params)\n\n respond_to do |format|\n if @casedeal.save\n format.html { redirect_to casedeals_url, notice: 'Casedeal was successfully created.' }\n format.json { render :show, status: :created, location: @casedeal }\n else\n format.html { render :new }\n format.json { render json: @casedeal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @casestudy = Casestudy.new(casestudy_params)\n @casestudy.user = current_user\n\n respond_to do |format|\n if @casestudy.save\n format.html { redirect_to @casestudy, notice: \"Casestudy was successfully created.\" }\n format.json { render :show, status: :created, location: @casestudy }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @casestudy.errors, status: :unprocessable_entity }\n end\n end\n end", "def case_params\n params.require(:case).permit(:employee_id, :patient_id, :start_date, :end_date, :reason_for_end, :pay_amount, :invoice)\n end", "def index\n\t\tif @cases.present?\n \t\trender json: { success: true, response: @cases.as_json(\"case_media\") },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"Cases are not present\" },:status=> 203\n\t end\n\tend", "def create\n if (item_params[:client_name] == \"\" && item_params[:client_ssn] == \"\")\n respond_to do |format|\n format.html {redirect_to items_url, notice: 'Error: At least client name or SSN must be entered to create a case. Hit the BACK button to resume editing.'}\n format.json {head :no_content}\n end\n return\n end\n @item = Item.create(item_params)\n\n if [email protected]?\n errStr = \"\"\n @item.errors.full_messages.each do |errMsg|\n errStr += errMsg + \". \"\n end\n respond_to do |format|\n format.html {redirect_to items_url, notice: 'Error: ' + errStr}\n format.json {head :no_content}\n end\n return\n end\n tempCaseIdBase = format('%04d', @item[:date_opened].year) + format('%02d', @item[:date_opened].month) + format('%02d', @item[:date_opened].day)\n idNum = if Setting.get_all.key?(tempCaseIdBase)\n Setting[tempCaseIdBase] + 1\n else\n 0\n end\n Setting[tempCaseIdBase] = idNum\n\n tempCaseId = tempCaseIdBase + format('%03d', idNum)\n @item.update_attributes(case_id: tempCaseId)\n flash[:notice] = \"Case for #{@item.client_name} successfully created\"\n redirect_to items_path\n end", "def create\n @inciting_incident = IncitingIncident.new(inciting_incident_params)\n\n if @inciting_incident.save\n render json: @inciting_incident, status: :created, location: @inciting_incident\n else\n render json: @inciting_incident.errors, status: :unprocessable_entity\n end\n end", "def create\n original_content = JSON.parse request.body.read\n if original_content.key? ('source') and (original_content['source'] == 'GeneTalk' or original_content['source'] == 'Phenobot')\n content = JSON.parse Patient.convert(original_content)\n else\n content = original_content\n end\n patient_id = content['case_data']['case_id']\n time = Time.now.strftime('%d_%m_%Y_%H_%M_%S')\n log_dir = File.join(API_LOG, patient_id.to_s)\n unless File.directory?(log_dir)\n FileUtils.mkdir_p(log_dir)\n end\n log_path = File.join(log_dir, time + '.log')\n logger = Logger.new(log_path)\n logger.info 'Receive patient data'\n\n # Log the raw JSON data\n original_f = File.join(log_dir, time + '.json')\n File.open(original_f, \"wb\") { |f| f.write(JSON.pretty_generate(original_content)) }\n\n # if a case doesnt exist, process the request and create a new case\n patient_save = true\n msg = {}\n begin\n ActiveRecord::Base.transaction do\n consumer_id = get_consumer_id()\n lab = Patient.parse_lab(content, consumer_id)\n patient = Patient.find_by(case_id: patient_id, lab_id: lab.id)\n if patient.nil?\n patient = Patient.create_patient(content, consumer_id)\n msg = { msg: MSG_CASE_CREATED }\n else\n # Check if there is pedia service running to avoid\n # overwriting the data\n p_services = patient.pedia_services\n unless p_services.empty?\n p_service = p_services.last\n p_status = p_service.pedia_status\n if p_status.workflow_running?\n msg = { msg: MSG_PEDIA_RUNNING_TRY_LATER }\n respond_to do |format|\n format.json { render plain: msg.to_json,\n status: 400,\n content_type: 'application/json'\n }\n end\n return\n end\n end\n\n # Update patient data\n patient.update_json(content['case_data'])\n msg = { msg: MSG_CASE_UPDATE }\n end\n\n dirname = File.join(\"Data\", \"Received_JsonFiles\", lab.id.to_s)\n dir = \"#{Rails.root}/#{dirname}\"\n FileUtils.mkdir(dir) unless File.directory?(dir)\n\n f = \"#{dir}/#{patient_id}.json\"\n File.open(f, \"wb\") { |f| f.write(JSON.pretty_generate(content)) }\n end\n rescue Exception => e\n logger = Logger.new(log_path)\n logger.error e.message\n e.backtrace.each { |line| logger.error line }\n patient_save = false\n msg = { msg: MSG_CASE_ERROR }\n end\n\n respond_to do |format|\n if patient_save\n format.json { render plain: msg.to_json,\n status: 200,\n content_type: 'application/json'\n }\n else\n msg = { msg: MSG_CASE_ERROR }\n format.json { render plain: msg.to_json,\n status: 400,\n content_type: 'application/json'\n }\n end\n end\n end", "def create\n @showdown = Showdown.new(showdown_params)\n if params.has_key?(:contestant)\n contestants = []\n params[:contestant].each_with_index do |contestant, index|\n if Contestant.where(name: contestant).count > 0\n contestants << Contestant.where(name: contestant).first\n else\n contestant = Contestant.create(name: contestant)\n contestant.portrait_url = JSON.parse(params[\"portrait#{index + 1}\"])[0]['url']\n if contestant.save\n contestants << contestant\n end\n end\n end\n if params.has_key?(:stats)\n params[:stats].each do |index, stat_row|\n stat = Stat.create(showdown: @showdown, description: stat_row[:description])\n ContestantStat.create(stat: stat, value: stat_row[:contestant1], contestant: contestants.first)\n ContestantStat.create(stat: stat, value: stat_row[:contestant2], contestant: contestants.last)\n end\n end\n @showdown.contestants = contestants\n end\n\n respond_to do |format|\n if @showdown.save\n format.html { redirect_to @showdown, notice: 'Showdown was successfully created.' }\n format.json { render :show, status: :created, location: @showdown }\n else\n format.html { render :new }\n format.json { render json: @showdown.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_bva_dta_decision_status_details\n issue_list = remanded_sc_decision_issues\n {\n issues: api_issues_for_status_details_issues(issue_list),\n bva_decision_date: decision_event_date,\n aoj_decision_date: remand_decision_event_date\n }\n end", "def create\n @faculties = Faculty.create!(faculty_params)\n json_response(@faculties, :created)\n end", "def create\n @answer_case = AnswerCase.new(answer_case_params)\n question = Question.find(@answer_case.question_id)\n line_case = LineCase.find(question.line_case_id)\n respond_to do |format|\n if @answer_case.save\n format.html { redirect_to line_case_path(line_case), notice: 'A Resposta Foi Cadastrada Com Sucesso.' }\n format.json { render :show, status: :created, location: @answer_case }\n else\n format.html { render :new }\n format.json { render json: @answer_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student_evaluation_case2 = StudentEvaluationCase2.new(student_evaluation_case2_params)\n\n respond_to do |format|\n if @student_evaluation_case2.save\n format.html { redirect_to @student_evaluation_case2, notice: 'Student evaluation case2 was successfully created.' }\n format.json { render :show, status: :created, location: @student_evaluation_case2 }\n else\n format.html { render :new }\n format.json { render json: @student_evaluation_case2.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @insurance_facility = InsuranceFacility.new(insurance_facility_params)\n\n respond_to do |format|\n if @insurance_facility.save\n format.html { redirect_to @insurance_facility, notice: 'Insurance facility was successfully created.' }\n format.json { render :show, status: :created, location: @insurance_facility }\n else\n format.html { render :new }\n format.json { render json: @insurance_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @insurance_coverage = InsuranceCoverage.new(insurance_coverage_params)\n\n respond_to do |format|\n if @insurance_coverage.save\n format.html { redirect_to @insurance_coverage, notice: 'Insurance coverage was successfully created.' }\n format.json { render :show, status: :created, location: @insurance_coverage }\n else\n format.html { render :new }\n format.json { render json: @insurance_coverage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @facility = Facility.new(facility_params)\n @facility.save\n respond_with @facility\n end", "def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def use_case_params\n params.require(:use_case).permit(\n :division,\n :use_case_no,\n :date,\n :client_name,\n :product_name,\n :mod,\n :province,\n :store,\n :memo,\n :introduction_date,\n :time_passed,\n :due_date,\n :time_remaining,\n :sales_person,\n :delivery_person,\n :superviser,\n :project_person,\n :program_person,\n :id_issued,\n :sc_count,\n :tel,\n :remote,\n :supervision_count,\n :hoshu,\n :c_pic,\n :so_address1,\n :so_address2,\n :so_address3,\n :so_pic,\n :sc_tel,\n :sales_no,\n :lookup_no,\n :project_no,\n :industry,\n :service_product,\n :customer_count,\n :vendor_count,\n :product_count,\n :vehicle_count,\n :driver_count,\n :sc_name,\n :so_tel,\n :so_fax,\n :so_name,\n :remark,\n :c_address1,\n :c_address2,\n :c_address3,\n :c_email,\n :c_postal_code,\n :c_tel,\n :c_fax,\n :c_office,\n :denban,\n :use_case_code\n \n )\n end", "def create\n @county = County.new(params[:county])\n\n respond_to do |format|\n if @county.save\n format.html { redirect_to @county, notice: 'County was successfully created.' }\n format.json { render json: @county, status: :created, location: @county }\n else\n format.html { render action: \"new\" }\n format.json { render json: @county.errors, status: :unprocessable_entity }\n end\n end\n end", "def case_params\n params.permit(:case_id, :opened, :closed, :updated, :status, :responsible_agency, :category, :request_type,\n :neighborhood, :request_detail, :address, :supervisor_district, :source, :media_url, :longitude,\n :latitude)\n end", "def create\n @test_case_result = TestCaseResult.new(test_case_result_params)\n\n respond_to do |format|\n if @test_case_result.save\n format.html { redirect_to @test_case_result, notice: 'Test case result was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_case_result }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_case_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @support_cases = SupportCase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @support_cases }\n end\n end", "def new\n @testcase = Testcase.new\n 3.times { @testcase.scripts.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @testcase }\n end\n end", "def create\n routine = Routine.create!(routine_params)\n render json: routine\n end", "def create\n @spdatum = Spdatum.new(params[:spdatum])\n\n respond_to do |format|\n if @spdatum.save\n format.html { redirect_to @spdatum, notice: 'Spdatum was successfully created.' }\n format.json { render json: @spdatum, status: :created, location: @spdatum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spdatum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case_study = CaseStudy.new(case_study_params)\n\n respond_to do |format|\n action_message_for('new')\n if create_case_study\n format.html { redirect_to redirect_target(@case_study), flash: @feedback_flash }\n format.json { render :show, status: :created, location: @case_study }\n else\n format.html { render :new }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n dns_entry_response = RestClient.post('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n\n if JSON.parse(dns_entry_response)[\"success\"]\n @dns_entry = DnsEntry.new(dns_entry_params)\n\n respond_to do |format|\n if @dns_entry.save\n format.html { redirect_to @dns_entry, notice: \"Dns entry was successfully created.\" }\n format.json { render :show, status: :created, location: @dns_entry }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @dns_entry.errors, status: :unprocessable_entity }\n end\n end \n\n end\n\n\n end", "def create\n @testcase = Testcase.new(params[:testcase])\n\n respond_to do |format|\n if @testcase.save\n flash[:notice] = 'Testcase was successfully created.'\n format.html { redirect_to(@testcase) }\n format.xml { render :xml => @testcase, :status => :created, :location => @testcase }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.create(plan_params)\n @incident = Incident.find(params[:incident_id])\n respond_to do |format|\n if @plan.save\n format.html { redirect_to incident_plan_path(@incident, @plan) }\n format.json { redirect_to incident_plan_path(@incident, @plan) }\n else\n format.html { render :new }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @coverage = Coverage.new(coverage_params)\n\n respond_to do |format|\n if @coverage.save\n format.html { redirect_to @coverage, notice: 'Coverage was successfully created.' }\n format.json { render :show, status: :created, location: @coverage }\n else\n format.html { render :new }\n format.json { render json: @coverage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @facility = Facility.new(params[:facility])\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: 'Facility was successfully created.' }\n format.json { render json: @facility, status: :created, location: @facility }\n else\n format.html { render action: \"new\" }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @investment = Investment.new(investment_params)\n\n if @investment.save\n render json: @investment, status: :created\n else\n render json: @investment.errors, status: :unprocessable_entity\n end\n end", "def create\n @diseasesubset = Diseasesubset.new(diseasesubset_params)\n\n respond_to do |format|\n if @diseasesubset.save\n format.html { redirect_to @diseasesubset, notice: 'Diseasesubset was successfully created.' }\n format.json { render :show, status: :created, location: @diseasesubset }\n else\n format.html { render :new }\n format.json { render json: @diseasesubset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @facility = Facility.new(facility_params)\n @facility.citizen = current_citizen\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: 'Facility was successfully built.' }\n format.json { render :show, status: :created, location: @facility }\n else\n format.html { render :new }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cys_env = CysEnv.new(params[:cys_env])\n\n respond_to do |format|\n if @cys_env.save\n format.html { redirect_to @cys_env, notice: 'Cys env was successfully created.' }\n format.json { render json: @cys_env, status: :created, location: @cys_env }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cys_env.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n if params[:problems].blank?\n @cases = Case.all\n else\n @cases = Case.as(:c).where('c.stock <= 1').pluck(:c)\n @cases.map!{|c| {\n id: c.id,\n name: c.name,\n stock: c.stock\n }}\n\n @cases.sort_by! {:name}\n\n render json: @cases\n end\n end", "def create\n @scenario = Scenario.new(params[:scenario])\n\n respond_to do |format|\n if @scenario.save\n format.html { redirect_to @scenario, notice: 'Scenario was successfully created.' }\n format.json { render json: @scenario, status: :created, location: @scenario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scenario.errors, status: :unprocessable_entity }\n end\n end\n end", "def yfcase_params\n params.require(:yfcase).permit(:case_number, :company, :adv_find_condition, :isMobileOrDesktop, :now_or_before, \\\n :country_id, :township_id, :big_section, :small_section, \\\n :other_address, :co_owner, \\\n :auction_day_1,:auction_day_2,:auction_day_3,:auction_day_4, \\\n :floor_price_1,:floor_price_2,:floor_price_3,:floor_price_4, \\\n :click_1,:click_2,:click_3,:click_4, \\\n :monitor_1,:monitor_2,:monitor_3,:monitor_4, \\\n :margin_1,:margin_2,:margin_3,:margin_4,:auction_notes, \\\n :first_survey_day,:other_survey_day, \\\n :housingTax, :refereeFee, :agreementSplitUnsuccessfulDate, \\\n :exhibit1, :exhibit2, :exhibit3, :exhibit4, :tabulationDate, \\\n :foreclosure_announcement_title,:foreclosure_announcement_link,:foreclosure_announcement_988_link,:object_photo_title,:object_photo_link, \\\n :net_price_registration_market_price_title,:net_price_registration_market_price_link,:net_price_registration_map_title,:net_price_registration_map_link,:net_price_registration_photo_title,:net_price_registration_photo_link, \\\n :auction_record_title,:auction_record_link,:other_notes,:survey_resolution,:final_decision, \\\n :occupy,:register,:parking_space,:management_fee,:rent,:leak,:easy_parking,:railway,:vegetable_market,:supermarket,:school,:park,:post_office,:main_road,:water_and_power_failure,:good_vision, :final_decision_date, \\\n :active_result,:active_result_date,:priority_purchase_result,:target_number, \\\n :realestateregistrationRealEstateAgent, :complaintLitigationAgent, \\\n :debtorName, :debtorIdentitycard, :debtorBirthday, :debtorLocallphone, :debtorMobilelphone, :debtorNotes, :debtorCountry, :debtorTownship, :debtorVillage, :debtorNeighbor, :debtorStreet, :debtorSection, :debtorLane, :debtorAlley, :debtorNumber, :debtorFloor, :debtorBuildholdingpointperson, :debtorBuildholdingpointall, :debtorLandholdingpointperson, :debtorLandholdingpointall, \\\n :creditorName, :creditorIdentitycard, :creditorBirthday, :creditorLocallphone, :creditorMobilelphone, :creditorNotes, :creditorCountry, :creditorTownship, :creditorVillage, :creditorNeighbor, :creditorStreet, :creditorSection, :creditorLane, :creditorAlley, :creditorNumber, :creditorFloor, :creditorBuildholdingpointperson, :creditorBuildholdingpointall, :creditorLandholdingpointperson, :creditorLandholdingpointall, \\\n :deedtaxDateOfDeed, :deedtaxDeclarationDate, :deedtaxTransferPrice, :deedtaxChargeDaffairesTaxDeclarant, :deedtaxDebtTaxPaymentReceiptMethod, :deedtaxClosedNewsletter, :deedtaxUnderreportedDays, :deedtaxRemark, \\\n :cause_data,:application_for_registration,:reason_for_registration,:marking_and_application_rights,:attached_Document_Content_1,:number_of_attached_quantity_1,:attached_Document_Content_2,:number_of_attached_quantity_2,:attached_Document_Content_3,:number_of_attached_quantity_3,:registration_notes, \\\n :deedtaxBuildingTransferLevel1, :deedtaxBuildingTransferLevel2, :deedtaxBuildingTransferLevel3, :deedtaxBuildingTransferLevel4, :deedtaxBuildingTransferLevel5, :deedtaxBuildingTransferLevel6, :deedtaxBuildingTransferLevel7, \\\n :deedtaxBuildingTransferStructure1, :deedtaxBuildingTransferStructure2, :deedtaxBuildingTransferStructure3, :deedtaxBuildingTransferStructure4, :deedtaxBuildingTransferStructure5, :deedtaxBuildingTransferStructure6, :deedtaxBuildingTransferStructure7, \\\n :deedtaxBuildingTransferArea1, :deedtaxBuildingTransferArea2, :deedtaxBuildingTransferArea3, :deedtaxBuildingTransferArea4, :deedtaxBuildingTransferArea5, :deedtaxBuildingTransferArea6, :deedtaxBuildingTransferArea7, \\\n :deedtaxBuildingTransferPublicBuildingNumber1, :deedtaxBuildingTransferPublicBuildingNumber2, :deedtaxBuildingTransferPublicBuildingNumber3, :deedtaxBuildingTransferPublicBuildingNumber4, :deedtaxBuildingTransferPublicBuildingNumber5, \\\n :deedtaxBuildingTransferPublicArea1, :deedtaxBuildingTransferPublicArea2, :deedtaxBuildingTransferPublicArea3, :deedtaxBuildingTransferPublicArea4, :deedtaxBuildingTransferPublicArea5, \\\n :houseTaxNumberCountry1,:houseTaxNumberCountry2,:houseTaxNumberTownship1,:houseTaxNumberTownship2,:houseTaxNumberBuilding1,:houseTaxNumberBuilding2,:houseTaxNumberBuilding3,:houseTaxNumberBuilding4,:houseTaxNumberHouseHold1,:houseTaxNumberHouseHold2,:houseTaxNumberHouseHold3, \\\n :deedtaxBuildingTransferPublicHoldings1, :deedtaxBuildingTransferPublicHoldings2, :deedtaxBuildingTransferPublicHoldings3, :deedtaxBuildingTransferPublicHoldings4, :deedtaxBuildingTransferPublicHoldings5, :newspaperAttached, \\\n personnals_attributes: [:id, :is_debtor, :is_creditor, :is_land_owner, :is_build_owner,:is_original_owner, :is_new_owner, :is_deed_tax_agent, :is_tax_agent, :name, :identity_card, :birthday,:person_country , \\\n :person_township ,:person_village ,:person_neighbor ,:person_street ,:person_section ,:person_lane ,:person_alley ,:person_number ,:person_floor , :local_phone, :mobile_phone, :personnal_notes,:identity_code, :public_or_private, :right_share_person, :right_share_all,:personnalBuildHoldingPointPerson,:personnalBuildHoldingPointAll,:ownerFullAddress , :_destroy], \\\n lands_attributes: [:id, :land_number, :land_url, :land_area, :land_holding_point_personal, :land_holding_point_all ,:landRemarks , :landPresentValue, :landTotalArea, :landAreaWidth, :landAreaDepth, :_destroy], \\\n objectbuilds_attributes: [:id, :address, :total_price, :build_area, :house_age, :floor_height, :surveyora, :surveyorb, :plusa, :plusb,:plusa_reason,:plusb_reason,:objectbuild_status, :objectbuild_url, :objectBuildDealYear, :objectBuildDealMonth, :_destroy], \\\n builds_attributes: [:id, :build_number,:build_url,:build_area, :build_holding_point_personal, :build_holding_point_all, :build_type_use,:use_partition, :_destroy, \\\n :buildCity, :buildTownship, :buildArea, :buildStreet, :buildRoad, :buildSegment, :buildLane, :buildDo, :buildNumber, :buildFloor, :buildBigSegment, :buildSmallSegment, :buildLot, :buildLevel1, :buildLevel2, :buildLevel3, :buildLevel4, :buildOther1, :buildOther2, :buildUse, :buildScopeOfArea, :buildScopeOfRights, :buildTotalArea, :buildRemarks, :buildLandNumber, \\\n :mainBuildLevel1,:mainBuildLevel2, :mainBuildLevel3, :mainBuildLevel4, :mainBuildLevel5, :mainBuildConstruction1, :mainBuildConstruction2, :mainBuildConstruction3, :mainBuildConstruction4, :mainBuildConstruction5, :mainBuildArea1, :mainBuildArea2, :mainBuildArea3, :mainBuildArea4, :mainBuildArea5, :publicBuildNumber1, :publicBuildNumber2, :publicBuildNumber3, :publicBuildNumber4, \\\n :publicBuildArea1, :publicBuildArea2, :publicBuildArea3, :publicBuildArea4, :publicBuildHP1, :publicBuildHP2, :publicBuildHP3, :publicBuildHP4, :subBuildUse1, :subBuildUse2, :subBuildUse3, :subBuildArea1, :subBuildArea2, :subBuildArea3,] )\n end", "def create\n @step = Step.new(params[:step])\n @test_case = TestCase.find(params[:test_case_id])\n @step.test_case_id = @test_case.id\n\n if @step.save\n flash[:notice] = \"Successfully created step.\"\n end\n respond_with @step\n end", "def create\n @plan = Plan.find(params[:plan_id])\n @incident = Incident.find(@plan.incident_id)\n @cover = Cover.new(cover_params)\n\n respond_to do |format|\n if @cover.save\n format.html { redirect_to incident_plan_cover_path(@incident, @plan, @cover) }\n format.json { render :show, status: :created, location: @cover }\n else\n format.html { render :new }\n format.json { render json: @cover.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6427756", "0.64235866", "0.6267116", "0.62058043", "0.62058043", "0.6066181", "0.6026911", "0.598927", "0.59323823", "0.5841091", "0.5833083", "0.5807662", "0.57961", "0.57737774", "0.57610583", "0.57447016", "0.57447", "0.57298386", "0.5726006", "0.5719866", "0.57009304", "0.56882167", "0.5674547", "0.5674177", "0.5653424", "0.56445426", "0.5638085", "0.5632445", "0.56292003", "0.56284493", "0.5624727", "0.5600025", "0.5598395", "0.5582504", "0.5575979", "0.5564308", "0.55382067", "0.5529511", "0.54841274", "0.54759586", "0.54644614", "0.5453778", "0.5453381", "0.5423812", "0.54105574", "0.5391709", "0.53895867", "0.5371264", "0.5358201", "0.53445035", "0.5341983", "0.532836", "0.532505", "0.53248984", "0.5323699", "0.53203547", "0.5319176", "0.5316448", "0.531439", "0.5314104", "0.5309055", "0.5287301", "0.52815187", "0.5277108", "0.5274268", "0.526405", "0.5262174", "0.525729", "0.5246942", "0.52466625", "0.524022", "0.5236454", "0.52301574", "0.52243584", "0.5221806", "0.5209435", "0.5202064", "0.52018225", "0.5201023", "0.51993656", "0.51851493", "0.51843446", "0.5182728", "0.51626986", "0.51605695", "0.5154018", "0.5151672", "0.514488", "0.51441187", "0.51403844", "0.51368344", "0.5134041", "0.5133559", "0.51239157", "0.5115988", "0.5112764", "0.5112274", "0.51111144", "0.5108647", "0.51074946" ]
0.6343145
2
PATCH/PUT /sf_cases/1 PATCH/PUT /sf_cases/1.json
def update h = sf_case_params.to_h h[:Id] = params[:id] @sf_case = SFCase.update(h.symbolize_keys) respond_to do |format| if @sf_case.sf_valid? set_success_flash_message("Case was successfully updated.") format.html { redirect_to sf_case_path(h["Id"])} format.json { render :show, status: :ok, location: @sf_case } else set_flash_error_message format.html { redirect_to edit_sf_case_path(@sf_case.Id) } format.json { render json: @sf_case.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @use_case = UseCase.find(params[:id])\n @use_case.data = params[:data].to_json\n\n respond_to do |format|\n if @use_case.update_attributes(params[:use_case])\n\n if params[:subaction]==\"step\"\n format.html { redirect_to requirements_project_use_case_path(@use_case.project, @use_case, :type=>\"step\"), notice: 'Use case was successfully updated.' }\n else\n format.html { redirect_to project_use_case_path(@project, @use_case), notice: 'Use case was successfully updated.' }\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to cases_path, notice: 'Case was successfully updated.' }\n format.json { render action: 'index' }\n else\n format.html { render action: 'edit' }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_case(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"cases/#{id}\",options)\n response.case\n end", "def update\n @clientcase = Clientcase.find(params[:id])\n\n respond_to do |format|\n if @clientcase.update_attributes(params[:clientcase])\n format.html { redirect_to @clientcase, :notice => 'Clientcase was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @clientcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to @case, notice: 'Case was successfully updated.' }\n format.json { render :show, status: :ok, location: @case }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to @case, notice: 'Case was successfully updated.' }\n format.json { render :show, status: :ok, location: @case }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to cases_path, notice: 'Case was successfully updated.' }\n format.json { render :show, status: :ok, location: @case }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to back_url, notice: 'Case was successfully updated.' }\n format.json { render :show, status: :ok, location: @case }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case_test.update(case_test_params)\n format.html { redirect_to @case_test, notice: 'Case test was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_test }\n else\n format.html { render :edit }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\tsurgery_case = current_user.cases.where( id: params[:id] )[0]\n\t\tif surgery_case.present?\n\t\t\tsurgery_case.update_attributes(case_params)\n\t\t\t# Updating the patient to the particular case\n\t\t\tsurgery_case.update_attributes(patient_id: params[:patient_id])\n \t\t# response to the JSON\n\t\t\trender json: { success: true,message: \"Case Successfully Updated.\", response: surgery_case.as_json(\"case_show\") },:status=>200\n\t else\n\t render :json=> { success: false, message: \"Case is not available\" },:status=> 404\n\t end\n\tend", "def update\n respond_to do |format|\n if @vf_case.update(vf_case_params)\n format.html { redirect_to @vf_case, notice: 'Vf case was successfully updated.' }\n format.json { render :show, status: :ok, location: @vf_case }\n else\n format.html { render :edit }\n format.json { render json: @vf_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @case = Case.find(params[:id])\n \n\t\n respond_to do |format|\n if @case.update_attributes(params[:case])\n\t \n format.js \n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @seance = Seances::UseCases::Update.new.call(id: params[:id], params: seance_params)\n\n if @seance.valid?\n render jsonapi: @seance\n else\n render jsonapi_errors: @seance.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @line_case.update(line_case_params)\n format.html { redirect_to @line_case, notice: 'Line case was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_case }\n else\n format.html { render :edit }\n format.json { render json: @line_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @casefile.update(casefile_params)\n format.html { redirect_to @casefile, notice: 'Casefile was successfully updated.' }\n format.json { render :show, status: :ok, location: @casefile }\n else\n format.html { render :edit }\n format.json { render json: @casefile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # updating hard info\n hard_info = HardInfo.where(use_case_no: @use_case.use_case_no, client_name: @use_case.client_name, product_name: @use_case.product_name)\n hard_info.first.update(use_case_params.except(\n :division,\n :sc_tel,\n :project_no,\n :industry,\n :service_product,\n :customer_count,\n :vendor_count,\n :product_count,\n :vehicle_count,\n :driver_count,\n :sc_name,\n :memo,\n :use_case_code\n )\n )\n #--\n respond_to do |format|\n if @use_case.update(use_case_params)\n format.html { redirect_to @use_case }\n format.json { render :show, status: :ok, location: @use_case }\n else\n format.html { render :edit }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_case\n api.command :edit, to_case_hash\n end", "def update\n @success_case = SuccessCase.find(params[:id])\n\n respond_to do |format|\n if @success_case.update_attributes(params[:success_case])\n format.html { redirect_to(@success_case, :notice => 'Success case was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @success_case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n if @study_case.update(study_case_params)\n render :show, status: :ok\n else\n render json: @study_case.errors, status: :unprocessable_entity\n end\n end", "def update\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n if @testcase.update_attributes(params[:testcase])\n format.html { redirect_to @testcase, :notice => 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.json { head :no_content }\n else\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case_doc.update(case_doc_params)\n format.html { redirect_to @case_doc, notice: 'Case doc was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_doc }\n else\n format.html { render :edit }\n format.json { render json: @case_doc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_case.update(test_case_params)\n TestMailer.admin_test_updated_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_suite = TestSuite.find(params[:test_suite_id])\n respond_to do |format|\n if @test_case.update(test_case_params)\n format.html { redirect_to test_suite_test_cases_path(@test_suite,@test_case), notice: 'Test case was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_case }\n else\n format.html { render :edit }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @use_case = UseCase.find(params[:id])\n\n respond_to do |format|\n if @use_case.update_attributes(params[:use_case])\n\n if params[:use_case].has_key?(:file) && params[:use_case][:file]\n @use_case.upload_main_asset(params[:use_case][:file])\n elsif params.has_key?(:file) && params[:file]\n @use_case.upload_main_asset(params[:file])\n end\n \n format.html { redirect_to @use_case, notice: 'Use case was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "def update\n @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n if @case_study.update_attributes(params[:case_study])\n format.html { redirect_to @case_study, notice: 'Case study was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @it_case = ItCase.find(params[:id])\n\n respond_to do |format|\n if @it_case.update_attributes(params[:it_case])\n format.html { redirect_to mycases_path, notice: '已完成评价' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @it_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @code_case.update(code_case_params)\n format.html { redirect_to design_cases_path, notice: 'Code case was successfully updated.' }\n format.json { render :show, status: :ok, location: @code_case }\n else\n format.html { render :edit }\n format.json { render json: @code_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to incident_plans_path(@incident) }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { redirect_to incident_plans_path(@incident) }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_case = TestCase.find(params[:id])\n\n respond_to do |format|\n if @test_case.update_attributes(params[:test_case])\n format.html { redirect_to(@test_case, :notice => 'TestCase was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident_proof.update(incident_proof_params)\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_proof }\n else\n format.html { render :edit }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n if @case_study.update_attributes(params[:case_study])\n format.html { redirect_to @case_study, notice: 'Case study was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @contractor_feature = ContractorFeature.find(params[:id])\n\n respond_to do |format|\n if @contractor_feature.update_attributes(params[:contractor_feature])\n format.html { redirect_to @contractor_feature, notice: 'Contractor feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params.permit!\n @security_case = SecurityCase.find(params[:id])\n\n respond_to do |format|\n if @security_case.update_attributes(params[:security_case])\n format.html { redirect_to(@security_case, :notice => 'Security case was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @security_case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @design_case.update(design_case_params)\n format.html { redirect_to @design_case, notice: 'Design case was successfully updated.' }\n format.json { render :show, status: :ok, location: @design_case }\n else\n format.html { render :edit }\n format.json { render json: @design_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @answer_case.update(answer_case_params)\n format.html { redirect_to @answer_case, notice: 'Answer case was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer_case }\n else\n format.html { render :edit }\n format.json { render json: @answer_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @feature_request.update(feature_request_params)\n format.html { redirect_to @feature_request, notice: 'Feature request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feature_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @yfcase.update(yfcase_params)\n format.html { redirect_to @yfcase, notice: 'Yfcase was successfully updated.' }\n format.json { render :show, status: :ok, location: @yfcase }\n else\n format.html { render :edit }\n format.json { render json: @yfcase.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @support_case.update(support_case_params)\n format.html { redirect_to @support_case, notice: 'Support case was successfully updated.' }\n format.json { render :show, status: :ok, location: @support_case }\n else\n format.html { render :edit }\n format.json { render json: @support_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_scaff.update(test_scaff_params)\n format.html { redirect_to @test_scaff, notice: 'Test scaff was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_scaff }\n else\n format.html { render :edit }\n format.json { render json: @test_scaff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @casestudy = Casestudy.find(params[:id])\n\n respond_to do |format|\n if @casestudy.update_attributes(params[:casestudy])\n format.html { redirect_to admin_casestudy_path(@casestudy), notice: '成功案例更新完成。' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @casestudy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patentcase = Patentcase.find(params[:id])\n\n respond_to do |format|\n if @patentcase.update_attributes(params[:patentcase])\n format.html { redirect_to @patentcase, :notice => 'Patentcase was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @patentcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case_study.update(case_study_params)\n format.html { redirect_to @case_study, notice: 'Case study was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_study }\n else\n format.html { render :edit }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case_study.update(case_study_params)\n format.html { redirect_to @case_study, notice: 'Case study was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_study }\n else\n format.html { render :edit }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_case_entry = TestCaseEntry.find(params[:id])\n\n respond_to do |format|\n if @test_case_entry.update_attributes(params[:test_case_entry])\n format.html { redirect_to(@test_case_entry, :notice => 'Test case entry was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_case_entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n if @routine.update_attributes(params[:routine])\n format.html { redirect_to @routine, notice: 'Routine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @scenario = Scenario.find(params[:id])\n\n respond_to do |format|\n if @scenario.update_attributes(params[:scenario])\n format.html { redirect_to @scenario, notice: 'Scenario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scenario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @scaff = Scaff.find(params[:id])\n\n respond_to do |format|\n if @scaff.update_attributes(params[:scaff])\n format.html { redirect_to @scaff, notice: 'Scaff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scaff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @casestudy.update(casestudy_params)\n format.html { redirect_to @casestudy, notice: \"Casestudy was successfully updated.\" }\n format.json { render :show, status: :ok, location: @casestudy }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @casestudy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t#check condition for present or not.\n\t\tif @case_note.present?\n\t\t\t# updating the case note attributes for the particular case note\n\t\t @case_note.update_attributes(case_note_params)\n\t\t #response in json format\n\t render json: { success: true,message: \"Case Note Successfully Updated.\", response: CaseNoteSerializer.new(@case_note).as_json(root: false) },:status=>200\n\t else\n\t render :json=> { success: false, message: \"Notes are not present\" },:status=> 203\n\t end \n\tend", "def update\nlogger.debug \"update discipline: \"[email protected]\n discipline_params.each_pair do |property,value|\n @discipline.send(property+'=',value)if @discipline.respond_to?(property+'=')\n end\n @discipline.updater_id = current_user\n if @discipline.save\n set_discipline\n #respond_with @discipline\n render json: @discipline, status: :ok\n else\n ##render json: @discipline.errors, status: :unprocessable_entity\n respond_with @discipline.errors, status: :unprocessable_entity\n end\n end", "def update2\n if params.has_key?(\"chef_value\")\n @chef_value.update(chef_value_params(params[\"chef_value\"]))\n else\n params[\"chef_values\"].each do |chef_value|\n if chef_value[\"value\"] != \"\"\n @chef_value.update(chef_value_params(chef_value))\n end\n end\n end\n respond_to do |format|\n if @chef_value.update(chef_value_params)\n format.html { redirect_to @chef_value, notice: 'Chef value was successfully updated.' }\n format.json { render :show, status: :ok, location: @chef_value }\n else\n format.html { render :edit }\n format.json { render json: @chef_value.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application_case.update(application_case_params)\n format.html { redirect_to @application_case, notice: 'Application case was successfully updated.' }\n format.json { render :show, status: :ok, location: @application_case }\n else\n format.html { render :edit }\n format.json { render json: @application_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quote = Quote.find(params[:quote_id])\n @use_case = UseCase.find(params[:id])\n\n respond_to do |format|\n if @use_case.update_attributes(params[:use_case])\n format.html { redirect_to @quote , notice: 'Use case was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n realizarCostos\n end\n end", "def update\n @scenario = Scenario.find(params[:id])\n\n respond_to do |format|\n if @scenario.update_attributes(scenario_params)\n format.html { redirect_to @scenario, notice: 'Scenario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scenario.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update\n #Again the delete feature from ActiveResource does not work out of the box.\n #Using custom delete function\n puts \"--create a new account--\"\n new_acct = Salesforce::Rest::Account.new(:Name => \"test numero uno\", :BillingStreet=> \"Fairway Meadows\",\n :BillingState => \"NY\", :ShippingCity => \"New York\")\n resp = new_acct.save()\n\n assert (resp.code == 201)\n j = ActiveSupport::JSON\n @sf_oid = j.decode(resp.body)[\"id\"]\n puts \"New Object created: id -> \" + @sf_oid\n\n puts \"--update that new account--\"\n serialized_json = '{\"BillingState\":\"WA\"}'\n #http = Net::HTTP.new(@rest_svr_url, 443)\n http = Net::HTTP.new('na7.salesforce.com', 443)\n http.use_ssl = true\n \n class_name = \"Account\"\n path = \"/services/data/v21.0/sobjects/#{class_name}/#{@sf_oid}\"\n headers = {\n 'Authorization' => \"OAuth \"+ @oauth_token,\n \"content-Type\" => 'application/json',\n }\n code = serialized_json\n\n \n req = Net::HTTPGenericRequest.new(\"PATCH\", true, true, path, headers)\n\n resp = http.request(req, code) { |response| }\n assert !resp.nil?\n\n puts resp.to_s\n end", "def update\n respond_to do |format|\n if @socio_cpf.update(socio_cpf_params)\n format.html { redirect_to @socio_cpf, notice: 'Socio cpf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_cpf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @help_case.update(help_case_params)\n format.html { redirect_to @help_case, notice: 'Help case was successfully updated.' }\n format.json { render :show, status: :ok, location: @help_case }\n else\n format.html { render :edit }\n format.json { render json: @help_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n respond_to do |format|\n if @health_case.update(health_case_params)\n format.html { redirect_to @health_case, notice: 'Health case was successfully updated.' }\n format.json { render :show, status: :ok, location: @health_case }\n else\n format.html { render :edit }\n format.json { render json: @health_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_case\n if params[:action] == \"update\" \n @case = Case.find(params[:format])\n else\n @case = Case.find(params[:id])\n end\n end", "def update\n @stage = Stage.find(params[:id])\n\n if @stage.update_attributes(params[:stage])\n head :no_content\n else\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end", "def update\n respond_to do |format|\n if @test_case_result.update(test_case_result_params)\n format.html { redirect_to @test_case_result, notice: 'Test case result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_case_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @coff = Coff.find(params[:id])\n\n respond_to do |format|\n if @coff.update_attributes(params[:coff])\n format.html { redirect_to @coff, notice: 'Coff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @coff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @case = Case.find(params[:id])\n\n if current_user.district_id and !current_user.admin?\n @districts = District.where(\"id = #{current_user.district_id}\")\n @phis = Phi.where(\"district_id = #{current_user.district_id}\")\n else\n @districts = District.all\n @phis = Phi.all\n @centers = Center.all\n end\n @centers = (@phis.count == 1)? Center.where(\"phi_id = #{@phis.first.id}\") : Center.all\n @hes = He.where(:center_id => @centers.map { |id| id })\n\n @laboratories = Laboratory.all\n @agents = Agent.all\n @doctors = User.find_all_by_user_type(1)\n @nurses = User.find_all_by_user_type(2)\n\n @municipalities = Municipality.all\n @icds = Icd.all\n\n respond_to do |format|\n if @case.update_attributes(params[:case])\n format.html { redirect_to @case, notice: t(\"record_updated\") }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end", "def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end", "def update\n respond_to do |format|\n if @case_contact.update(case_contact_params)\n format.html { redirect_to @case_contact, notice: 'Case contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_contact }\n else\n format.html { render :edit }\n format.json { render json: @case_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fixture = Fixture.find(params[:id])\n\n respond_to do |format|\n if @fixture.update_attributes(fixture_params)\n format.json { head :no_content }\n else\n format.json { render json: @fixture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @when_factor = WhenFactor.find(params[:id])\n\n respond_to do |format|\n if @when_factor.update_attributes(params[:when_factor])\n format.html { redirect_to(@when_factor, :notice => 'WhenFactor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @when_factor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def test_update_object_by_id\r\n\t VCR.use_cassette('edit_object') do\r\n\t\t cred=JSON.parse(YAML::load_file('test/fixtures/credential.yml').to_json)\r\n\t\t json = JSON.parse(File.read(\"test/fixtures/edit_specimen.json\"))\r\n\t\t id = json[\"id\"]\r\n\t\t json[\"id\"] = \"\" #id cannot be updated\r\n\t\t result=CordraRestClient::DigitalObject.update(API_URL, id, json, cred[\"uc_1\"])\r\n\r\n\t\t #check that the result is saved\r\n\t\t assert_equal 200, result[:code]\r\n\t\t assert_equal \"OK\", result[\"message\"]\r\n\t\tend\r\n\t end", "def update\n @commission_fixing = CommissionFixing.find(params[:id])\n if @commission_fixing.update_attributes(params[:commission_fixing])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@commission_fixing.errors)\n end \n end", "def update\n if @inciting_incident.update(inciting_incident_params)\n render json: @inciting_incident\n else\n render json: @inciting_incident.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @testing_.update(testing__params)\n format.html { redirect_to @testing_, notice: 'Testing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testing_.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n begin\n DetailValue.transaction do\n # Increment the instance version\n increment_instance_version\n @resource = update_value(params[:detail_id], \n params[:id], \n {\n 'lock_version' => params[:value][:lock_version],\n 'value' => params[:value][:value] \n })\n \n end\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(attrs, user = @@default_user)\n attrs = { id: @id, project_token: @project_token }.merge(attrs)\n @attributes = send_request(\"test_cases/#{attrs[:id]}\", :put) do |req|\n req.body = {\n test_case: attrs.except(:project_token, :id),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end", "def update\n put :update\n end", "def update\n @contest = Contest.find_by(path: params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to contest_path(@contest.path)+'/upload' }\n #format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case_type.update(case_type_params)\n format.html { redirect_to @case_type, notice: 'Case type was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_type }\n else\n format.html { render :edit }\n format.json { render json: @case_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @federal1870_census_entry = Federal1870CensusEntry.find(params[:id])\n\n respond_to do |format|\n if @federal1870_census_entry.update_attributes(params[:federal1870_census_entry])\n format.html { redirect_to @federal1870_census_entry, notice: 'Federal1870 census entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @federal1870_census_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @scenario.update(scenario_params)\n \trender json: @scenario\n else\n \trender json: {status: 'ERROR', data: @scenario.errors}\n end\n end", "def update\n @cys_env = CysEnv.find(params[:id])\n\n respond_to do |format|\n if @cys_env.update_attributes(params[:cys_env])\n format.html { redirect_to @cys_env, notice: 'Cys env was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cys_env.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incidentfile.update(incidentfile_params)\n format.html { redirect_to @incidentfile, notice: 'Incidentfile was successfully updated.' }\n format.json { render :show, status: :ok, location: @incidentfile }\n else\n format.html { render :edit }\n format.json { render json: @incidentfile.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6711896", "0.65818405", "0.6581335", "0.65460473", "0.6439138", "0.6439138", "0.6423243", "0.6403417", "0.63707453", "0.6334637", "0.6314163", "0.63080406", "0.62844574", "0.6270418", "0.624075", "0.6198778", "0.6185872", "0.6181805", "0.61810464", "0.61653215", "0.6143116", "0.6141157", "0.6103113", "0.610151", "0.60787255", "0.6075094", "0.6064598", "0.606142", "0.6057547", "0.6055871", "0.60487473", "0.6046472", "0.60457975", "0.60441476", "0.60440886", "0.60236347", "0.59748065", "0.5972476", "0.5957953", "0.5955245", "0.5948946", "0.5948557", "0.5943513", "0.5941089", "0.5930883", "0.59280777", "0.59264296", "0.59262866", "0.58956647", "0.58935577", "0.58921266", "0.5873419", "0.5873419", "0.58638227", "0.58620447", "0.5860612", "0.5843807", "0.5838935", "0.58250064", "0.5822917", "0.5820728", "0.582003", "0.58167166", "0.581651", "0.58086044", "0.5805853", "0.5804085", "0.5804056", "0.5804056", "0.5803242", "0.5802122", "0.5792742", "0.5788547", "0.5786558", "0.5785038", "0.5772725", "0.5772194", "0.5763524", "0.57599103", "0.57563615", "0.57549876", "0.57533056", "0.57528585", "0.57519627", "0.5751412", "0.5750966", "0.57506794", "0.5749614", "0.5745683", "0.57378733", "0.5734229", "0.57339144", "0.5725648", "0.5723112", "0.5722896", "0.57220876", "0.57164216", "0.5712367", "0.5711499", "0.571078" ]
0.64969677
4
DELETE /sf_cases/1 DELETE /sf_cases/1.json
def destroy SFCase.destroy(params["id"]) respond_to do |format| set_success_flash_message("Case was successfully destroyed.") format.html { redirect_to "/sf_cases" } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @clientcase = Clientcase.find(params[:id])\n @clientcase.destroy\n\n respond_to do |format|\n format.html { redirect_to clientcases_url }\n format.json { head :ok }\n end\n end", "def destroy\n @test_case.destroy\n respond_to do |format|\n format.html { redirect_to test_cases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @case.destroy\n respond_to do |format|\n format.html { redirect_to cases_path }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @use_case = UseCase.find(params[:id])\n @use_case.destroy\n\n respond_to do |format|\n format.html { redirect_to use_cases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_case.destroy\n respond_to do |format|\n format.html { redirect_to line_cases_url, notice: 'Line case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_case = current_user.test_cases.find(params[:id])\n @test_case.logical_delete\n \n respond_to do |format|\n format.html { redirect_to(test_cases_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @case = Case.find(params[:id])\n @case.destroy\n\n respond_to do |format|\n format.html { redirect_to cases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to testcases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @case_request.destroy\n respond_to do |format|\n format.html { redirect_to case_requests_url, notice: 'Case request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @case_test.destroy\n respond_to do |format|\n format.html { redirect_to case_tests_url, notice: 'Case test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_case = TestCase.find(params[:id])\n @test_case.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_cases_url) }\n format.xml { head :ok }\n end\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def destroy\n @case.destroy\n respond_to do |format|\n format.html { redirect_to admin_cases_url, notice: 'Case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case.destroy\n respond_to do |format|\n format.html { redirect_to cases_url, notice: 'Case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case.destroy\n respond_to do |format|\n format.html { redirect_to cases_url, notice: 'Case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case.update_columns(deleted: true)\n respond_to do |format|\n format.html { redirect_to cases_url, notice: 'Case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case_study = CaseStudy.find(params[:id])\n @case_study.destroy\n\n respond_to do |format|\n format.html { redirect_to case_studies_url }\n format.json { head :ok }\n end\n end", "def destroy\n @case_study = CaseStudy.find(params[:id])\n @case_study.destroy\n\n respond_to do |format|\n format.html { redirect_to case_studies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @success_case = SuccessCase.find(params[:id])\n @success_case.destroy\n\n respond_to do |format|\n format.html { redirect_to(success_cases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @casefile.destroy\n respond_to do |format|\n format.html { redirect_to casefiles_url, notice: 'Casefile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Seances::UseCases::Delete.new.call(id: params[:id])\n end", "def destroy\n @admin_showcase.destroy\n respond_to do |format|\n format.html { redirect_to admin_showcases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spatial_coverages = SpatialCoverages.find(params[:id])\n @spatial_coverages.destroy\n\n respond_to do |format|\n format.html { redirect_to spatial_coverage_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 destroy\n @health_case.destroy\n respond_to do |format|\n format.html { redirect_to health_cases_url, notice: 'Health case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case_study.destroy\n respond_to do |format|\n format.html { redirect_to :delete, flash: { message: 'Case study was successfully deleted.' } }\n format.json { head :no_content }\n end\n end", "def destroy\n @use_case = UseCase.find(params[:id])\n @use_case.destroy\n\n respond_to do |format|\n format.html { redirect_to project_use_cases_path @project }\n format.json { head :no_content }\n end\n end", "def destroy\n @yfcase = Yfcase.find(params[:id])\n @yfcase.destroy\n respond_to do |format|\n format.html { redirect_to yfcases_url, notice: 'Yfcase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ssd.destroy\n respond_to do |format|\n format.html { redirect_to ssds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @casestudy = Casestudy.find(params[:id])\n @casestudy.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_casestudies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scenario = Scenario.find(params[:id])\n @scenario.destroy\n\n respond_to do |format|\n format.html { redirect_to scenarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scenario = Scenario.find(params[:id])\n @scenario.destroy\n\n respond_to do |format|\n format.html { redirect_to scenarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_scaff.destroy\n respond_to do |format|\n format.html { redirect_to test_scaffs_url, notice: 'Test scaff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @support_case = SupportCase.find(params[:id])\n @support_case.destroy\n\n respond_to do |format|\n format.html { redirect_to support_cases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @design_case.destroy\n respond_to do |format|\n format.html { redirect_to design_cases_url, notice: 'Design case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case_study.destroy\n respond_to do |format|\n format.html { redirect_to case_studies_url, notice: 'Case study was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case_study.destroy\n respond_to do |format|\n format.html { redirect_to case_studies_url, notice: 'Case study was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case_doc.destroy\n respond_to do |format|\n format.html { redirect_to case_docs_url, notice: 'Case doc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case = Case.find(params[:id])\n @case.destroy\n\n respond_to do |format|\n format.html { redirect_to(cases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @showcase = Showcase.find(params[:id])\n @showcase.destroy\n\n respond_to do |format|\n format.html { redirect_to(showcases_url) }\n format.xml { head :ok }\n end\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n @casestudy.destroy\n respond_to do |format|\n format.html { redirect_to casestudies_url, notice: \"Casestudy was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to(testcases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @expensesbasis.destroy\n respond_to do |format|\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_case.destroy\n respond_to do |format|\n format.html { redirect_to test_suite_test_cases_url, notice: 'Test case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @cys_env = CysEnv.find(params[:id])\n @cys_env.destroy\n\n respond_to do |format|\n format.html { redirect_to cys_envs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @case.sub_cases.exists?\n flash[:error] = \"Cannot delete this case because it has subcases attached\"\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n else\n @case.destroy\n respond_to do |format|\n format.html { redirect_to cases_url, notice: 'Case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n\n end", "def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @security_case = SecurityCase.find(params[:id])\n @security_case.destroy\n\n respond_to do |format|\n format.html { redirect_to(security_cases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_case_entry = TestCaseEntry.find(params[:id])\n @test_case_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_case_entries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @fixturestat = Fixturestat.find(params[:id])\n @fixturestat.destroy\n\n respond_to do |format|\n format.html { redirect_to fixturestats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_plan = ExercisePlan.find(params[:id])\n @exercise_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @coverage.destroy\n respond_to do |format|\n format.html { redirect_to coverages_url, notice: 'Coverage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\n end", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @code_case.destroy\n respond_to do |format|\n format.html { redirect_to code_cases_url, notice: 'Code case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_summary = TestSummary.find(params[:id])\n @test_summary.destroy\n\n respond_to do |format|\n format.html { redirect_to test_summaries_url }\n format.json { head :no_content }\n end\n end", "def 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 #@clinica.destroy\n @clinica.update(:status => 0)\n respond_to do |format|\n format.html { redirect_to clinicas_url }\n format.json { head :no_content }\n end\n end", "def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend", "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @patentcase = Patentcase.find(params[:id])\n @patentcase.destroy\n\n respond_to do |format|\n format.html { redirect_to patentcases_url }\n format.json { head :ok }\n end\n end", "def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end", "def destroy\n @test1.destroy\n respond_to do |format|\n format.html { redirect_to test1s_url, notice: \"Test1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @incidentfile.destroy\n respond_to do |format|\n format.html { redirect_to incidentfiles_url, notice: 'Incidentfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_evaluation_case2.destroy\n respond_to do |format|\n format.html { redirect_to student_evaluation_case2s_url, notice: 'Student evaluation case2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @diseasesubset.destroy\n respond_to do |format|\n format.html { redirect_to diseasesubsets_url, notice: 'Diseasesubset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_case_result.destroy\n respond_to do |format|\n format.html { redirect_to test_case_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n HardInfo.where(c_office: @use_case.c_office, use_case_no: @use_case.use_case_no, product_name: @use_case.product_name).destroy_all\n @use_case.destroy\n respond_to do |format|\n format.html { redirect_to use_cases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_plan = TestPlan.find(params[:id])\n @test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to test_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testdb = Testdb.find(params[:id])\n @testdb.destroy\n\n respond_to do |format|\n format.html { redirect_to testdbs_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\n end", "def destroy\n @test_stall.destroy\n respond_to do |format|\n format.html { redirect_to test_stalls_url, notice: 'Test stall was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fabrica.destroy\n respond_to do |format|\n format.html { redirect_to fabricas_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @county = County.find(params[:id])\n @county.destroy\n\n respond_to do |format|\n format.html { redirect_to counties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @assessment_insti_test = AssessmentInstiTest.find(params[:id])\n @assessment_insti_test.destroy\n\n respond_to do |format|\n format.js {render :nothing => true}\n format.html { redirect_to assessment_insti_test_url }\n format.json { head :ok }\n end\n end", "def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.70907694", "0.70324045", "0.7020169", "0.7004433", "0.6951409", "0.69214576", "0.6884835", "0.6859916", "0.685938", "0.68189925", "0.6804692", "0.6779232", "0.67689085", "0.6729938", "0.6727825", "0.6718378", "0.6718378", "0.6716785", "0.67131567", "0.67049474", "0.67019296", "0.66941714", "0.66522866", "0.6651534", "0.66420096", "0.6635631", "0.6631233", "0.6626816", "0.6608693", "0.6597766", "0.65704286", "0.655668", "0.653627", "0.653627", "0.6526021", "0.65242666", "0.6516686", "0.65054893", "0.65054893", "0.6500643", "0.6500286", "0.64883894", "0.64849365", "0.6479318", "0.6478366", "0.64729583", "0.6463224", "0.64596516", "0.6448695", "0.6445657", "0.6433162", "0.6430469", "0.64292973", "0.6413411", "0.6411436", "0.64078397", "0.6406063", "0.6402741", "0.64006424", "0.639044", "0.63890016", "0.6382578", "0.6378512", "0.63758945", "0.6375114", "0.63678354", "0.63678354", "0.63678354", "0.63678354", "0.63664424", "0.6362457", "0.6361385", "0.6359567", "0.6358926", "0.6358764", "0.6358707", "0.6358254", "0.6357704", "0.63549507", "0.63549507", "0.63549507", "0.63549507", "0.6350883", "0.63474584", "0.634124", "0.63405955", "0.6333025", "0.6330681", "0.63290846", "0.6328425", "0.6327734", "0.63230634", "0.63212705", "0.6318257", "0.63182044", "0.631819", "0.631819", "0.6317573", "0.6314648", "0.6312014" ]
0.69513464
5
Use callbacks to share common setup or constraints between actions.
def set_sf_case @sf_case = SFCase.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 sf_case_params params.require(:sf_case).permit(SFCase.attributes) 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 valid_params_request?; 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 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 safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\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 social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\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 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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n 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 url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62909746", "0.62904227", "0.62837297", "0.6240993", "0.6239739", "0.6217764", "0.6214983", "0.62112504", "0.6194765", "0.6178", "0.61755055", "0.61729854", "0.61636627", "0.6153461", "0.6151674", "0.61478525", "0.6122671", "0.61188513", "0.61075556", "0.6105721", "0.6092412", "0.6081011", "0.6071054", "0.6064436", "0.6022111", "0.6018135", "0.60151577", "0.60108894", "0.60070235", "0.60070235", "0.6000806", "0.6000464", "0.5998811", "0.59926987", "0.5992257", "0.5991173", "0.5980311", "0.59660876", "0.59596545", "0.5959415", "0.59589994", "0.5957478", "0.5953214", "0.5952233", "0.5944033", "0.59396756", "0.59396756", "0.59386414", "0.59345603", "0.5931261", "0.5926345", "0.5925795", "0.59174526", "0.59108645", "0.5909469", "0.5908263", "0.59053195", "0.58980685", "0.5897738", "0.589657", "0.5895971", "0.58942044", "0.5892847", "0.588742", "0.58834344", "0.5880024", "0.58739793", "0.5868253", "0.5867907", "0.58670515", "0.58668053", "0.5865756", "0.5863549", "0.5863236", "0.5862728", "0.5861283", "0.58591247", "0.5855159", "0.5854291", "0.58512247", "0.58498096" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_session @session = Session.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 session_params params.require(:session).permit(:start_time, :end_time, :session_teacher, :session_student) 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
For simplicity reasons no User model was created with an api_token attribute A bare simple string is used and saved in Rails credentials mocking up a user based generated JWT that is usually stored in DB
def client_has_valid_token? request.headers["Authorization"] == Rails.application.credentials.guessing_access_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_token\n @user = T.must(current_user)\n\n authorize @user, policy_class: SettingsPolicy\n\n token = @user.api_token\n\n # Create a token if the user doesn't already have one.\n if token.nil?\n @user.api_token = Devise.friendly_token\n @user.save\n token = @user.api_token\n end\n\n respond_to do |format|\n format.json { render json: token.to_json }\n end\n end", "def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end", "def auth_token \n JWT.encode({id: self.id}, \"9885ea7895518eaf88c4a8a2e8f62c82\")\n end", "def call\n JsonWebToken.encode(user_id: api_user.id) if api_user\n end", "def dev_jwt_token\n JWT.encode(\n {user_id: id},\n Rails.application.secrets.json_web_token_key,\n 'HS256'\n )\n end", "def auth_token\n JWT.encode({ id: self.id }, '65bc368fbc69306')\n end", "def generate_token!\n new_token = User.unique_random(field_name: 'api_token')\n update_column(:api_token, new_token)\n end", "def create_token\n\t\tself.token = BCrypt::Password.create(User.find(self.user_id).email + Time.now.to_f.to_s)\n\tend", "def generate_token\n begin\n token = Other::TokenGenerator.call(25).value_or('')\n end until !User.where(token: token).nil?\n self.bf_api_token = token\n end", "def create\n user = User.find_by(email: auth_params[:email])\n if user&.valid_password?(auth_params[:password])\n @token = user.api_tokens.find_or_create_by(name: (auth_params[:name] || \"default\")) do |token|\n token.make_token.save!\n end\n render json: {\n token: @token.token\n }\n else\n head :unauthorized\n end\n end", "def auth_token\n TokenProvider.issue_token(\n first_name: object.first_name,\n last_name: object.last_name,\n username: object.username,\n user_id: object.id,\n role: object.role\n )\n end", "def generate_api_token\n token = nil\n loop do\n token = Devise.friendly_token\n break token unless ApiToken.where(token: token).first\n end\n ApiToken.create({\n token: token,\n user_id: self.id\n })\n end", "def token\n\t\t@token = ApiKey.find_by_user_id(self.id)\n\t\tif @token == nil\n\t\t\t\treturn ApiKey.create!(user: self)\n\t\telse\n\t\t\t\treturn @token\n\t\tend\n\tend", "def generate_token(_user)\n JsonWebToken.encode(login_payload, 3.days.from_now)\n end", "def encode_token(payload) #encodes your username\n JWT.encode(payload, ENV['SECRET'])\n end", "def call\n JsonWebToken.encode(user_id: user.id) if user\n end", "def call\n JsonWebToken.encode(user_id: user.id) if user\n end", "def call\n # after user login, will pass the user-id to the JWT to create token\n return nil unless user\n\n return JsonWebToken.create_token(user_id: user.id), user\n end", "def generate_api_key\n @user.api_key = BCrypt::Engine.generate_salt\n end", "def generate_unique_secure_token\n return unless user_id\n\n unless ENV['JWT_HMAC_SECRET'].present?\n raise 'JWT_HMAC_SECRET is missing in env' unless Rails.env.test?\n end\n\n self.token ||= ::JWT.encode(\n {\n user: {\n id: user_id,\n created_at: Time.now.utc.iso8601(3)\n }\n },\n ENV['JWT_HMAC_SECRET'],\n 'HS256'\n )\n end", "def generate_new_authentication_token\n token = User.generate_unique_secure_token\n update_attributes authentication_token: token\n end", "def create_token(id, username)\n JWT.encode(payload(id, username), ENV['JWT_SECRET'], 'HS256')\n end", "def create_token(id, username)\n JWT.encode(payload(id, username), ENV['JWT_SECRET'], 'HS256')\n end", "def create\n @user = User.new(user_params)\n if @user.save\n @token = encode_token({user_id: @user.id})\n render json: {user: @user, token: @token}\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n payload = { user_id: user.id }\n\n hmac_secret = 'my$ecretK3ys'\n\n auth_token = JWT.encode(payload, hmac_secret)\n\n render json: { message: 'Account created successfully', auth_token: auth_token }\n else\n render json: { message: 'Something went wrong', errors: user.errors }, status: :unprocessable_entity\n end\n end", "def generate_auth_token\n self.auth_token = SecureRandom.hex\n end", "def create\n @user = User.create_or_find_by(user_params)\n my_token = issue_token(@user)\n\n render json: {user: @user, token: my_token}\n # render json: @user\n \n end", "def create\n @user = User.create(user_params)\n if @user.valid?\n payload = { id: @user.id}\n token = JWT.encode(payload, 'my$ecretK3y', 'HS256')\n render json: { id: @user.id, username: @user.username, token: token }\n else\n render json: { error: 'failed to create user' }, status: :not_acceptable\n end\n end", "def create\n user = User.create(user_params)\n wristband = encode_token({user_id: user.id})\n if user.valid?\n render json: {user: UserSerializer.new(user), token: wristband}\n else \n render json: {errors: user.errors.full_messages}\n end\n end", "def api_token\n client.get(\"/user/api_token\").fetch(\"result\")\n end", "def generate_token\n begin\n self[:auth_token] = SecureRandom.urlsafe_base64\n end while User.exists?(:auth_token => self[:auth_token])\n end", "def create\n user = User.new(username: params[:username])\n if user.save\n payload = {'user_id': user.id}\n token = JWT.encode(payload, 'chatapp')\n render json: {\n user: user,\n token: token\n }\n else \n render json: { message: 'There was an error creating your account' }\n end\n end", "def create\n @user = User.create(user_params)\n if @user.valid?\n token = encode_token({user_id: @user.id})\n render json: {user: @user, token: token}\n else\n render json: {error: \"Invalid username or password\"}\n end\n end", "def create\n @user = User.create(user_params)\n if @user.valid?\n token = encode_token({user_id: @user.id})\n render json: {user: @user, token: token}\n else\n render json: {error: \"Invalid username or password\"}\n end\n end", "def auth_token\n AuthToken.new payload: { sub: user.id }\n end", "def generate_auth_token\n token = SecureRandom.hex\n self.update_columns(auth_token: token)\n token\n end", "def auto_login\n @token = params[:token]\n # byebug\n user = User.find(JWT.decode(@token, \"put your secret password here\", true, algorithm: 'HS256')[0][\"user_id\"])\n render json: user\n end", "def create_set_and_add_token\n token = SecureRandom.urlsafe_base64\n @user.token = token\n response.headers['X-AUTH-TOKEN'] = token\n end", "def create\n user = User.find_for_authentication(email: user_params[:email])\n\n if user && user.valid_password?(user_params[:password])\n user.generate_authentication_token\n\n expose({\n user_id: user.id,\n token: user.authentication_token\n })\n else\n error! :unauthenticated\n end\n end", "def token\n return self[:token] if self[:token] # <- Will not generate a token more than once.\n begin\n byte_string = [self.user_id, rand(2**32)].pack('L*') << rand(256)\n self[:token] = Base64.urlsafe_encode64(byte_string)\n end while UserAuthToken.exists?(token: self[:token])\n end", "def call\n\t\tJsonWebToken.encode(user_id: user.id) if user\t\n\tend", "def new_jwt\n Knock::AuthToken.new(payload: { sub: current_user.id }).token\n end", "def create\n # login\n user = User.authenticate(params[:user][:email], params[:user][:password])\n\n respond_to do |format|\n if user\n # Create an api token for this user.\n user.enable_api!\n format.json { render :json => user }\n else\n format.json { head :unauthorized }\n end\n end\n end", "def create\n @user = User.create(user_params)\n if @user.save\n token = JWT.encode({user_id: @user.id}, 'SECRET')\n response = { message: 'User has been successfully created' }\n render json: {user_id: @user.id, username: @user.username, type: @user.type, name: @user.name, jwt: token}\n else\n render json: {error: \"does not work\"}, status: 422\n end\n end", "def generate_authentication_token\n self.auth_token = User.new_token\n\t\t\tself.auth_expires_at = Time.now + 240.hours\n\tend", "def call\n Utils::TokenManager.encode(user_id: user.id) if user\n end", "def create_user_token(params)\n key = Time.now.strftime(\"%Y-%m-%d %H:%M:%S:\") + '%012d' % rand(10_000_000_000)\n { :user_token => { :username => params[:username],\n :key => key,\n :hash => Digest::SHA1.hexdigest(params[:password] + key) } }\n end", "def create\n @user=User.new(name: user_params[:name], email: user_params[:email], type: user_params[:type], age: user_params[:age], password: user_params[:password])\n print @user.valid?\n if @user.save\n payload={user_id: @user.id}\n token = encode_token(payload)\n render json: {user: @user, jwt: token}\n else\n render json: User.all\n end\n end", "def create\n user = User.create!(user_params)\n render json: { token: user.auth_token }\n end", "def create_token(user_id)\n payload = { user_id: user_id }\n # Creates a token. Encoding something just creates a token\n JWT.encode(payload, secret, 'HS256')\n end", "def encode_token(payload) # arg is data identifying user — e.g., DB id and username\n \n JWT.encode(payload, secret,algorithm)\n end", "def login_request\n #TODO validate incoming parameters\n client_user = User.new params.require(:user).permit(\n :user,\n :external_id,\n :name,\n :email,\n :access_token,\n :profile_pictures)\n client_user.password = \"1\"\n\n # This is to spam calls to api which will cause unwanted entries into database \n\n existing_user = User.find_by(external_id: client_user.external_id)\n if existing_user.blank?\n client_user.save\n else\n # WHY IS THIS REQUIRED?\n existing_user.name = client_user.name\n\n # NO POINT SAVING THIS TOKEN - this is short lived.\n existing_user.access_token = client_user.access_token\n existing_user.email = client_user.email\n #existing_user.profile_pictures = client_user.profile_pictures\n existing_user.save\n end\n log_in(client_user)\n render :nothing => true\n end", "def create\n user = User.create(user_params)\n\n if user.valid?\n # Moving to ApplicationController for refactoring\n # payload = { user_id: user.id }\n # # JWT.encode(payload, secret, hash algorithm)\n # token = JWT.encode(payload, 'badbreathbuffalo', 'HS256')\n\n render json: {token: create_token(user.id)}\n else\n render json: { errors: user.errors.full_messages }, status: 422\n end\n end", "def get_user_info_from_id_token id_token\n token_parts = id_token.split(\".\")\n encoded_token = token_parts[1]\n leftovers = token_parts[1].length.modulo(4)\n if leftovers == 2\n encoded_token << \"==\"\n elsif leftovers == 3\n encoded_token << \"=\"\n end\n decoded_token = Base64.urlsafe_decode64(encoded_token)\n jwt = JSON.parse decoded_token\n {email: jwt[\"unique_name\"], name: jwt[\"name\"]}\n end", "def encode_token(payload)\n # I expect something like payload => { userid: int }\n JWT.encode(payload, Rails.application.secrets.secret_key_base)\n end", "def create\n @user = User.create(user_params)\n if @user.valid?\n @token = encode_token(user_id: @user.id)\n render json: { user: @user, jwt: @token}, status: :created\n # render json: { user: UserSerializer.new(@user), jwt: @token}, status: :created\n else \n render json: { error: 'That username already exists. Try again.' }, status: :not_acceptable\n end\n end", "def generate_token(user)\n payload = {user_id: user.id}\n JWT.encode(payload, ENV[\"SEC_KEY\"] , 'HS256')\n end", "def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end", "def token\n @token ||= JWT.decode(jwt_string, secret_key, true, verify_expiration: false)\n end", "def authenticated_user_with_token\n ApiKey.find_user_with_token(decoded_token)\n end", "def create\n @user = User.create(user_params)\n # p @user.valid?\n # p @user\n # p user_params\n if @user.valid?\n token = encode_token({user_id: @user.id})\n render json: {user: @user, token: token}\n else\n render json: {error: \"Invalid username or password\"}\n end\n end", "def create\n # byebug\n @user = User.create(user_params)\n if @user.valid?\n token = encode_token({user_id: @user.id})\n render json: {\n user: UserSerializer.new(@user), \n token: token\n }\n else\n render json: {error: \"Invalid user\"}, status: 422\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token }, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def make_token(user_id)\n payload = { user_id: user_id }\n JWT.encode(payload, hmac_secret, 'HS256')\n end", "def generate_and_set_token(user=nil)\n user ||= create(:user_with_token)\n current_time = Time.now\n jwt_config = Rails.application.secrets.jwt\n token = JWT.encode({\"iat\" => current_time.to_i,\n \"iss\" => jwt_config['issuer'],\n \"exp\" => (current_time + 14.days).to_i,\n \"user_id\" => user.id},\n jwt_config['secret_key'],\n jwt_config['hmac_sha_algo'])\n request.headers['Authorization'] = \"Bearer #{token}\"\n end", "def login_api\n @user = User.find_for_database_authentication({:username => params[:username].downcase})\n\n if ([email protected]?)\n if ([email protected]_password?(params[:password]))\n @user = nil\n end\n end\n\n if (@user.nil?)\n @user = User.find_by_auth_token(params[:auth_token]) unless params[:auth_token].nil?\n else\n @user.generate_auth_token\n end\n\n if @user.nil?\n # Do nothing\n error \"Your username or password was incorrect.\"\n else\n render json: @user\n end\n end", "def login_api\n @user = User.find_for_database_authentication({:username => params[:username].downcase})\n\n if ([email protected]?)\n if ([email protected]_password?(params[:password]))\n @user = nil\n end\n end\n\n if (@user.nil?)\n @user = User.find_by_auth_token(params[:auth_token]) unless params[:auth_token].nil?\n else\n @user.generate_auth_token\n end\n\n if @user.nil?\n # Do nothing\n error \"Your username or password was incorrect.\"\n else\n render json: @user\n end\n end", "def create_token(user_id, dev_id)\n token = SecureRandom.base64(384)\n DB[:Token].where(UserID: user_id).where(DeviceID: dev_id)\n .update(Token: token, Timestamp: Time.now.to_i + 600)\n token\n end", "def access_token\n User.create_access_token(self)\n end", "def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end", "def get_token\n # Get the user by email\n user = User.find_by_email(params[:email])\n \n # return unauthorized if the user was not found\n if !user \n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if the user is not authenticated via the authenticate method\n # then return unauthorized\n if !user.authenticate( params[:password] )\n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if our code gets here, we can generate a token and response.\n # JWT's include an expiry, we will expire the token in 24 hours\n token = jwt_encode({user_id: user.id}, 24.hours.from_now)\n render json: {token: token, exp: 24, username: user.email, userId: user.id},\n status: :ok\n \n end", "def generate_jwt\n JWT.encode({ id: id,\n exp: 60.days.from_now.to_i },\n Rails.application.secrets.secret_key_base)\n end", "def login_as(user_id)\n self.token = Token.create!(\n user_id: user_id,\n client: Client.first,\n expires_at: 5.months.from_now\n ).to_jwt\n end", "def api_auth\n creator = Creator.find_by(username: request.headers[:username])\n if creator && creator.authenticate(request.headers[:password])\n render json: { auth_token: encodeJWT(creator) }\n else\n render json: { error: 'Invalid username or password' }, status: :unauthorized\n end\n end", "def create\n # Find the user by the params sent in through the login fetch params \n @user = User.find_by(username: user_login_params[:username])\n \n # User authenticate is a built in method that comes from BCrypt.\n # This next line checks if the user exists, and also if the password given allows access\n if @user && @user.authenticate(user_login_params[:password])\n # encode_token method comes from ApplicationController (which we are inheriting from on line 1).\n #this creates a variable with the value of our token \n @token = encode_token({ user_id: @user.id })\n \n # UserSerializer is a serializer in the serializers folder. To use this the active_model_serializers gem is needed.\n # This helps clean the data that is sent out to limited attributes you want listed\n render json: { user: UserSerializer.new(@user), jwt: @token }, status: :accepted\n \n # Without a serializer or status the following line would suffice\n # render json: { user: @user, jwt: @token}\n \n else\n # Vague error message for user security (never tell someone they got a specific input incorrect), adding a status code \n render json: { message: 'Invalid username or password' }, status: :unauthorized\n end\n end", "def current_api_user\n @current_api_user ||= stub_model(User, email: \"[email protected]\")\n end", "def encode(creator)\n #data to be saved in JSON\n payload = { id: creator.id, userName: creator.userName, expires: 2.hours.from_now.to_i}\n \n #very much safe\n JWT.encode( payload, Rails.application.secrets.secret_key_base, \"HS512\")\n end", "def auth_token(payload = nil)\n if payload.nil?\n payload = {data: {authenticated: true, user: current_user_data}}\n end\n\n EchoCommon::Services::Jwt.encode payload\n end", "def generate_jwt\n JWT.encode({\n id: id, \n exp: 60.days.from_now.to_i\n }, \n Rails.application.secrets.secret_key_base\n )\n end", "def login_token\n user ? email : seed\n end", "def create\n user = User.where(email: params[:user][:email]).first\n if user && user.authenticate(params[:user][:password])\n user.regenerate_token\n render json: { status: :success, data: user.to_json }\n else\n render json: { status: :error, data: 'Invalid login details' }\n end\n end", "def expose_user\n unless params[:user_token].blank?\n @user = User.where(hex: params[:user_token]).first\n end\n end", "def create\n user = User.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end", "def create\n user = User.new(user_params)\n userDB = User.find_by(email: user_params[\"email\"])\n \n if ( userDB == nil )\n if user.save\n token = AuthenticationHelper::Auth.instance.generateJWT( user_params[\"email\"] )\n render json: token, status: :created\n else\n render json: user.errors, status: :unprocessable_entity\n end\n else\n render json: :nothing, status: :unprocessable_entity \n end\n end", "def get_jwt_token\n payload = { data: {user: {id: self.id, email: self.email}} }\n payload[:exp] = (Time.now + Settings.jwt_token_expiry.days).to_i\n\n JWT.encode payload, ENV[\"HMAC_SECRET\"], 'HS256'\n end", "def user\n @user ||= User.find(decoded_auth_token[:user_id]) if decoded_auth_token\n @user || errors.add(:token, 'Invalid Token') && nil\n end", "def user_id\n decoded_token.first['user_id']\n end", "def generate_token\n self.update({:token => SecureRandom.hex})\n end", "def current_user\n if decode_token\n #returns an array\n #user_id is the key on our payload\n user_id = decode_token[0]['user_id']\n #using user_id to find our user\n @user = User.find_by(id: user_id)\n else\n render json: { message: 'Did not find user.' }, status: :unauthorized \n end\n end", "def authentication_token\n @authentication_token ||= JWT.encode(payload, secret, algorithm)\n end", "def create\n payload = {\n user: {\n name: Faker::Name.name,\n email: Faker::Internet.email\n }\n }\n\n jwt = Auth.issue(payload)\n\n render json: { jwt: jwt }\n end", "def token\n\n authenticate_with_http_basic do |email, password|\n user = User.find_by(email: email)\n if user && user.authenticate(password) \n render json: { token: user.api_token }\n else\n render json: { error: 'Incorrect credentials' }, status: 401\n end\n\n end\n end", "def add_api_key\n @user = current_user\n if @user.present?\n @user.api_key = generate_api_key(16, 'user')\n @user.save\n end\n end", "def generate_token\n self.token ||= Base64.urlsafe_encode64(SecureRandom.random_bytes(12))\n end", "def generate_auth_token\n\t token = SecureRandom.hex\n\t #self.update_columns(token_key: token)\n\t token\n\t end", "def generate_auth_token\n \tbegin\n \t\tself.auth_token = User.new_token\n \tend while self.class.exists?(auth_token: auth_token)\n end", "def payload(id, username)\n {\n exp: (Time.now + 30.minutes).to_i,\n iat: Time.now.to_i,\n iss: ENV['JWT_ISSUER'],\n user: {\n id: id,\n username: username\n }\n }\n end", "def payload(id, username)\n {\n exp: (Time.now + 30.minutes).to_i,\n iat: Time.now.to_i,\n iss: ENV['JWT_ISSUER'],\n user: {\n id: id,\n username: username\n }\n }\n end", "def social_login_fill_new_user(user, jwt)\n # no-op\n end", "def generate_token\n self.token = SecureRandom.hex if new_record?\n end", "def create\n user = User.create(user_params)\n if user.valid?\n token = generate_token(user)\n render json: { success: true, token: token }.to_json, status: 200\n else\n render json: { success: false, message: \"Username Taken\" }\n end\n end" ]
[ "0.6974089", "0.69622314", "0.6945459", "0.6909285", "0.69007576", "0.6790934", "0.6765667", "0.6760278", "0.67437714", "0.6720777", "0.67206866", "0.6710268", "0.66933376", "0.6693311", "0.6672992", "0.66634095", "0.66634095", "0.66334426", "0.6629927", "0.66106445", "0.6610328", "0.65932053", "0.65932053", "0.6581933", "0.6566325", "0.6566298", "0.6565315", "0.65593314", "0.65518874", "0.6528155", "0.6527963", "0.6516218", "0.6514565", "0.6514565", "0.65144956", "0.64979756", "0.648321", "0.6471333", "0.64711815", "0.6468605", "0.6462772", "0.6456826", "0.6455468", "0.64468336", "0.6440773", "0.6440658", "0.643972", "0.64392745", "0.64297694", "0.6428882", "0.64281064", "0.6401974", "0.63874304", "0.63857305", "0.63852406", "0.6380448", "0.636316", "0.63437533", "0.63406235", "0.6334647", "0.63297075", "0.63296896", "0.6329535", "0.63219476", "0.6319551", "0.63130456", "0.63130456", "0.6312508", "0.63083327", "0.63042283", "0.6284131", "0.62830496", "0.62772256", "0.62645376", "0.62635624", "0.6263338", "0.62594056", "0.6257646", "0.6257383", "0.62531066", "0.62511694", "0.6249589", "0.6245458", "0.6243411", "0.62339896", "0.623211", "0.62254274", "0.6221358", "0.6214447", "0.6213026", "0.6206092", "0.62054724", "0.62034154", "0.62002605", "0.6197767", "0.6197219", "0.6190756", "0.6190756", "0.61906", "0.6182942", "0.6180353" ]
0.0
-1
POST /list_items POST /list_items.json
def create lip = list_item_params list_type_id: params[:list_type_id] new_item = current_user.list_items.create(lip) respond_with new_item end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def create\n\n nested = params[:list].delete(:list_items_attributes)\n\n @list = List.new( params[:list] )\n @list.user = current_user\n\n records = nested.collect do |_, fields| \n\n ListItem.new( { \"list\" => @list }.merge( fields ) ) if !item_blank?( fields )\n\n end.compact\n\n respond_to do |format|\n if @list.save && records.map( &:save ).all?\n\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n\n else\n\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def create\n list = List.find(params[:list_id])\n @list_item = list.list_items.new(list_items_params)\n @list_item.save ? json_response(@list_item) : json_response(@list_item.errors, status = :not_acceptable)\n end", "def create\n @item = Item.create(item_params)\n @items = List.find(item_params[:list_id]).items.order(\"id ASC\")\n @list_id = item_params[:list_id]\n end", "def list_items_list(page_id = current_page_id, list_id = current_list_id)\n request \"page/#{page_id}/lists/#{list_id}/items/list\"\n end", "def create\n ListItem.transaction do\n item = Item.new(item_params)\n item.save\n\n @list_item = ListItem.new(list_item_params)\n @list_item.item_id = item.id\n @list_item.list_id = params[:list_id]\n\n\n if @list_item.save\n render json: @list_item, status: :created\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end\n end", "def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end", "def create\n @item = @list.items.create(item_params)\n redirect_to @list\n end", "def create\n @listitem = Listitem.new(listitem_params)\n\n if @todolist.listitems << @listitem\n render :show, status: :created, location: todolist_listitem_path(@todolist, @listitem)\n else\n render json: @listitem.errors, status: :unprocessable_entity\n end\nend", "def create\n create_params = item_params\n item = Item.new(\n name: create_params[:name], \n is_complete: false, #create_params[:is_complete], \n list_id: create_params[:list_id])\n\n item.save!\n render json: item\n end", "def create\n @tags = Tag.all\n @list_item = @list.list_items.new(list_item_params)\n\n respond_to do |format|\n if @list_item.save\n format.html { redirect_to list_path(@list), notice: 'List item was successfully created.' }\n format.json { render :show, status: :created, location: @list_item }\n else\n format.html { render :new }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @list = List.find(params[:list_id])\n @item = @list.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def list_item_params\n params[:list_item]\n end", "def create\n @list = current_user.lists.find params[:list_id]\n @item = @list.items.build(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to list_items_path(@list), notice: 'Item was successfully created.' }\n #format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n #format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @list = List.find(params[:list_id])\n @items = @list.items\n\n respond_with @items\n end", "def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to lists_path, :notice => 'Item was successfully created.' }\n format.json { render :json => lists_path, :status => :created, :location => lists_path }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def createItemOfList\n results1 = checkUser(params[:target_account]) #userid user to give the money\n if results1.code == 200\n parameters={user_id: (@current_user[\"id\"]).to_i, description: (params[:description]), date_pay: params[:date_pay], cost: params[:cost], target_account: params[:target_account], state_pay:params[:state_pay]}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4055/lists\", options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n elsif results1.code == 404\n renderError(\"Not Found\", 404, \"The resource does not exist\")\n end\n end", "def list_item_params\n params.require(:list_item).permit(:item_name, :quantity, :list_id)\n end", "def items\n response = @client.request :get, \"#{LISTS_PATH}/#{@id}\"\n raise(StandardError, 'unexpected response') unless response\n response['items']&.map { |i| TodoableItem.new self, i, @client }\n end", "def create\n @list_item = ListItem.new(list_item_params)\n\n respond_to do |format|\n if @list_item.save\n format.html { redirect_to @list_item, notice: 'List item was successfully created.' }\n format.json { render :show, status: :created, location: @list_item }\n else\n format.html { render :new }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list_item }\n end\n end", "def list_item_params\n params.require(:list_item).permit(:name, :description, :status)\n end", "def create\n @item = @list.items.build(item_params)\n @item.user = current_user\n\n if @item.save\n return success_item_create\n else\n return error_item_save\n end\n end", "def create\n @item_list = ItemList.new(item_list_params)\n @item_list.user_id = current_user.id\n\n respond_to do |format|\n if @item_list.save\n format.html { redirect_to @item_list, notice: 'Item list was successfully created.' }\n format.json { render :show, status: :created, location: @item_list }\n else\n format.html { render :new }\n format.json { render json: @item_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_todo_item(name, list_id)\n data = {\n item: {\n name: name\n }\n }\n rest(\"post\", \"lists/#{list_id}/items\", data)\n end", "def update\n @list.append_items!(params.dig(:list, :items), current_user)\n redirect_to [@project, @randomization_scheme], notice: \"Items successfully added.\"\n end", "def create\n\n @list_item = @list.list_items.create!(list_item_params)\n #@list_item = @list.list_items.create!(params[:list_item])\n\n respond_to do |format|\n if @list_item.save\n format.html { redirect_to list_path(@list), notice: 'List item was successfully created.' }\n format.json { render :show, status: :created, location: @list_item }\n else\n format.html { render :new }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @list_items = @list.list_items\n end", "def new\n @list = List.new\n\n @list.list_items.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def make_item_list\n end", "def add_list_item(content,page_id = current_page_id, list_id = current_list_id)\n # POST /ws/page/#{page_id}/lists/#{list_id}/items/add\n request \"page/#{page_id}/lists/#{list_id}/items/add\", \"item\" => { \"content\" => content }\n end", "def index\n @list_items = ListItem.all\n end", "def index\n @list_items = ListItem.all\n end", "def list_item_params\n params.require(:list_item).permit(:list_id, :item_name, :description, :size, :number_wanted, :store_name, :url)\n end", "def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend", "def list_item_params\n params.require(:list_item).permit(:list_id, :name, :deleted_at, :deleted, :tag_id)\n end", "def list_item_params\n params.require(:list_item).permit(:list_id, item_id)\n end", "def list_params\n params.require(:list).permit(:title, \n :description, \n :list_type_id, \n :list_type,\n list_items_attributes: [:item, :id, :_destroy]\n )\n end", "def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end", "def create\n @list = List.create!(list_params)\n json_response(@list, :created)\n end", "def new\n @item = Item.new(:list_id => params[:list_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def get_list\n \t@items\n end", "def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully added.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n task\n if @item.update(item_params)\n render json: @list.as_json, status: :ok\n else\n render json: {list: @item.errors, status: :unprocessable_entity}\n end\n end", "def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end", "def index\n @listitems = @todolist.listitems\nend", "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 update\n item = @list.list_items.find(params[:id])\n\n if item.update_attributes(params[:list_item])\n render json: item\n else\n error(t('messages.list_item.errors.update'))\n end\n end", "def update_list(item_name, item_list, quantity)\n add_list(item_name, item_list, quantity)\nend", "def create\n @item = Item.new(item_params)\n if @item.save\n @items = Item.all\n render status: 201, :json => @item\n \n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n \n \n end", "def index\n @item_lists = ItemList.all\n end", "def set_item_list\n @item_list = ItemList.find(params[:id])\n end", "def item_params\n params.require(:item).permit(:name, :tag_list, :type_list, :description)\n end", "def list_item_params extras={}\n params.require(:list_item).merge(extras).except(:id).permit(:list_type_id, :user_id, :title, :description, :link, :onHold, :suggested)\n end", "def create\n @list_item = ListItem.new(list_item_params)\n\n if @list_item.save\n redirect_to @list_item, notice: 'List item was successfully created.' \n else\n render action: 'new' \n end\n end", "def item_params\n params[:item][:ingredient_list] ||= [] \n params.require(:item).permit(:name, ingredient_list: [])\n end", "def create_item_list\n @item_button_list = ButtonList.new(@viewport)\n update_item_button_list\n end", "def show\n render json: @list_item\n end", "def list_items( args={} )\n @session.base_url = \"http://my.cl.ly\"\n \n url = \"/items\"\n args.each do |k, v|\n # probably a nicer way to do this\n if url == \"/items\"\n url << \"?#{k.to_s}=#{v.to_s}\"\n else\n url << \"&#{k.to_s}=#{v.to_s}\"\n end\n end\n resp = @session.get( url )\n \n raise AuthorizationError if resp.status == 401\n Crack::JSON.parse(resp.body)\n end", "def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n list = request(path, params, :post)\n list_id = list[:id]\n # output full list again\n show_list(list_id)\n end", "def items\n reload unless attributes[\"items\"]\n\n @_items ||= Array(attributes[\"items\"]).map do |item|\n item[\"list_id\"] = @id\n\n Todoable::Item.new(item)\n end\n\n @_items\n end", "def create\n return error_status(true, :cannot_create_listitem) unless (ListItem.can_be_created_by(@logged_user, @list))\n \n @list_item = @list.list_items.build(params[:list_item])\n @list_item.created_by = @logged_user\n\n respond_to do |format|\n if @list_item.save\n flash[:notice] = 'ListItem was successfully created.'\n format.html { redirect_to(@list_item) }\n format.js\n format.xml { render :xml => @list_item, :status => :created, :location => page_list_list_item_path(:page_id => @page.id, :list_id => @list.id, :id => @list_item.id) }\n else\n format.html { render :action => \"new\" }\n format.js\n format.xml { render :xml => @list_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end", "def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n else\n render json: @request_item.errors, status: :bad_request\n end\n end", "def index\n self.identify_user\n @items = @user.items\n @itemlist = @items.map do |item|\n convert_to_json(item)\n end\n respond_to do |format|\n format.json { render :json => @itemlist }\n format.xml { render :xml => @items }\n format.html { render text: \"Unsupported Format\", status: 404 }\n end\n end", "def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @active_items = Item.select(&:active?).sort_by(&:name)\n @inactive_items = Item.select(&:inactive?).sort_by(&:name)\n\n @item = Item.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end", "def item_list_params\n params.require(:item_list).permit(:title, :description, :expected_cost, :image, :contact)\n end", "def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end", "def index\n @items = Item.valid_items.search(params[:search],params[:action]).order(sort_column('Item', 'name') + ' ' + sort_direction).paginate(:page => params[:page], :per_page => 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = @list.items.all.order(id: :desc)\n return success_item_index\n end", "def change_multiple_items\n @items = params[:items]\n\n @items.each do |item|\n @current_item = Item.find(item[:id])\n @current_item.update(quantity: item[:quantity])\n end\n\n render :json => @items.to_json\n end", "def new_items_list\n @items = Item.where(:activated => true).sort{ |b,a| a.created_at <=> b.created_at } #TODO: Add availability\n @items = @items.first(16)\n #TODO: Once we have populated more data, maybe show 12 items instead of four\n @categories = Category.all\n @search = Item.search(params[:search])\n @keyword = params[:search]\n end", "def create\n raise TodoableError.new(\"Must be on new instance.\") if id\n response = Todoable.client.post(self.class.path(list), build_payload)\n assign_attributes_from_response(response)\n list.items << self\n self\n end", "def index\n render json: RequestItem.all\n end", "def create\n @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = current_owner.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was created successfully' }\n format.json { render :show, status: :created, location: items_path }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n #debug\n write_log(\n Const::SL::LOG_PATH_SL,\n \"items_controller#create(params[:item] => #{params[:item]})\",\n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n \n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.build(params[:list_item])\n @list_item[:user_id] = current_user.id\n\n if @list_item.save\n flash[:success] = \"Item successfully added\"\n redirect_to list_path(@list)\n else\n flash[:error] = \"Item not added\"\n redirect_to list_path(@list)\n end\n end", "def create\n item = Item.new(item_params)\n item.user = current_user\n if item.save\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n end", "def set_post(api_key, access_token, list, list_item_id, body, opts = {})\n data, _status_code, _headers = set_post_with_http_info(api_key, access_token, list, list_item_id, body, opts)\n return data\n end", "def list_post(api_key, access_token, list, body, opts = {})\n list_post_with_http_info(api_key, access_token, list, body, opts)\n return nil\n end", "def path\n \"/{databaseId}/items/list/\"\n end", "def create\n @baintodo_item = @baintodo_list.baintodo_items.create(baintodo_item_params)\n redirect_to @baintodo_list\n end", "def items\n response[\"items\"]\n end", "def show\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(params[:list_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_item }\n end\n end", "def update\n @list = List.find(params[:id])\n\n nested = params[:list].delete( :list_items_attributes )\n\n new_items = []\n\n if nested then\n nested.each do |i, r|\n\n if !r.key?( \"id\" )\n\n new_items << ListItem.new( { \"list\" => @list }.merge( r ) ) if !item_blank?( r )\n\n nested.delete( i )\n\n else\n\n r[ \"_destroy\" ] = \"true\" if item_blank?( r )\n\n end\n\n end\n end\n\n respond_to do |format|\n if @list.update_attributes( params[ :list ] ) && \n @list.update_attributes( list_items_attributes: (nested || {}) ) &&\n new_items.map( &:save ).all? then\n\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n\n else\n\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def create_list(name:)\n check_token\n list = Todoable::List.new(name: name)\n response = self.class.post(\n '/lists', body: list.post_body, headers: headers\n )\n check_and_raise_errors(response)\n attributes = response.parsed_response.merge!('items' => [])\n Todoable::List.build_from_response(attributes)\n end", "def list_items\r\n begin\r\n expand_combo\r\n get(:type => :list_item, :scope => :children, :how_many => :all)\r\n ensure\r\n collapse_combo\r\n end\r\n end", "def listitem_params\n params.require(:listitem).permit(:task, :todolist_id)\n end", "def createItem(title, description, date)\n new_item = List.new\n new_item.title = title\n new_item.description = description\n new_item.save\n new_item.date = date\n end", "def list_params\n params.require(:list).permit(:title, :category_id, :body)\n end", "def create\n @task_item = Task::Item.new(task_item_params)\n\n respond_to do |format|\n if @task_item.save\n format.html { redirect_to task_list_path(@task_item.list), notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @task_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.js { render :new, status: :unprocessable_entity }\n format.json { render json: @task_item.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7753604", "0.7101967", "0.7082251", "0.6967588", "0.6956351", "0.6956212", "0.6954016", "0.6908964", "0.690295", "0.6868863", "0.68454075", "0.68431216", "0.6766986", "0.67519885", "0.67479295", "0.67349887", "0.67172563", "0.6651018", "0.6648578", "0.66200054", "0.6611196", "0.6588208", "0.65816563", "0.6563966", "0.651511", "0.6510281", "0.6461409", "0.64596045", "0.645238", "0.64478457", "0.64397544", "0.64337", "0.638844", "0.638844", "0.63826144", "0.63818425", "0.6356213", "0.63485205", "0.6337624", "0.63094693", "0.63052636", "0.6297686", "0.62963563", "0.6268421", "0.62612903", "0.6250898", "0.62384254", "0.623526", "0.62332207", "0.62192214", "0.6213084", "0.62130815", "0.6180187", "0.61711085", "0.61584336", "0.61343014", "0.6126271", "0.6122933", "0.61200917", "0.6119889", "0.61143136", "0.6100623", "0.6096857", "0.60954535", "0.60935664", "0.60846204", "0.60819894", "0.60816973", "0.607435", "0.607435", "0.607435", "0.607435", "0.60603", "0.6059997", "0.6055848", "0.605417", "0.6046342", "0.6043752", "0.60412675", "0.6022639", "0.6021037", "0.6010778", "0.600629", "0.5996528", "0.5992796", "0.5978269", "0.5976495", "0.5969099", "0.5957702", "0.59550434", "0.59540504", "0.5946339", "0.5946107", "0.59417415", "0.59411234", "0.59394014", "0.5931776", "0.59300727", "0.5926973", "0.59252" ]
0.6363618
36
PATCH/PUT /list_items/1 PATCH/PUT /list_items/1.json
def update respond_to do |format| if @list_item.update(list_item_params) format.html { redirect_to @list_item, notice: 'List item was successfully updated.' } format.json { render json: @list_item, status: :ok } else format.html { render :edit } format.json { render json: @list_item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n item = @list.list_items.find(params[:id])\n\n if item.update_attributes(params[:list_item])\n render json: item\n else\n error(t('messages.list_item.errors.update'))\n end\n end", "def update\n \n @list_item = ListItem.find(params[:id])\n\n if @list_item.update(list_item_params)\n head :no_content\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end", "def update\n @list = List.find(params[:id])\n\n nested = params[:list].delete( :list_items_attributes )\n\n new_items = []\n\n if nested then\n nested.each do |i, r|\n\n if !r.key?( \"id\" )\n\n new_items << ListItem.new( { \"list\" => @list }.merge( r ) ) if !item_blank?( r )\n\n nested.delete( i )\n\n else\n\n r[ \"_destroy\" ] = \"true\" if item_blank?( r )\n\n end\n\n end\n end\n\n respond_to do |format|\n if @list.update_attributes( params[ :list ] ) && \n @list.update_attributes( list_items_attributes: (nested || {}) ) &&\n new_items.map( &:save ).all? then\n\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n\n else\n\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def update\n task\n if @item.update(item_params)\n render json: @list.as_json, status: :ok\n else\n render json: {list: @item.errors, status: :unprocessable_entity}\n end\n end", "def update\n \t@list = current_user.lists.find params[:list_id]\n @item = @list.items.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to list_items_path(@list), notice: 'Item was successfully updated.' }\n #format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n #format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item.update_attributes(item_params)\n @items = List.find(item_params[:list_id]).items.order(\"id ASC\")\n @list_id = @item.list.id\n end", "def update\n respond_to do |format|\n if @list_item.update(list_item_params)\n format.html { redirect_to list_path(@list), notice: 'List item was successfully updated.' }\n format.json { render :show, status: :ok, location: @list_item }\n else\n format.html { render :edit }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item_list.update(item_list_params)\n format.html { redirect_to @item_list, notice: 'Item list was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_list }\n else\n format.html { render :edit }\n format.json { render json: @item_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list_item.update(list_item_params)\n format.html { redirect_to @list, notice: 'List item was successfully updated.' }\n format.json { render :show, status: :ok, location: @list_item }\n else\n format.html { render :edit }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to lists_path, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list_item.update(list_item_params)\n format.html { redirect_to @list_item, notice: 'List item was successfully updated.' }\n format.json { render :show, status: :ok, location: @list_item }\n else\n format.html { render :edit }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @listitem.update(listitem_params)\n render :show, status: :ok, location: todolist_listitem_path(@todolist, @listitem)\n else\n render json: @listitem.errors, status: :unprocessable_entity\n end\nend", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update!(**args)\n @list_items = args[:list_items] if args.key?(:list_items)\n end", "def update\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n\n if @list_item.update_attributes(params[:list_item])\n flash[:success] = \"List item was successfully updated.\"\n redirect_to list_path(@list) \n else\n flash[:errror] = \"Unable to update item.\"\n redirect_to edit_list_list_item_path(@list, @list_item)\n end\n end", "def update_list(item_name, item_list, quantity)\n add_list(item_name, item_list, quantity)\nend", "def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.item\n end\n #update all other parameters\n if @request_item.update(request_item_params)\n render json: @request_item\n else\n render json: @request_item.errors, status: :bad_request\n end\n\n end", "def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end", "def update\n \tif params[:shopping_list][:other_items_attributes]\n\t \tparams[:shopping_list][:other_items_attributes].each do |k,v|\n\t \t\tif v[:shopping_item_id] == \"\" and params[:shopping_item_input][k] != \"\"\n\t \t\t\tshopping_item = ShoppingItem.create!(:name => params[:shopping_item_input][k])\n\t \t\t\tv[:shopping_item_id] = shopping_item.id\n\t \t\tend\n\t \tend\n \tend\n \t\n @shopping_list = ShoppingList.find(params[:id])\n\n respond_to do |format|\n if @shopping_list.update_attributes(params[:shopping_list])\n format.html { redirect_to @shopping_list, notice: 'Shopping list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shopping_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end", "def update\n respond_to do |format|\n if @listed.update(listed_params)\n format.html { redirect_to session[:previous_url], notice: 'List item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @listed.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @list\n\n if @list.update(list_params)\n json_response(@list.decorate, :ok)\n else\n json_response(@list.errors, :unprocessable_entity)\n end\n end", "def update\n respond_to do |format|\n if @list.update(existing_list_params)\n format.html { redirect_to my_list_path(@list), notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: my_list_path(@list) }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = @client.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_multiple_items\n @items = params[:items]\n\n @items.each do |item|\n @current_item = Item.find(item[:id])\n @current_item.update(quantity: item[:quantity])\n end\n\n render :json => @items.to_json\n end", "def update\n if @item.update_attributes(item_params)\n render json: @item, status: :ok\n else\n render_error(@item, :unprocessable_entity)\n end\n end", "def update!(**args)\n @item_id = args[:item_id] if args.key?(:item_id)\n @list_id = args[:list_id] if args.key?(:list_id)\n end", "def update\n @item = @user.items.find(params[:id])\n\n @item.update(:type_list => \"\", :tag_list => \"\")\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to [@user, @item], notice: 'item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def update\n Rails.logger.debug params.inspect\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n respond_with(@items)\n end\n end\n end", "def update\n\n @item = Item.find(params[:id])\n @item.update(item_params)\n\n redirect_to user_list_path(@item.list.user, @item.list)\n end", "def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "def update\n @list = current_user.lists.find(params[:id])\n @list.update_attributes(params[:list])\n respond_with(@list, :location => my_list_url(@list))\n end", "def update\n json_response(@food_item.update!(food_item_params))\n end", "def update_list(list_id:, name:)\n check_token\n list = Todoable::List.new(name: name)\n response = self.class.patch(\n \"/lists/#{list_id}\",\n body: list.post_body,\n headers: headers,\n format: :text\n )\n check_and_raise_errors(response)\n # This endpoint returns a plaintext body: \"<new name> updated\", so\n # while I'd like to return a List with ListItems, that would require\n # first looking up the list which isn't ideal. So we'll return true, ask\n # todoable to fix this endpoint, and make developers keep track of the\n # name change\n true\n end", "def update\n if @list_item.update(list_item_params)\n redirect_to @list_item, notice: 'List item was successfully updated.' \n else\n render action: 'edit' \n end\n end", "def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n @item.update_attributes(params[:item])\n respond_with @item\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list.append_items!(params.dig(:list, :items), current_user)\n redirect_to [@project, @randomization_scheme], notice: \"Items successfully added.\"\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update\n respond_to do |format|\n if @task_item.update(task_item_params)\n format.html { redirect_to task_list_path(@task_item.list), notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(item_attrs = {})\n body = { update: item_attrs }\n Iterable.request(conf, base_path).patch(body)\n end", "def update\n @list_item = @list.list_items.find(params[:id])\n return error_status(true, :cannot_edit_listitem) unless (@list_item.can_be_edited_by(@logged_user))\n \n @list_item.updated_by = @logged_user\n\n respond_to do |format|\n if @list_item.update_attributes(params[:list_item])\n flash[:notice] = 'ListItem was successfully updated.'\n format.html { redirect_to(@list_item) }\n format.js\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.js\n format.xml { render :xml => @list_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to management_lists_path, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(_list_params)\n format.html { redirect_to @list, notice: \"List was successfully updated.\" }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_list(user, list, options={})\n post(\"/#{user}/lists/#{list}.json\", options)\n end", "def update\n @list.update_attributes list_params\n end", "def update\n \n respond_to do |format|\n if @todo_item.update(todo_item_params)\n format.html { redirect_to todo_list_todo_items_path(@todo_list), notice: 'Todo item was successfully updated.' }\n # format.json { render :show, status: :ok, location: @todo_item }\n else\n format.html { render :edit }\n # format.json { render json: @todo_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:new_check_list_item][:id].present?\n @check_list.check_list_items.create(check_id: params[:new_check_list_item][:id])\n end\n if params[:cli]\n params[:cli].each do |cli_array|\n cli = CheckListItem.find(cli_array[0].to_i)\n cli.position = cli_array[1].to_i\n cli.save\n end\n end\n\n respond_to do |format|\n if @check_list.update(check_list_params)\n format.html { redirect_to :back, notice: 'Check list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @check_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @todoit_list.update(todoit_list_params)\n format.html { redirect_to @todoit_list, notice: 'Todoit list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @todoit_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item.update!(item_params)\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(list, item, qty)\n add_item(list, item, qty)\nend", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'Changes and Additions Successful.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to items_path, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apiv1_item.update(apiv1_item_params)\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @apiv1_item }\n else\n format.html { render :edit }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @to_do_item = ToDoItem.find(params[:id])\n unless params[:to_do_item][\"to_do_list_id\"].to_i == @to_do_item.to_do_list_id\n @to_do_item.remove_from_list\n end\n respond_to do |format|\n if @to_do_item.update_attributes(params[:to_do_item])\n format.html { redirect_to @to_do_item, notice: 'To do item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @to_do_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n if @item.update(params[:item])\n format.html { redirect_to({action: :show, id: @item}, notice: 'Item was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_item_from_list(list, food, update_quantity)\n list[food] = update_quantity\n list\nend", "def update\n @list = List.find(params[:id])\n @list.user = current_user\n @user = @list.user\n\n respond_to do |format|\n if @list.update_attributes(params[:todo])\n format.html { redirect_to root_path, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to items_path, notice: 'Item ' + @item.name + ' was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to items_path, notice: 'Item was updated successfully' }\n format.json { render :show, status: :ok, location: items_path }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'The List was updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_shopping_list.update(api_v1_shopping_list_params)\n format.html { redirect_to @api_v1_shopping_list, notice: 'Shopping list was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_shopping_list }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_shopping_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to items_url, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.785564", "0.75691766", "0.744534", "0.73121583", "0.7253285", "0.719917", "0.71629083", "0.7143798", "0.71381116", "0.7136673", "0.71193355", "0.70707685", "0.7003887", "0.69743145", "0.6894114", "0.68894434", "0.6853641", "0.68194073", "0.68167084", "0.67479396", "0.6747128", "0.6702458", "0.66906446", "0.6682489", "0.6680164", "0.6677031", "0.6666009", "0.66570866", "0.6654518", "0.6647264", "0.6646619", "0.6645202", "0.6637241", "0.6617071", "0.6609756", "0.6598462", "0.6582018", "0.6565262", "0.6563674", "0.6563674", "0.6555193", "0.655445", "0.655445", "0.65539414", "0.6541519", "0.6529871", "0.6507735", "0.6504086", "0.6504086", "0.6501209", "0.64912766", "0.6475868", "0.64756906", "0.6469678", "0.6466131", "0.64634305", "0.64581054", "0.64335316", "0.6431914", "0.6431756", "0.6431756", "0.6431756", "0.6431756", "0.6431756", "0.6427564", "0.64125776", "0.64121324", "0.6408926", "0.6406637", "0.6392871", "0.6381959", "0.63787925", "0.6352229", "0.6351461", "0.6351325", "0.6351059", "0.6342085", "0.6342085", "0.6342085", "0.6342085", "0.6342085", "0.6342085", "0.6342085", "0.6342085", "0.6342085", "0.6342066", "0.6333757", "0.6328025", "0.63243693", "0.631453", "0.6311544", "0.6311544", "0.6311544", "0.6311544", "0.6311544", "0.6311544", "0.6311544", "0.6311544", "0.6311544", "0.6311544" ]
0.7044775
12
DELETE /list_items/1 DELETE /list_items/1.json
def destroy respond_to do |format| if @list_item.destroy format.html { redirect_to @list_item, notice: 'List item was successfully destroyed.' } format.json { render json: @list_item, status: :ok } else format.html { render :edit } format.json { render json: @list_item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @list_item = ListItem.find(params[:id])\n @list_item.destroy\n\n respond_to do |format|\n format.html { render :nothing => true}\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :ok }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end", "def destroy\n \t@list = current_user.lists.find params[:list_id]\n @item = @list.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to list_items_path(@list), notice: 'Item was successfully removed.' }\n #format.json { head :no_content }\n end\n end", "def destroy\n @item_list.destroy\n respond_to do |format|\n format.html { redirect_to item_lists_url, notice: 'Item list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @list=List.find(params[:list_id])\n @[email protected]_items.find(params[:id])\n @list_item.destroy\n respond_to do |format|\n format.html { redirect_to @list, notice: 'List item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list_item.destroy\n\n head :no_content\n end", "def destroy\n @list_item.destroy\n respond_to do |format|\n format.html { redirect_to list_path(@list), notice: 'List item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list_item.destroy\n respond_to do |format|\n format.html { redirect_to list_items_url, notice: 'List item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_item(list_id:, item_id:)\n api_request(method: :delete, path: \"lists/#{list_id}/items/#{item_id}\")\n end", "def delete_item(list_id:, id:)\n path = \"lists/#{list_id}/items/#{id}\"\n request(method: :delete, path: path)\n end", "def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend", "def destroy\n @list_id = @item.list.id\n @item.destroy\n @items = List.find(@list_id).items.order(\"id ASC\")\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete_todo_item(item_id, list_id)\n rest(\"delete\", \"/lists/#{list_id}/items/#{item_id}\")\n\n return true\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def delete_item(list_item)\n @list.delete(list_item)\n @list\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @item = @client.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully removed from Inventory.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n @list_item.destroy\n\n if @list_item.destroy\n flash[:success] = \"Item deleted\"\n redirect_to list_path(@list)\n else\n flash[:error] = \"Item not deleted\"\n redirect_to list_path(@list)\n end\n end", "def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n render status: 200, json: @request_item.destroy\n end", "def delete_list_item(client, uri, headers)\n # log what we are doing\n log(:info, \"Deleting Sharepoint list item at: #{uri}\")\n\n # send the delete request and return the response\n client.delete(uri, headers)\n end", "def destroy\n# @item = Item.get(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to({action: :index}, notice: 'Item was successfully deleted.') }\n format.json { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def delete_item(item)\n @get_items.delete(item)\n end", "def destroy\n @checklist_item = ChecklistItem.find(params[:id])\n @checklist_item.destroy\n\n respond_to do |format|\n format.html { redirect_to checklist_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n item = @item.name\n @item.deleted = true\n @item.deleted_at = Time.now\n @item.save\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"#{item} was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end", "def destroy\n @item = TodoItem.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to todo_lists_url }\n format.json {render json: {\n success: true,\n data: [],\n message: \"TodoItem was successfully deleted.\"\n }}\n end\n end", "def destroy\n @admin_item = Admin::Item.find(params[:id])\n @admin_item.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_item = Admin::Item.find(params[:id])\n @admin_item.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_items_url }\n format.json { head :no_content }\n end\n end", "def delete_list(user, list)\n delete(\"/#{user}/lists/#{list}.json\")\n end", "def destroy\n @item = @user.items.find(params[:id])\n @item.destroy\n\n\n respond_to do |format|\n format.html { redirect_to user_items_path(@user) }\n format.json { head :no_content }\n end\n end", "def delete_item(list, item)\n list.delete(item)\nend", "def delete_item(list,item)\n list.delete(item)\nend", "def delete_item(list,item)\n list.delete(item)\nend", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listitem.destroy\n head :no_content\nend", "def delete_item(item)\r\n @list.delete(item)\r\n end", "def delete_item\n item_id = params[\"item_id\"]\n\n item = TextItem.find_by_id(item_id)\n item = Image.find_by_id(item_id) if item.nil?\n item = Collection.find_by_id(item_id) if item.nil?\n render_json :status => :not_found, :messages => \"Could not find the item with id #{item_id}.\" and return if item.nil?\n\n if item.class == Collection\n if params[\"id\"].nil?\n render_json :status => :bad_request, :messages => \"Can't delete a collection reference without providing the parent collection id. Please use the longer url for item deletion.\" and return\n end\n collection = Collection.find_by_id(params[\"id\"])\n else\n collection = Ownership.find_by_item_id(item_id).parent\n end\n;\n render_json :status => :not_found, :messages => \"Could not find parent collection for the item.\" and return if (collection.nil?)\n render_json :status => :forbidden, :messages => \"The user is not allowed to delete from this collection.\" and return if (!collection.delete?(@user, @client))\n\n collection.delete_item(item_id)\n render_json :entry => {} and return\n end", "def delete_item(list,item)\n\tlist.delete(item)\nend", "def destroy\n @list_item = @list.list_items.find(params[:id])\n return error_status(true, :cannot_edit_listitem) unless (@list_item.can_be_deleted_by(@logged_user))\n \n @list_item.updated_by = @logged_user\n @list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(list_items_url) }\n format.js\n format.xml { head :ok }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list_item.destroy\n redirect_to list_items_url \n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def delete(item, list)\n\tlist.delete(item)\nend", "def delete_item(list, item)\n list.delete(item)\n list\nend", "def delete_item(list, item)\n list.delete(item)\n list\nend", "def destroy\n @item = current_user.items.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n item = @list.list_items.find(params[:id])\n\n if item.destroy\n flash[:alert] = t('messages.list_item.success.delete', name: item.name)\n else\n flash[:notice] = t('messages.list_item.errors.delete')\n end\n\n redirect_to :back\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: '削除に成功しました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_item.destroy\n respond_to do |format|\n format.html { redirect_to test_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_item(list, item)\n\tlist.delete(item)\n\tlist\nend", "def destroy\n @item ||= Item.find_by_id_or_name(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def delete_item(list,item)\n list.delete(item)\n list\nend", "def delete_item(list,item)\n list.delete(item)\n list\nend", "def destroy\n @resource_item.destroy\n respond_to do |format|\n format.html { redirect_to resource_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ordereditem.destroy\n respond_to do |format|\n format.html { redirect_to ordereditems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_item.destroy\n respond_to do |format|\n format.html { redirect_to task_list_path(@task_item.list), notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def del_item(list, item_to_del)\n list.delete(item_to_del)\nend", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :ok }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to management_lists_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @itemstable = Itemstable.find(params[:id])\n @itemstable.destroy\n\n respond_to do |format|\n format.html { redirect_to itemstables_url }\n format.json { head :no_content }\n end\n end", "def destroy#\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.76235086", "0.76060545", "0.75157684", "0.7390796", "0.7390005", "0.7372139", "0.7369137", "0.73567873", "0.7350935", "0.73371667", "0.7300441", "0.7285203", "0.726407", "0.7252846", "0.722049", "0.72115844", "0.7200179", "0.71998066", "0.71998066", "0.71998066", "0.71998066", "0.71998066", "0.71998066", "0.71998066", "0.71998066", "0.71998066", "0.71998066", "0.71998066", "0.71998066", "0.71998066", "0.71998066", "0.71998066", "0.7196865", "0.71818906", "0.7174365", "0.7171888", "0.7171888", "0.7171888", "0.7171888", "0.7171888", "0.7171888", "0.7171888", "0.7171888", "0.7171888", "0.7171888", "0.71626866", "0.7145531", "0.71446055", "0.71313417", "0.7128326", "0.7095828", "0.70881516", "0.70779806", "0.7075427", "0.70727426", "0.70661265", "0.70658386", "0.70647395", "0.70457363", "0.70144236", "0.70113707", "0.7010425", "0.7010425", "0.7006245", "0.7004546", "0.6999504", "0.6994743", "0.6994743", "0.69885874", "0.69862163", "0.69820446", "0.6978031", "0.69766194", "0.69584906", "0.69532263", "0.69532263", "0.69532263", "0.69413817", "0.6931876", "0.6923547", "0.69140357", "0.69140357", "0.6912532", "0.6904902", "0.6904182", "0.6894972", "0.6888916", "0.6888742", "0.6871642", "0.68687016", "0.6865291", "0.6865291", "0.6861412", "0.68540233", "0.6853206", "0.6852423", "0.68519205", "0.68460006", "0.6844909", "0.6841887", "0.68417567" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_list_item @list_item = ListItem.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 list_item_params extras={} params.require(:list_item).merge(extras).except(:id).permit(:list_type_id, :user_id, :title, :description, :link, :onHold, :suggested) 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 valid_params_request?; 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 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 safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\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 social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\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 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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n 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 url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62909746", "0.62904227", "0.62837297", "0.6240993", "0.6239739", "0.6217764", "0.6214983", "0.62112504", "0.6194765", "0.6178", "0.61755055", "0.61729854", "0.61636627", "0.6153461", "0.6151674", "0.61478525", "0.6122671", "0.61188513", "0.61075556", "0.6105721", "0.6092412", "0.6081011", "0.6071054", "0.6064436", "0.6022111", "0.6018135", "0.60151577", "0.60108894", "0.60070235", "0.60070235", "0.6000806", "0.6000464", "0.5998811", "0.59926987", "0.5992257", "0.5991173", "0.5980311", "0.59660876", "0.59596545", "0.5959415", "0.59589994", "0.5957478", "0.5953214", "0.5952233", "0.5944033", "0.59396756", "0.59396756", "0.59386414", "0.59345603", "0.5931261", "0.5926345", "0.5925795", "0.59174526", "0.59108645", "0.5909469", "0.5908263", "0.59053195", "0.58980685", "0.5897738", "0.589657", "0.5895971", "0.58942044", "0.5892847", "0.588742", "0.58834344", "0.5880024", "0.58739793", "0.5868253", "0.5867907", "0.58670515", "0.58668053", "0.5865756", "0.5863549", "0.5863236", "0.5862728", "0.5861283", "0.58591247", "0.5855159", "0.5854291", "0.58512247", "0.58498096" ]
0.0
-1
before filters confirms a loggedin user
def logged_in_user unless logged_in? store_location flash[:danger] = "Please log in." redirect_to login_url end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_filter\n if current_user\n true\n end\n end", "def signed_in_user_filter\n if signed_in?\n redirect_to root_path, notice: \"Already logged in\"\n end\n end", "def run_filters\n set_user\n authorize\n end", "def current_user_required\n\t\t# Have to add \".filter(self)\" when not in before_filter line.\n\t\tCASClient::Frameworks::Rails::Filter.filter(self)\n\tend", "def check_user_before_action\n @blog = Blog.find(params[:id])\n if (current_user != @blog.user) and (@blog.global == false)\n redirect_to({ action: \"index\" }, notice: \"You don't have sufficient permissions\")\n\n end\n end", "def login_filter\n\t\tif not protect?( action_name )\n\t\t\treturn true \n\t\tend\n\n\t\tif not session[:user_id]\n\t\t\t# user isn't logged in\n\t\t\tstore_location\n\t\t\tredirect_to :controller=>\"account\", :action=>\"login\"\n\t\t\treturn false\n\t\tend\n\n\t\t# initialize the @user variable\n\t\t@user = User.find( session[:user_id] )\n\t\t\n\t\tif not @user.validated?\n\t\t\t# user is logged in, but they haven't been validated\n\t\t\tredirect_to :controller=>\"account\", :action=>\"not_activated\"\n\t\t\treturn false\n\t\telsif not authorized?( @user, action_name )\n\t\t\t# user is logged in and validated, but not authorized\n\t\t\tredirect_to :controller=>\"account\", :action =>\"denied\"\n\t\t\treturn false\n\t\telse\n\t\t\t# user is logged in AND validated AND authorized! let 'em in!\n\t\t\treturn true\t\n\t\tend\n\n\t\t# we shouldn't get here\n\t\traise \"Serious malfunction in 'login_filter' -- please contact manufacturer ([email protected])...\"\n\tend", "def confirm_logged_in\n unless session[:user_id]\n flash[:notice] = \"Please log in.\"\n render('show')\n #redirect_to(:action => 'login')\n \n #redirect_to(:action => 'login')\n #redirect_to(:controller => 'contacts', :action => 'list')\n \n \n return false # halts the before_filter\n else\n redirect_to(:controller => 'admin_users')\n return true\n end\n end", "def authorize_user\n if @user.id != current_user.id\n redirect_to \"/\", notice: 'You are not allowed the given operation' and return\n end\n end", "def owner_required\n ## before filter for owner of channel. \n if logged_in? && current_user.login == THUMBWEBS_AUTHORIZED_USER\n return true\n else\n flash[:error] = \"Unauthorized Access-Must be logged-in as owner.\"\n redirect_to thumbwebs_root_path\n end\nend", "def filter_user_is_registered\n unless( user_is_registered)\n redirect_to_login\n end\n end", "def authorized\n redirect_to new_user_session_path unless logged_in?\n end", "def authorized_user\n @event = Event.friendly.find(params[:id])\n if @event.creator_id != current_user.id\n if current_user.email == '[email protected]' || current_user.email == '[email protected]'\n return true\n end\n redirect_to root_path, alert: \"Oops! You don't have permission to do that\"\n end\n end", "def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end", "def check_user_before_membership\n if current_user\n ncm_membership = current_user.get_membership(@mother)\n epicenter = Epicenter.find_by_slug(params['epicenter_id'])\n\n if epicenter != @mother and not ncm_membership\n session[:new_ncm_membership] = { \n :epicenter_id => params['epicenter_id'], \n :membership_id => params['membership_id'],\n :t => Time.now\n }\n #\n redirect_to new_epicenter_subscription_path(@mother)\n end\n else\n # it's possible that we can put the logic from \"authenticate\" method below here\n redirect_to epicenters_path\n end\n end", "def enforce_logged_in\n bounce unless current_user\n end", "def authorize_user\n unless current_user.id == @profile.user_id\n flash[:unauthorized] = \"Not authorized\"\n redirect_to listings_path\n end \n end", "def check_user\n if user_signed_in? && (current_user.has_role?(:admin) || current_user.id == @listing.user_id )\n else \n flash[:alert] = \"You are not authorized to do that!\"\n redirect_to root_path\n end\n end", "def authorize_user!\n user = Circle.find(params[:id]).user\n if current_user != user\n flash[:notices] = \"Unathorized action\"\n redirect_to user_url(user.id)\n end\n end", "def restrict_users\n \t\tif user_signed_in?\n \t\t\tif current_user.has_role? :client\n \t\t\t\tif current_user.profile.agreed == nil\n \t\t\t\t\tredirect_to edit_profile_path(current_user.profile)\n \t\t\t\tend\n \t\t\tend\n\n \t\tend\n\n \tend", "def user_have\n unless current_user\n redirect_to root_path, :alert => \"Зарегистрируйтесь или войдите\"\n end\n end", "def authorized!\n redirect_to root_url, alert: \"You need to be set up for receiving whispers first\" and return unless current_user\n end", "def authorize\n redirect_to new_session_path unless current_user #call method curent_user in sessions_helper\n end", "def user_check\n if user_signed_in?\n render status: :ok, json: current_user\n else\n render status: :forbidden, nothing: true\n end\n end", "def confirm_logged_in\n unless session[:user_id]\n flash[:notice] = \"Please log in.\"\n redirect_to root_path\n return false # halts the before_action\n else\n return true\n end\n end", "def authorize\n redirect_to('/login') unless @current_user\n end", "def authorize\n redirect_to login_path and return unless current_user\n @current_user.touch(:seen_at)\n end", "def set_user_and_verify #TODO: Make this common to both items and tags\n @user = User.find_by(id: params[:user_id])\n if @user.blank?\n head :forbidden\n end\n end", "def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end", "def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end", "def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end", "def verify_user\n redirect_to forbidden_path unless user_signed_in? && @review.user_id == current_user.id\n end", "def correct_user\n render_forbidden unless current_user?(@user)\n end", "def authorize_user\n unless current_user\n flash[:notice] = \"Sorry, you need to be logged in to access that feature\"\n redirect_to new_session_path\n end\n end", "def authorize_author\n redirect_to '/login' unless self.user_access > 1 || current_user.access == 3\n end", "def authorize\n if current_user.nil?\n redirect_to events_manager_index_path, :notice => \"Login to continue!\"\n return false\n else\n end \n end", "def authenticate\n CASClient::Frameworks::Rails::Filter.before(self)\n update_current_user(User.eager_load(*eager_loads).find_by(cas_directory_id: session[:cas_user]))\n\n return unless session[:cas_user] && !allow_access\n render(file: File.join(Rails.root, 'public/403.html'), status: :forbidden, layout: false)\n end", "def authorize\n \t\t\tunless User.find_by(id: session[:user_id])\n \t\t\t\tredirect_to login_url, notice: \"Please Log-in\"\n \t\t\tend\n \t\tend", "def authorized_user\n @user = Post.find(params[:id]).user\n redirect_to(root_url) unless logged_in? && (current_user?(@user) || current_user.admin?)\n end", "def authorize_user\n redirect_to restrooms_path, flash: {message: \"You don't have permission to make changes to another user's profile.\"} unless current_user.admin? || @user == current_user\n end", "def authorize\n redirect_to \"/log_in\", :alert => t('.need_to_be_logged_in') unless signed_in?\n end", "def authorize\n\t\tredirect_to '/login' unless current_user\n\tend", "def pre_authorize_cb; end", "def require_user\n #if not logged in \n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n \n \n end", "def login_required\n not_authorized unless current_user\n end", "def user_actions(user)\n can_act_as_logged_in_user(user) unless Revs::Application.config.restricted_beta # also have logged in privileges if we are not in beta\n end", "def authorize\n if !logged_in? || current_user.nil?\n redirect '/login'\n else\n @user = current_user\n @user_chores = current_user.chores\n @user_gadgets = current_user.gadgets\n end\n end", "def force_auth\n\t\tlogger.debug \" Callback: force_auth\"\n\t\tsession[:last_ts] = nil\n\t\tCASClient::Frameworks::Rails::Filter.filter self unless @current_user\n\tend", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end", "def authenticate_user\n render_403 'Invalid user.' if @user.blank? || [email protected]?\n end", "def valid_user\n # unless (@user && @user.activated? && @user.authenticated?(:reset, params[:id])) \n unless(@user && @user.activated?)\n redirect_to root_url\n end\n end", "def verify_user\n return if (@user = current_user)\n flash[:notice] = I18n.t('blacklight.saved_searches.need_login')\n raise Blacklight::Exceptions::AccessDenied\n end", "def prevent_other_user_edits\n @user = User.find(params[:id])\n\n if !(logged_in?)\n redirect_to login_path\n flash[:danger] = \"You must be logged in to visit this page\"\n\n else\n if (current_user.id != @user.id)\n redirect_to home_path\n flash[:danger] = \"You must be logged in as the correct user to visit this page\"\n end\n end\n end", "def authorized\n redirect_to \"/login\" unless logged_in? \n end", "def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end", "def authorize\n if current_user.nil?\n redirect_to login_url, alert: \"Please Log in or Sign Up to comment!\"\n \tend\n end", "def authorize\n unless User.find_by_id(session[:user_id])\n redirect_to :log_in, :notice => \"Please log in\"\n end\n end", "def authenticate_correct_user\n redirect_unauthorized unless current_user? @run.user_id\n end", "def authenticate_current_user\n unless current_user.admin == true\n unless current_user == User.find(params[:id]) \n flash[:danger] = \"Impossible d'aller sur cette page.\"\n redirect_to root_path\n end\n end\n end", "def authorized?(user)\n true\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize_user\r\n unless session[:user_id]\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"user_not_authorized_wo_login\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end", "def authorize\n unless User.find_by(id: session[:user_id])\n redirect_to tasks_index_path, notice: \"Please log in\"\n end\n end", "def logged_user_only\n unless logged_in?\n\t store_location\n\t flash[:danger] = \"Please log in!\"\n\t redirect_to login_url\n\t end\n end", "def authenticate_user\n\t\trender_unauthorized unless current_user\n\tend", "def authorize\n @logged_in_user = User.find(session[:user_id])\n rescue\n reset_session\n @logged_in_user = nil\n if User.find(:all).length > 0\n session[:jumpto] = request.parameters\n redirect_to :controller => 'authentication', :action => :login and return false\n else\n redirect_to :controller => 'authentication', :action => :setup and return false\n end\n end", "def declared_user\n if logged_in?\n if Protege.find_by(user_id: current_user.id.to_i).nil?\n redirect_to root_path, :alert => \"Access denied.\"\n end\n else\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def before_request\n self.login if require_login? && !@authenticating\n end", "def check_user\n if current_user.nil?\n render status: :forbidden, json: false\n return\n end\n end", "def authorize \n redirect_to login_url, notice: \"Please log in\" if session[:user_id].nil?\n end", "def authorize\n unless @_user = User.find_by_id(session[:user_id])\n# session[:original_uri] = request.request_uri\n flash[:notice] = \"Please login first\"\n redirect_to :controller => :login, :action => :index\n end\n end", "def authorized(m)\n m.user == current_user\n end", "def authorize\n if !current_user\n flash[:alert] = \"Sign in to access that feature.\"\n redirect_to '/posts'\n end\n end", "def authorized?(user)\n current_user == user\nend", "def authorize\n \t\t#teste http://localhost:3000/products/2/who_bought.atom\n \t\t#ou curl --silent --user dave:secret http://localhost:3000/products/2/who_bought.atom \n \t\treturn if User.count.zero?\n\n \t\tif request.format == Mime[:html]\n \t\t\tuser = User.find_by(id: session[:user_id])\n \t\telse\n \t\t\tuser = authenticate_or_request_with_http_basic do |u,p|\n \t\t\t\tUser.find_by_name(u).try(:authenticate, p)\n \t\t\tend\n \t\tend\n\n \t\tredirect_to login_url, notice: \"Please log in\" unless user\n \t\t\n \tend", "def authorized_by(user)\n user.id == self.id\n end", "def user_authorize\n if session[:user_id]\n return true\n else\n redirect_to new_session_path\n return false\n end\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def login_required\n # Skip this filter if the requested action is not protected\n return true unless protect?(action_name)\n\n # Check if user is logged in and authorized\n return true if logged_in? and authorized?(current_user)\n\n # Store current location so that we can redirect back after login\n store_location\n\n # Call access_denied for an appropriate redirect and stop the filter\n # chain here\n access_denied and return false\n end", "def authorize_user\n puts \"AUTHORIZE USER\"\n puts \"params[:id] \" + params[:id].to_s\n # render json: { status: 401, message: 'Unauthorized' } unless get_current_user.id == params[:id].to_i\n render json: { status: 401, message: 'Unauthorized' } unless get_current_user\n end", "def check_login\n head :forbidden unless self.current_user\n end", "def authorize\n unless User.find_by_id( session[ :user_id ] )\n session[ :original_uri ] = request.request_uri\n flash[ :notice ] = \"Please log in\"\n redirect_to :controller => :login, :action => :login\n end\n end", "def authorize_user_on(lmda)\n\t\tcurrent_user = get_user_by_token\n\t\trender_unauthorized_msg unless current_user && lmda.call(current_user)\n\tend", "def logged_in\r\n end", "def user_stray\n if !logged_in? || @user == nil\n flash[:alert] = \"You have been logged out of your session. Please log back in to continue.\"\n redirect \"/\"\n elsif @user.id != current_user.id\n flash[:alert] = \"You do not have permission to view or edit other users' content.\"\n redirect \"/\"\n end\n end", "def authorized?\nlogged_in?\nend", "def authorize\n if !user_signed_in?\n redirect_to new_user_session_path\n end\n end", "def authorize # we can call it anything\n redirect_to '/login' unless current_user # if there is a current user then it will never redirect\n end", "def authorize\n if current_user != @profile.username\n flash[:alert] = \"Cannot access this profile\"\n redirect_to root_path\n end\n end", "def ensure_user_logged_in\n bounce_user unless current_user\n end", "def pre_authorize_cb=(_arg0); end", "def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end", "def check_if_user_access\n if current_user && current_user.admin?\n @all_orders = Order.all\n @orders = @all_orders.paginate(page: params[:page])\n elsif current_user && current_user.role == \"Partner\"\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.your_company_not_verified'\n elsif current_user && current_user.role == \"Client\"\n @all_orders = @user_company.orders\n @orders = @all_orders.paginate(page: params[:page])\n else\n end\n end", "def if_permits? (object)\n if object && object.author?(current_user)\n yield\n else\n flash[:notice] = 'You are not authorized!'\n redirect_to root_url\n end\n end", "def permit_user\n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to see all orders.'\n respond_to do |format| \n format.html {redirect_to(root_url)}\n end\n end\n end", "def authorize\n unless User.find_by(id: session[:user_id])\n redirect_to login_url, notice: \"Please log in\"\n end\n end", "def logged_user_only\n unless logged_in?\n\t store_location\n\t flash[:danger] = \"Please log in!\"\n\t redirect_to login_url\n\tend\n end", "def authorize \n unless logged_in?\n flash[:danger] = \"You must be logged in to view that... Please log in.\"\n redirect_to new_session_path unless logged_in?\n end\n end", "def set_current_user\n current_user\n authorize\n end", "def authorize\n\t if session[:user_id].nil?\n\t\t session[:original_uri] = request.request_uri\n\t\t redirect_to(login_path)\n\t\t flash[:notice] = \"Please login or sign up to access The Mashera Project!\"\n\t end\n end", "def valid_user\n unless (@user && @user.approved? &&\n @user.authenticated?(:reset, params[:id]))\n redirect_to root_url\n end\n end", "def authorize_user!\n if !current_user.present?\n render json: {error: 'No user error'}\n end\n end" ]
[ "0.75316554", "0.7312693", "0.7113758", "0.6977065", "0.69458735", "0.69021463", "0.68362516", "0.6732569", "0.6713503", "0.66977555", "0.6653625", "0.66313475", "0.66086006", "0.66001356", "0.6572119", "0.65679175", "0.65579724", "0.65499", "0.6535345", "0.65286064", "0.6522455", "0.6520978", "0.65134066", "0.64905053", "0.64898443", "0.6483896", "0.6471602", "0.6464911", "0.6464611", "0.6464611", "0.64579827", "0.64455444", "0.6445105", "0.6442377", "0.64326847", "0.6421518", "0.6419605", "0.6417076", "0.64145184", "0.64076036", "0.639435", "0.6392856", "0.6385679", "0.63825303", "0.63795453", "0.6371437", "0.63714194", "0.636058", "0.6359081", "0.63493", "0.6348725", "0.6348596", "0.63471544", "0.6343196", "0.63417065", "0.6341073", "0.6339831", "0.63356644", "0.63149333", "0.6313204", "0.6311303", "0.630584", "0.63052154", "0.6304548", "0.6296455", "0.62949497", "0.629365", "0.6293004", "0.62927306", "0.6292604", "0.62887496", "0.62886524", "0.6287325", "0.6281256", "0.6280085", "0.6273388", "0.6272055", "0.6271523", "0.62667614", "0.6265965", "0.6263536", "0.626209", "0.62518364", "0.6251546", "0.62427574", "0.62401485", "0.6237552", "0.62364155", "0.6235207", "0.6232965", "0.6225139", "0.62227345", "0.6221904", "0.62192136", "0.6214014", "0.619877", "0.61978406", "0.6195328", "0.61930186", "0.6191852", "0.61878943" ]
0.0
-1
confirms an admin user
def admin_user redirect_to(root_url) unless current_user.admin? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm_admin\n \tunless session[:admin]\n \t\tflash[:notice] = \"You are not an admin.\"\n \t\tredirect_to(user_path( :id => session[:user_id]))\n \tend\n end", "def confirm_admin\n @confirm_admin = true if session[:role_name] == 'Administrator'\n end", "def confirm_admin\n redirect_to root_path unless current_user.admin?\n end", "def app_admin_confirm\n end", "def confirm\n if current_visitor && current_visitor.has_role?('admin', 'manager')\n user = User.find(params[:id]) unless params[:id].blank?\n if !params[:id].blank? && user && user.state != \"active\"\n user.confirm!\n user.make_user_a_member\n # assume this type of user just activated someone from somewhere else in the app\n flash[:notice] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n else\n flash[:notice] = \"Please login as an administrator.\"\n redirect_to(root_path)\n end\n end", "def confirm\n\n end", "def admin_user!\n unless signed_in? and current_user.admin?\n\t flash[:notice]=\"Por favor inicie sesión como administrador\".encode('UTF-8')\n\t redirect_back(fallback_location: root_path) \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 admin_user\n unless current_user.is_admin?\n flash[:danger] = \"Keine Berechtigung.\"\n redirect_to(root_url)\n end\n end", "def confirm_account\n confirm\n end", "def admin_user\n\t\t\tflash_text = \"Administrative privilege required to perform this action.\"\n\t\t\tflash[:danger] = flash_text unless current_user.admin?\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end", "def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end", "def admin_approve_user\n @user.update(approved: true)\n redirect_to admin_path, notice: \"User Approved\"\n end", "def confirm\r\n # Change user status to active\r\n update(status: :active)\r\n # Update all pending company_roles to active\r\n company_roles.update_all(status: 1)\r\n NotifyMailer.welcome_mail(self).deliver_later\r\n super\r\n end", "def delete_confirm\n return appctrl_not_permitted() unless ( @current_user.admin? )\n\n # Nobody can delete admin accounts. You must assign the admin\n # privilege to someone else, then, since you can't revoke your\n # own admin privileges either, have the new admin change your\n # account type and delete the user record. This is a good way\n # of ensuring that there is always at least one admin.\n\n @record = User.find( params[ :id ] )\n return appctrl_not_permitted() if ( @record.admin? )\n\n @record.destroy()\n\n flash[ :notice ] = 'User and all associated data deleted'\n redirect_to( users_path() )\n end", "def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end", "def admin_user\n redirect_to(root_url) and flash[:danger] = \"Only admins can do that!\" unless current_user.admin?\n\n end", "def confirm\n end", "def confirm\n end", "def admin_user\n if user_signed_in? && current_user.adminrole?\n flash.now[:success] = \"Admin Access Granted\"\n else\n redirect_to root_path\n end\n end", "def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end", "def admin_user\n if(!current_user.admin?)\n flash[:danger] = \"Access Denied. Admin required\"\n redirect_to root_url\n end\n end", "def admin_update\n @user = User.find_by_id(params[:user_id])\n if @user.update(email: params[:user][:email], display_name: params[:user][:display_name], admin: params[:user][:admin])\n if params[:user][:admin] == \"1\"\n add_user_to_admin_role(@user)\n else\n delete_user_from_admin_role(@user)\n end\n flash.keep[:notice] = 'The \"' + params[:user][:email] + '\" account was successfully updated.'\n redirect_to '/users'\n else\n render :admin_edit\n end\n end", "def confirm\n user = User.find(params[:id])\n authorize user\n if user.state != \"active\"\n user.confirm\n user.make_user_a_member\n\n # assume this type of user just activated someone from somewhere else in the app\n flash['notice'] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n end", "def confirm\n \t\tuser = User.find_by_uid params[:uid]\n \t\tuser.confirm_email params[:confirmation_code]\n \t\tif not user.confirmed?\n \t\tflash[:error] = \"You're link doesn't match what we have on record.\"\n \t\tredirect_to signup_path\n \t\telse\n \t\tsession[:user] = user\n \t\tflash[:success] = \"We will update you at #{user.email} with new information as it because available\"\n \t\tredirect_to dashboard_path\n \t\tend \n \tend", "def confirm!\n @@api.post(endpoint: self.endpoint + ['confirm'])\n end", "def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end", "def admin_user\n unless current_user.admin?\n flash[:danger] = \"You do not have the permission to do that.\"\n redirect_to home_path\n end\n end", "def confirm!\n welcome_email\n super\n end", "def verify_admin\n if !current_user.present? || current_user.email != I18n.t('general.admin_email')\n redirect_to concerts_path\n flash[:notice] = I18n.t('general.log_as_admin')\n end\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 admin_user\n unless current_user && current_user.admin?\n store_location\n flash[:danger] = \"Please log in as admin.\"\n redirect_to users_url\n end\n end", "def confirmation(user)\n \n @user = user\n\n if Rails.env.production?\n @root_path = \"http://allianz-community.com/\"\n else\n @root_path = \"http://localhost:3000/\"\n end\n\n @confirm_path = @root_path + users_confirm_path + \"?id=\"[email protected]_s+\"&hash=\" + @user.confirm_hash\n mail to: @user.mail, subject: 'Email confiramtion'\n end", "def adminConfirmation\n ContactMailer.adminConfirmation\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 admin_user\n unless ( logged_in? && current_user.admin? )\n store_location\n flash[:danger] = \"У Вас недостаточно прав для выполнения этой операции.\"\n redirect_to root_url\n end \n # redirect_to(root_url) unless current_user.admin?\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 send_confirmation\n reply 'confirmation'\n end", "def admin_user\n unless logged_in? && current_user.is_admin?\n flash[:danger] = \"Must be admin to modify ingredients\"\n redirect_to(ingredients_url) \n end\n end", "def admin_user \n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to edit menu.'\n \n redirect_to(root_url)\n end\n end", "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 && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\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 admin\n unless current_user.admin?\n flash[:danger] = \"Sorry, you must be an admin to do that.\"\n redirect_to user_path(current_user)\n end\n end", "def confirmation\n end", "def resend_confirmation_email\n unless current_user.confirmed?\n current_user.send_confirmation_instructions\n flash[:success] = I18n.t('flash.success.confirmation_sent')\n end\n redirect_to home_path\n end", "def confirm\n user = User.find_by_email(params[:email])\n # make sure user do not use the string \"used\" to hack the system\n if user.token != \"used\" && params[:token] == user.token\n user.confirm = true\n user.token = \"used\" #token is only for one time use\n if user.save\n session[:user_id] = user.id\n redirect_to main_path\n end\n else\n render :text => \"You have confirmed before. Or something went wrong\"\n end\n end", "def confirm!\n welcome_message\n super\n end", "def confirm!\n welcome_message\n super\n end", "def send_confirmation\n send_message(\"confirmation\")\n end", "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 reject_admin\n @admin = Admin.find_by(email: params[:admin][:email].downcase)\n if @admin\n if @admin.valid_password?(params[:admin][:password]) && (@admin.active_for_authentication? == false)\n flash[:danger] = \"退会済みです。\"\n redirect_to new_admin_session_path\n end\n else\n flash.now[:notice] = \"必須項目を入力してください。\"\n end\n end", "def admin_deny_user\n @user.destroy\n redirect_to admin_path, notice: \"User Denied and Account Deleted\"\n end", "def admin_user\n @user = current_user\n redirect_to @user unless @user.admin?\n end", "def admin_user\n if current_user.admin? || current_user.subadmin?\n # pass\n else\n flash[:error] = \"曲情報を変更する権限がありません。\"\n redirect_to(root_path)\n end\n end", "def notify_about_sign_up(user, admin)\n @user = user\n mail(:to => admin.email, :subject => \"New User | #{user.name}\", :reply_to => \"[email protected]\")\n end", "def make_user_admin\n @requested_user = User.find(params[:id])\n if @requested_user.present?\n if @requested_user.is_admin?\n @requested_user.update_columns(:is_admin => false)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully degraded from admin.\"}\n else\n @requested_user.update_columns(:is_admin => true)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully upgraded as admin.\"}\n end\n else\n redirect_to admin_index_path, :flash => {:notice => \"Requested user not found.\"}\n end\n end", "def admin_user\n redirect_to(admin_admins_path) unless current_user.admin?\n end", "def account_confirmed(user)\n @notify_subject = strip_tags( \"USER CONFIRMED ACCOUNT AT #{ENV['APPLICATION_CONFIG_name']}\")\n @user = user\n mail( :to => ENV['APPLICATION_CONFIG_admin_notification_address'], :subject => @notify_subject)\n end", "def confirm\n user = User.find_by_username params[:username]\n raise ActiveRecord::RecordNotFound unless user\n\n command = ConfirmUserCommand.new(user, params[:code], request.remote_ip)\n begin\n command.execute\n rescue => e\n flash['error'] = \"#{e}\"\n redirect_to signin_url\n else\n render 'confirmed'\n end\n end", "def admin_reactivate\n user = User.find(params[:id])\n authorize! :edit, @user #prevent other users from disabling OTP on another user.\n user.deactivated = false\n user.save!\n flash[:notice] = \"Successfully Reactivated user.\"\n redirect_back(fallback_location: '/')\n end", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end", "def confirm(user)\n @greeting = \"Hi\"\n @user = user\n\n mail to: user.email, subject: 'Welcome to Hikultura!'\n end", "def admin_user\n redirect_to(current_user) unless current_user.admin?\n end", "def confirm_user\n @user = User.find_by_confirmation_token(params[:user][:confirmation_token])\n if @user.blank?\n render :confirm_user_failed\n return\n end \n # Slim down the hash I send to Devise to avoid Mass-Update-problems:\n params_user = {'name' => params[:user][:name], \n 'password' => params[:user][:password], \n 'password_confirmation' => params[:user][:password_confirmation]\n }\n if @user.update_attributes(params_user) and @user.password_match?\n @user = User.confirm_by_token(@user.confirmation_token)\n set_flash_message :notice, :confirmed \n sign_in_and_redirect(\"user\", @user)\n else\n render :confirm_user_failed\n return\n end # if\n end", "def admin_user\n redirect_to(root_path) unless (current_user != nil && current_user.admin == true)\n end", "def admin_message\n redirect_to root_path unless admin_user?\n end", "def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end", "def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end", "def correct_user\n @userAdmin = UserAdmin.find(params[:id])\n unless current_user?(@userAdmin)\n flash[:danger] = \"You don't have the rights for this page/action.\"\n redirect_to(root_url)\n end\n end", "def verify_admin_of_user\n redirect_to admins_path,\n flash: { alert: I18n.t(\"administrator.flash.unauthorized\") } unless current_user.admin_of?(@user, \"can_manage_users\")\n end", "def be_admin\n if current_user.switch_to(\"admin\")\n flash[:notice] = \"You have now an 'admin' role\"\n else\n flash[:error] = \"You are not authorized to have a 'admin' role\"\n end\n redirect_to( request.env[\"HTTP_REFERER\"])\n end", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "def admin_user\n redirect_to(root_path) unless current_user.try(:admin?) || current_user?(@user)\n end", "def resend_confirmation\n return unless request.post?\n if current_user.activated_at\n flash.now[:error] = \"Your account has already been activated.\"\n else\n UserNotifier.deliver_signup_notification(current_user)\n flash.now[:notice] = \"Your confirmation email has been re-sent\"\n render :action => 'index'\n end\n end", "def admin_user\n redirect_to(root_url) unless !current_user?(@user) && current_user.admin?\n end", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end", "def admin_user\n redirect_to(root_path) unless is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def sendmail_confirm(user)\n @greeting = \"Hi\"\n @username = user.username\n @userid = user.userid\n\n mail to: \"[email protected]\", subject: \"登録完了通知\"\n end", "def send_admin_notification\n Notifications.send_admin_notification(User.admin, self).deliver\n end", "def correct_user_or_admin\n user = TempOrder.find(params[:id]).user\n unless current_user?(user) || admin_user?\n flash[:danger] = \"Uncorrect user.\"\n redirect_to root_url\n end\n end", "def admin_user\n redirect_to(root_path) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_path) unless current_user.admin?\n end", "def verify_admin\n unless current_user.admin? or params[:id].to_i == current_user.id\n redirect_to users_path, :alert => 'You are unauthorized to do that.'\n end\n end", "def admin_user\n if (!current_user || current_user.username != 'admin')\n redirect_to(root_url)\n end\n end", "def admin!\n redirect_to root_path, alert: \"Not authorized\" and return unless is_admin?\n end" ]
[ "0.7697981", "0.74684256", "0.7379142", "0.7310748", "0.71069634", "0.7019786", "0.7013378", "0.6966331", "0.6966331", "0.68908453", "0.6883885", "0.682983", "0.682983", "0.68054116", "0.68000907", "0.6790239", "0.6789358", "0.6779583", "0.67254925", "0.67254925", "0.66813904", "0.6667498", "0.6659041", "0.665796", "0.66516864", "0.6643422", "0.66296077", "0.6599069", "0.6567365", "0.6555583", "0.654312", "0.65410805", "0.6539413", "0.65391916", "0.6528127", "0.65166277", "0.6510065", "0.65054834", "0.6489168", "0.6475198", "0.6472356", "0.6468048", "0.64444464", "0.6444286", "0.64366996", "0.6427427", "0.64201057", "0.64194024", "0.64147437", "0.64147437", "0.64104384", "0.6406401", "0.6406048", "0.6394958", "0.63879806", "0.6373755", "0.6357549", "0.634649", "0.6345904", "0.6343719", "0.63391525", "0.63335747", "0.63265824", "0.6321396", "0.63210475", "0.63157654", "0.62979317", "0.6290103", "0.62870246", "0.62870246", "0.6280096", "0.6279034", "0.62757236", "0.6273019", "0.6273019", "0.6271946", "0.6262179", "0.62524766", "0.6251417", "0.6251417", "0.62433004", "0.6234492", "0.6234492", "0.6234492", "0.6234492", "0.62328297", "0.6232721", "0.6231281", "0.6230024", "0.6230024", "0.62062675", "0.620489", "0.6200763" ]
0.0
-1
GET /card_font_alignments/1 GET /card_font_alignments/1.json
def show @card_font_alignment = CardFontAlignment.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @card_font_alignment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @card_font_alignment = CardFontAlignment.find(params[:id])\n @card_font_alignment.destroy\n\n respond_to do |format|\n format.html { redirect_to card_font_alignments_url }\n format.json { head :no_content }\n end\n end", "def new\n @card_font_alignment = CardFontAlignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_font_alignment }\n end\n end", "def create\n @card_font_alignment = CardFontAlignment.new(params[:card_font_alignment])\n\n respond_to do |format|\n if @card_font_alignment.save\n format.html { redirect_to @card_font_alignment, notice: 'Card font alignment was successfully created.' }\n format.json { render json: @card_font_alignment, status: :created, location: @card_font_alignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card_font_alignment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @card_font_alignment = CardFontAlignment.find(params[:id])\n\n respond_to do |format|\n if @card_font_alignment.update_attributes(params[:card_font_alignment])\n format.html { redirect_to @card_font_alignment, notice: 'Card font alignment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_font_alignment.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @card_font_family = CardFontFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_font_family }\n end\n end", "def destroy\n @card_font_family = CardFontFamily.find(params[:id])\n @card_font_family.destroy\n\n respond_to do |format|\n format.html { redirect_to card_font_families_url }\n format.json { head :no_content }\n end\n end", "def new\n @card_font_family = CardFontFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_font_family }\n end\n end", "def update\n @card_font_family = CardFontFamily.find(params[:id])\n\n respond_to do |format|\n if @card_font_family.update_attributes(params[:card_font_family])\n format.html { redirect_to @card_font_family, notice: 'Card font family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_font_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.find(params[:id])\n @font_families = get_font_family_array(@project)\n respond_to do |format|\n if @font_set.update(font_set_params)\n format.html { redirect_to project_details_url(@project), notice: 'Font set was successfully updated.' }\n format.json { render :show, status: :ok, location: @font_set }\n else\n format.html { render :edit }\n format.json { render json: @font_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @card_font_family = CardFontFamily.new(params[:card_font_family])\n\n respond_to do |format|\n if @card_font_family.save\n format.html { redirect_to @card_font_family, notice: 'Card font family was successfully created.' }\n format.json { render json: @card_font_family, status: :created, location: @card_font_family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card_font_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.build(font_set_params)\n @font_families = get_font_family_array(@project)\n\n respond_to do |format|\n if @font_set.save\n format.html { redirect_to project_details_url(@project), notice: 'Font set was successfully created.' }\n format.json { render :show, status: :created, location: @font_set }\n else\n format.html { render :new }\n format.json { render json: @font_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def fonts\n request('ListFonts')\n end", "def styles\n respond_to do |format|\n format.json{ render :json => helpers.get_style(params[:style_id], :json) }\n end\n end", "def get_font_latin_attributes(font)\n return [] unless font\n\n attributes = []\n attributes << 'typeface' << font[:_name] if ptrue?(font[:_name])\n attributes << 'pitchFamily' << font[:_pitch_family] if font[:_pitch_family]\n attributes << 'charset' << font[:_charset] if font[:_charset]\n\n attributes\n end", "def alignments\n map { |alignment| alignment }\n end", "def serif_params\n params[:serif]\n end", "def alignment\n fetch('dnd.alignments')\n end", "def getTargetingAnnosCanvasFromID\n inputID = params['id']\n targetingAnno = Annotation.where(annotation_id: inputID).first\n origCanvasAnno = getTargetingAnnosCanvas(targetingAnno)\n request.format = \"json\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: origCanvasAnno, content_type: \"application/text\" }\n end\n end", "def set_font_set_and_project\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.find(params[:id])\n @font_families = get_font_family_array(@project)\n end", "def load_fonts\n\n # Load fonts.\n self.load_single_font('Across The Road')\n self.load_single_font('Alabama')\n self.load_single_font('Arial')\n self.load_single_font('Arial Narrow')\n self.load_single_font('Arty Signature')\n self.load_single_font('Asem Kandis')\n self.load_single_font('Autograf')\n self.load_single_font('Born Ready')\n self.load_single_font('Brittany Signature')\n self.load_single_font('Bulgatti')\n self.load_single_font('Courier New')\n self.load_single_font('Estelly')\n self.load_single_font('Friday Vibes')\n self.load_single_font('From Skyler')\n self.load_single_font('Gallatone')\n self.load_single_font('Halimun')\n self.load_single_font('Hello Santtiny')\n self.load_single_font('Just Realize')\n self.load_single_font('Just Signature')\n self.load_single_font('Mayestica')\n self.load_single_font('Menlo')\n self.load_single_font('Notera')\n self.load_single_font('Prestige Signature')\n self.load_single_font('Reinata')\n self.load_single_font('Santos Dumont')\n self.load_single_font('SF Mono')\n self.load_single_font('Shopping List')\n self.load_single_font('Signatures')\n self.load_single_font('Signerica')\n self.load_single_font('Silver Pen')\n self.load_single_font('Sophistica')\n self.load_single_font('Source Code Pro')\n self.load_single_font('Southampton')\n self.load_single_font('Thankfully')\n self.load_single_font('The Jacklyn')\n self.load_single_font('Tomatoes')\n self.load_single_font('Wanted Signature')\n self.load_single_font('White Angelica')\n self.load_single_font('Whitney')\n self.load_single_font('Whitney Bold')\n self.load_single_font('Whitney Index Rounded')\n self.load_single_font('Whitney Index Squared')\n self.load_single_font('Xtreem')\n self.load_single_font('Gotham Condensed')\n\n end", "def id\n read_attribute(:font_id)\n end", "def get_font_style_attributes(font)\n return [] unless font\n\n attributes = []\n attributes << 'sz' << font[:_size] if ptrue?(font[:_size])\n attributes << 'b' << font[:_bold] if font[:_bold]\n attributes << 'i' << font[:_italic] if font[:_italic]\n attributes << 'u' << 'sng' if font[:_underline]\n\n attributes << 'baseline' << font[:_baseline]\n attributes\n end", "def get_font_scheme(slide_number,storage_type='',storage_name='')\n begin\n if @filename == ''\n raise 'No file name specified'\n end\n str_uri = $product_uri + '/slides/' + @filename + '/slides/' + slide_number.to_s + '/theme/fontScheme'\n if !storage_name.empty?\n str_uri += '?storage=' + storage_name\n end\n signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n response = RestClient.get(signed_uri, :accept => 'application/json')\n json = JSON.parse(response)\n return json['FontScheme']\n rescue Exception=>e\n print e\n end\n end", "def align\n @genome = Genome.find(params[:id])\n @proteins = Protein.all\n @method = params[:method]\n\n if params[:method] == 'local'\n @message = 'Local alignment'\n align_all_local\n elsif params[:method] == 'global'\n @message = 'Global alignment'\n align_all_global\n end\n\n end", "def show\n @text_size = TextSize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_size }\n end\n end", "def show\n render json: @campaign, include: [\n '*', characters: [:class, :race, :player, status: [:alignment]]\n ]\n end", "def get_all_alignments_as_string\n @alignments.values.compact.collect{ |a| get_alignment_as_string(a) }.insert(0, alignment)\n end", "def load_single_font(name)\n \n # Determine path to font file.\n font_file_name = name.gsub(/\\s+/, \"\")\n path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}.ttf\")\n return unless File.file?(path)\n\n # Determine variants.\n italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Italic.ttf\")\n bold_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Bold.ttf\")\n bold_italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-BoldItalic.ttf\")\n\n # Build hash of variants.\n font_hash = { normal: path }\n font_hash[:italic] = italics_path if File.file?(italics_path)\n font_hash[:bold] = bold_path if File.file?(bold_path)\n font_hash[:bold_italic] = bold_italics_path if File.file?(bold_italics_path)\n\n # Add font.\n self.font_families.update(name => font_hash)\n\n end", "def load_single_font(name)\n\n # Determine path to font file.\n font_file_name = name.gsub(/\\s+/, \"\")\n path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}.ttf\")\n return unless File.file?(path)\n\n # Determine variants.\n italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Italic.ttf\")\n bold_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Bold.ttf\")\n bold_italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-BoldItalic.ttf\")\n\n # Build hash of variants.\n font_hash = { normal: path }\n font_hash[:italic] = italics_path if File.file?(italics_path)\n font_hash[:bold] = bold_path if File.file?(bold_path)\n font_hash[:bold_italic] = bold_italics_path if File.file?(bold_italics_path)\n\n # Add font.\n self.font_families.update(name => font_hash)\n\n end", "def show\n @alignment = Alignment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alignment }\n end\n end", "def font\n @font_path\n end", "def name\n read_attribute(:font_name)\n end", "def set_serif\n @serif = Serif.find(params[:id])\n end", "def index\n @body_style_sizes = if params[:size_id]\n Size.find(params[:size_id]).body_style_sizes.ordered\n else\n BodyStyleSize.ordered\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @body_style_sizes }\n end\n end", "def index\n @serifs = Serif.all\n end", "def font_set_params\n params.require(:font_set).permit(:sass,\n :project_id,\n :name,\n :main_headline,\n :secondary_headline,\n :body,\n :byline,\n :pullquote,\n :blockquote,\n :big_number,\n :big_number_label)\n end", "def destroy\n @font_set = FontSet.find(params[:id])\n project = @font_set.project\n @font_set.destroy\n respond_to do |format|\n format.html { redirect_to project_details_url(project), notice: 'Font set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def font\n return @font\n end", "def parse_cards_json\n filepath = File.join(Rails.root, 'db', 'json', 'AllSets.enUS.json')\n file_contents = File.open(filepath).read\n JSON.parse(file_contents)\nend", "def font idx\n @fonts[idx]\n end", "def show\n @arbitro = Arbitro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arbitro }\n format.pdf { render :layout => false }\n end\n end", "def type1_font_names\n if @options[:built_in_fonts]\n PdfK::FONT_NAMES\n else\n AFM::font_names\n end\n end", "def text(align=0)\n return @text[align]\n end", "def get_font_scheme_with_http_info(name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_font_scheme ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_font_scheme\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.get_font_scheme\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/theme/fontScheme'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'FontScheme')\n return data, status_code, headers\n end", "def get_fonts_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_fonts ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_fonts\"\n end\n # resource path\n local_var_path = '/slides/{name}/fonts'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'FontsData')\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @serif.update(serif_params)\n format.html { redirect_to @serif, notice: 'Serif was successfully updated.' }\n format.json { render :show, status: :ok, location: @serif }\n else\n format.html { render :edit }\n format.json { render json: @serif.errors, status: :unprocessable_entity }\n end\n end\n end", "def [](index)\n alignments.fetch(index, DEFAULT)\n end", "def show\n @character_sheet = CharacterSheet.find(params[:id])\n @character_sheets = CharacterSheet.all \n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @character_sheet }\n format.pdf do\n pdf = Sheet.new(@character_sheet, view_context)\n send_data pdf.render, filename: \"character_sheet_#{ @character_sheet.name}.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\" \n end\n end\n end", "def align\n unless defined?(@align); parse_align; end\n @align\n end", "def align\n unless defined?(@align); parse_align; end\n @align\n end", "def show \n mtgcard = Mtgcard.find(params[:id])\n render json: mtgcard\n end", "def align\n @options[:align]\n end", "def font_id(style_index)\n xf_id(style_index)[:fontId]\n end", "def query_align(seqs)\n seqtype = nil\n unless seqs.is_a?(Bio::Alignment)\n seqs = Bio::Alignment.new(seqs)\n end\n seqs.each do |s|\n if s.is_a?(Bio::Sequence::AA) then\n seqtype = 'PROTEIN'\n elsif s.is_a?(Bio::Sequence::NA) then\n seqtype = 'DNA'\n end\n break if seqtype\n end\n query_string(seqs.to_fasta(70, :avoid_same_name => true), seqtype)\n end", "def index\n @all_textual_content = @card.textual_content\n end", "def apply\n @anchoring = Anchoring.find(params[:id])\n @anchorage_grounds = AnchorageGround.all\n\n respond_to do |format|\n format.html # apply.html.erb\n format.json { render json: @anchoring }\n end\n end", "def show\n @car_body_style = CarBodyStyle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @car_body_style }\n end\n end", "def show\n @body_style_size = BodyStyleSize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @body_style_size }\n end\n end", "def font\n\t\treturn @font\n\tend", "def show\n respond_to do |format|\n format.html {}\n format.json do\n\n hash_card = {\n name: @card.name,\n desc: @card.oracle_text,\n url: card_path(@card)\n }\n\n render json: hash_card\n end\n end\n end", "def show\n @proposal = Proposal.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @proposal }\n format.pdf do\n render :pdf => \"proposal\", :template => \"proposals/show\"\n end\n end\n end", "def destroy\n @serif.destroy\n respond_to do |format|\n format.html { redirect_to serifs_url, notice: 'Serif was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def get_alignment\n @halign = CP::CMS::DEFAULT_ALIGNMENT # Sets alignment to default\n @halign = 2 if @text.include?(\"\\\\alir\") # Sets alignment to right\n @halign = 2 if @text.include?(\"\\\\ar\")\n @halign = 1 if @text.include?(\"\\\\alic\") # Sets alignment to center\n @halign = 1 if @text.include?(\"\\\\ac\")\n @halign = 0 if @text.include?(\"\\\\alil\") # Sets alignment to left\n @halign = 0 if @text.include?(\"\\\\al\")\n @text.gsub!(/\\\\(?:alil|alic|alir|ar|ac|al)/){\"\"}# Clears alignment modifiers\n end", "def index\n @japan_styles = JapanStyle.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @japan_styles }\n end\n end", "def index\n @body_styles = if params[:design_id]\n Design.find(params[:design_id]).body_styles\n elsif params[:color_id]\n Color.find(params[:color_id]).body_styles\n else\n BodyStyle\n end.ordered.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @body_styles }\n end\n end", "def convert_fonts\n out = \"\"\n sass.each_line do |line|\n line.gsub!(/(\\s*)(word-spacing|letter-spacing|font-size|line-height|margin-[^\\s]+|margin|padding-[\\s]+|padding)\\s*:(.*)/) do |m|\n # indent rule: value\n m = \"#{$1}#{$2}: #{CSS.val_to_em($3)}\"\n end\n out << line\n end\n self.sass = out\n end", "def index\n @ma_tables = MaTable.all\n respond_to do |format|\n\tformat.html\n\tformat.json\n\tformat.pdf{render template: 'ma_tables/resultat', pdf:'Resultat'}\n end\n end", "def to_mjson\n # Check first for a correction\n page_content = self.correction_existent_check\n\n if page_content.content_type == 'ocr_azure'\n return Azure.to_mjson(page_content.id)\n elsif page_content.content_type == 'ocr_google'\n # still to be implemented\n return\n elsif page_content.content_type == 'ocr_tesseract'\n # still to be implemented\n return\n elsif page_content.content_type == 'pdf_text'\n # still to be implemented\n return\n elsif page_content.content_type == 'correction'\n # Already stored in mJSON format\n return Storage.get_file(ENV['AWS_S3_DIR_PAGE_CONTENTS'], issue_id, page_content.filename).body.force_encoding('UTF-8')\n else\n return \"No text extraction exists for this page\"\n end\n end", "def convert_font_args(params)\n return unless params\n font = {\n :_name => params[:name],\n :_color => params[:color],\n :_size => params[:size],\n :_bold => params[:bold],\n :_italic => params[:italic],\n :_underline => params[:underline],\n :_pitch_family => params[:pitch_family],\n :_charset => params[:charset],\n :_baseline => params[:baseline] || 0\n }\n\n # Convert font size units.\n font[:_size] *= 100 if font[:_size] && font[:_size] != 0\n\n font\n end", "def show\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @card }\n format.pdf {\n @page_size=params[\"page_size\"]\n @page_layout = params[\"page_layout\"]\n prawnto :prawn => { :left_margin=>0,:right_margin=>0,:bottom_margin=>0,:top_margin=>0,:page_size=>params[\"page_size\"],:page_layout=>params[\"layout\"].to_sym }\n # @iconv = Iconv.new('acsii', 'utf-8') \n # @desc [email protected](@card.desc)\n @desc = @card.desc\n @font_size = params[\"font_size\"].to_i\n render :layout => false\n }\n end\n end", "def text_align(alignment)\n Kernel.raise ArgumentError, \"Unknown alignment constant: #{alignment}\" unless ALIGN_TYPE_NAMES.key?(alignment.to_i)\n primitive \"text-align #{ALIGN_TYPE_NAMES[alignment.to_i]}\"\n end", "def inferred_alignment(aligned_source)\n tokens.select(&:alignment_id).map do |token|\n token.alignment(aligned_source)\n end.flatten.compact.map(&:sentence).uniq\n end", "def show\n @announcement = Announcement.find(params[:id])\n @billboard = @announcement.billboard\n @json_billboard = @billboard.to_gmaps4rails\n \n generate_map_json @announcement\n respond_to do |format|Billboard.all\n format.html # show.html.erb\n format.json { render json: @announcement }\n\n format.pdf do\n render :pdf => \"flyer\", :no_background => false\n end\n end\n end", "def get_document_free_text_annotations_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_document_free_text_annotations ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_document_free_text_annotations\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/annotations/freetext\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FreeTextAnnotationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_document_free_text_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @glyph = Glyph.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glyph }\n end\n end", "def create\n @alignment = Alignment.new(params[:alignment])\n\n respond_to do |format|\n if @alignment.save\n format.html { redirect_to(@alignment, :notice => 'Alignment was successfully created.') }\n format.xml { render :xml => @alignment, :status => :created, :location => @alignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alignment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @guide = Guide.all.find(params[:id])\n \n respond_to do |format|\n format.html\n format.json\n format.pdf { render pdf: \"Show\",\n :page_size => 'A4',\n :dpi => '300',\n :margin => {:top => 0,\n :bottom => 0,\n :left => 0,\n :right => 0},\n :margin => {\n :top => 30,\n :bottom => 0\n },\n template: 'guides/show',\n layout: 'pdf.html'\n }\n end\n end", "def index\n @shape_text = UniqueShapeName.for_profiles\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shape_text }\n end\n end", "def set_font\n font_families.update(\n 'HealthQuestPDF' => {\n normal: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-regular-webfont.ttf'),\n medium: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-bold-webfont.ttf'),\n bold: HealthQuest::Engine.root.join('lib', 'fonts', 'bitter-bold.ttf')\n }\n )\n font 'HealthQuestPDF'\n end", "def fontName\n return @font_name\n end", "def index\n @character_sheets = CharacterSheet.all \n @character_sheet = @character_sheets.first \n @skills = Skill.all\n @abilities = @character_sheet.abilities if @character_sheet\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @character_sheets }\n end\n end", "def keyframe_font_sizes(scroll_offset = 0)\n data = { }\n\n initial_pos = calculate_scroll_position(:initial, scroll_offset)\n target_start_pos = calculate_scroll_position(:target_start, scroll_offset)\n target_end_pos = calculate_scroll_position(:target_end, scroll_offset)\n final_pos = calculate_scroll_position(:final, scroll_offset)\n\n data[\"data-#{initial_pos}\"] = \" font-size: #{ @layer.font_size * @layer.start_state_keyframe.scale }em;\"\n data[\"data-#{target_start_pos}\"] = \" font-size: #{ @layer.font_size * @layer.target_state_keyframe.scale }em;\"\n data[\"data-#{target_end_pos}\"] = \" font-size: #{ @layer.font_size * @layer.target_state_keyframe.scale }em;\"\n data[\"data-#{final_pos}\"] = \" font-size: #{ @layer.font_size * @layer.end_state_keyframe.scale }em;\"\n\n data\n end", "def show\n @assembly_guide = AssemblyGuide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assembly_guide }\n end\n end", "def load_font(family, height)\n end", "def index\n @allocations = Allocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @allocations }\n end\n end", "def align(align=nil)\n @options[:align] = align unless align.nil?\n @options[:align]\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @safety_cards }\n end\n end", "def show\n @mtb_among_card_type = MtbAmongCardType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mtb_among_card_type }\n end\n end", "def layout_text_json\n self.layout_text.to_json\n end", "def get_citation_styles(dbid:, an:, format: 'all')\n begin\n citation_styles_params = \"?an=#{an}&dbid=#{dbid}&styles=#{format}\"\n citation_styles_response = do_request(:get, path: @config[:citation_styles_url] + citation_styles_params)\n EBSCO::EDS::Citations.new(dbid: dbid, an: an, citation_result: citation_styles_response, eds_config: @config)\n rescue EBSCO::EDS::NotFound => e\n custom_error_message = JSON.parse e.message.gsub('=>', ':')\n # ErrorNumber 132 - Record not found\n if custom_error_message['ErrorNumber'] == '132'\n record_not_found = {\"Format\"=>format, \"Label\"=>\"\", \"Data\"=>\"\", \"Error\"=>\"Record not found\"}\n EBSCO::EDS::Citations.new(dbid: dbid, an: an, citation_result: record_not_found, eds_config: @config)\n end\n rescue EBSCO::EDS::BadRequest => e\n custom_error_message = JSON.parse e.message.gsub('=>', ':')\n unknown_error = {\"Id\"=>format, \"Label\"=>\"\", \"Data\"=>\"\", \"Error\"=>custom_error_message['ErrorDescription']}\n EBSCO::EDS::Citations.new(dbid: dbid, an: an, citation_result: unknown_error, eds_config: @config)\n end\n end", "def get_document_underline_annotations_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_document_underline_annotations ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_document_underline_annotations\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/annotations/underline\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'UnderlineAnnotationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_document_underline_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @encriptions = Encription.all\n respond_to do |format|\n \n format.html \n format.json { render json: @encriptions }\n \n end\n end", "def get_page_free_text_annotations_with_http_info(name, page_number, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_page_free_text_annotations ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_page_free_text_annotations\"\n end\n # verify the required parameter 'page_number' is set\n if @api_client.config.client_side_validation && page_number.nil?\n fail ArgumentError, \"Missing the required parameter 'page_number' when calling PdfApi.get_page_free_text_annotations\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/pages/{pageNumber}/annotations/freetext\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'pageNumber' + '}', page_number.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FreeTextAnnotationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_page_free_text_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_fonts\n font_families.update(\"Arial\" => {\n :normal => \"#{Rails.root}/vendor/assets/fonts/Arial.ttf\",\n :bold => \"#{Rails.root}/vendor/assets/fonts/Arial-Bold.ttf\"\n })\n font \"Arial\"\n end", "def styles\n [\n {:name => 'general', :num_fmt => 0},\n {:name => 'currency', :num_fmt => 5},\n {:name => 'percent', :num_fmt => 9},\n {:name => 'date', :format_code => \"yyyy-mm-dd\"},\n {:name => 'text_left', :alignment => { :horizontal => :left, :vertical => :center , :wrap_text => false}},\n {:name => 'text_center', :alignment => { :horizontal => :center, :vertical => :center , :wrap_text => false}},\n {:name => 'text_right', :alignment => { :horizontal => :right, :vertical => :center , :wrap_text => false}}\n ]\n end", "def update_font\n self.contents.font.name = @window.fontName\n #self.recalculate_maxlength\n self.refresh\n end", "def show\n @txt4 = Txt4.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @txt4 }\n end\n end", "def fonts(limit_to_type0 = false)\n fonts_array = []\n pages.each do |pg|\n r = pg[:Resources]\n next if !r\n r = r[:referenced_object] if r[:referenced_object]\n r = r[:Font]\n next if !r\n r = r[:referenced_object] if r[:referenced_object]\n r.values.each do |f|\n next if f.class != Hash\n f = f[:referenced_object] if f[:referenced_object]\n next if f.class != Hash\n if (limit_to_type0 || f[:Subtype] == :Type0) && f[:Type] == :Font && !fonts_array.include?(f)\n fonts_array << f\n end\n end\n end\n fonts_array\n end", "def _font_family(id)\n {\n 0x00 => :'Not applicable',\n 0x01 => :Roman,\n 0x02 => :Swiss,\n 0x03 => :Modern,\n 0x04 => :Script,\n 0x05 => :Decorative\n }[id]\n end", "def index\n @individual_formats = IndividualFormat.all\n end" ]
[ "0.66101265", "0.6536163", "0.646186", "0.64389396", "0.6203049", "0.57254547", "0.5626999", "0.5492396", "0.5450507", "0.5401853", "0.522552", "0.5133387", "0.50661206", "0.4997977", "0.49974945", "0.49731597", "0.49700686", "0.4935001", "0.48866022", "0.487189", "0.48540306", "0.4836726", "0.4799404", "0.47613928", "0.47440416", "0.4736793", "0.47355837", "0.4725072", "0.470695", "0.46775797", "0.46460107", "0.46403456", "0.45966613", "0.4592066", "0.4566957", "0.45638204", "0.45568964", "0.45218012", "0.4510363", "0.44976985", "0.44792736", "0.4465696", "0.4437466", "0.44273493", "0.44257626", "0.442166", "0.44075254", "0.4405367", "0.44039795", "0.44039795", "0.43929017", "0.43821016", "0.43770152", "0.43730128", "0.43605566", "0.43582612", "0.4358152", "0.4357928", "0.43545985", "0.4343381", "0.43378282", "0.4335435", "0.4326218", "0.4314422", "0.43136662", "0.43123868", "0.4311546", "0.4306843", "0.4294639", "0.42943934", "0.42927834", "0.4292396", "0.42868438", "0.42861962", "0.42854464", "0.42821324", "0.42818314", "0.42733967", "0.42713353", "0.42663768", "0.42604232", "0.42527106", "0.42512777", "0.42490497", "0.42402643", "0.42373657", "0.42370445", "0.4233238", "0.4231071", "0.42266315", "0.4226513", "0.42264894", "0.42248604", "0.42230353", "0.42226318", "0.42177948", "0.4216806", "0.42162788", "0.42145506", "0.4211793" ]
0.7276746
0
GET /card_font_alignments/new GET /card_font_alignments/new.json
def new @card_font_alignment = CardFontAlignment.new respond_to do |format| format.html # new.html.erb format.json { render json: @card_font_alignment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @card_font_alignment = CardFontAlignment.new(params[:card_font_alignment])\n\n respond_to do |format|\n if @card_font_alignment.save\n format.html { redirect_to @card_font_alignment, notice: 'Card font alignment was successfully created.' }\n format.json { render json: @card_font_alignment, status: :created, location: @card_font_alignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card_font_alignment.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @card_font_family = CardFontFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_font_family }\n end\n end", "def create\n @card_font_family = CardFontFamily.new(params[:card_font_family])\n\n respond_to do |format|\n if @card_font_family.save\n format.html { redirect_to @card_font_family, notice: 'Card font family was successfully created.' }\n format.json { render json: @card_font_family, status: :created, location: @card_font_family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card_font_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @card_font_alignment = CardFontAlignment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_font_alignment }\n end\n end", "def create\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.build(font_set_params)\n @font_families = get_font_family_array(@project)\n\n respond_to do |format|\n if @font_set.save\n format.html { redirect_to project_details_url(@project), notice: 'Font set was successfully created.' }\n format.json { render :show, status: :created, location: @font_set }\n else\n format.html { render :new }\n format.json { render json: @font_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alignment = Alignment.new(params[:alignment])\n\n respond_to do |format|\n if @alignment.save\n format.html { redirect_to(@alignment, :notice => 'Alignment was successfully created.') }\n format.xml { render :xml => @alignment, :status => :created, :location => @alignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alignment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @card_font_alignment = CardFontAlignment.find(params[:id])\n @card_font_alignment.destroy\n\n respond_to do |format|\n format.html { redirect_to card_font_alignments_url }\n format.json { head :no_content }\n end\n end", "def new\n @alignment = Alignment.new\n @seq_types = {:N=>\"N\", :L=>\"L\", :P => \"P\", \"P Cut\"=> \"P Cut\"}\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @alignment }\n end\n end", "def new\n @text_size = TextSize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_size }\n end\n end", "def update\n @card_font_alignment = CardFontAlignment.find(params[:id])\n\n respond_to do |format|\n if @card_font_alignment.update_attributes(params[:card_font_alignment])\n format.html { redirect_to @card_font_alignment, notice: 'Card font alignment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_font_alignment.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @glyph = Glyph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glyph }\n end\n end", "def new\n @construction_style = ConstructionStyle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @construction_style }\n end\n end", "def new\n @alignment_position = AlignmentPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @alignment_position }\n end\n end", "def new\n @allocation = Allocation.new params[:allocation]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @allocation }\n end\n end", "def new\n @body_style = BodyStyle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @body_style }\n end\n end", "def new\n @car_body_style = CarBodyStyle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @car_body_style }\n end\n end", "def new\n @body_style_size = BodyStyleSize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @body_style_size }\n end\n end", "def new\n @assembly_guide = AssemblyGuide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assembly_guide }\n end\n end", "def new\n @text_position = TextPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_position }\n end\n end", "def create\n @serif = Serif.new(serif_params)\n\n respond_to do |format|\n if @serif.save\n format.html { redirect_to @serif, notice: 'Serif was successfully created.' }\n format.json { render :show, status: :created, location: @serif }\n else\n format.html { render :new }\n format.json { render json: @serif.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @japan_style = JapanStyle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @japan_style }\n end\n end", "def new\n @jurisdictions = Jurisdiction.order('name')\n @text_entry = TextEntry.new\n @statute_type = StatuteType.find(params[:statute_type_id])\n @form_action = \"create\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_entry }\n end\n end", "def create\n @text_size = TextSize.new(params[:text_size])\n\n respond_to do |format|\n if @text_size.save\n format.html { redirect_to @text_size, notice: 'Text size was successfully created.' }\n format.json { render json: @text_size, status: :created, location: @text_size }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text_size.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @archetype = Archetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @archetype }\n end\n end", "def new\n @format_packing = FormatPacking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @format_packing }\n end\n end", "def new\n @ad_style = Format.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad_style }\n end\n end", "def show\n @card_font_family = CardFontFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_font_family }\n end\n end", "def new\n @assembly = Assembly.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assembly }\n end\n end", "def new\n @mtb_among_card_type = MtbAmongCardType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mtb_among_card_type }\n end\n end", "def new\n @anchoring = Anchoring.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @anchoring }\n end\n end", "def create\n @individual_format = IndividualFormat.new(individual_format_params)\n\n respond_to do |format|\n if @individual_format.save\n format.html { redirect_to @individual_format, notice: 'Individual format was successfully created.' }\n format.json { render :show, status: :created, location: @individual_format }\n else\n format.html { render :new }\n format.json { render json: @individual_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @manga = Manga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manga }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @yarn }\n end\n end", "def new\n @folha_fonte_recurso = Folha::FonteRecurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @folha_fonte_recurso }\n end\n end", "def new\n @attri = Attri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attri }\n end\n end", "def destroy\n @card_font_family = CardFontFamily.find(params[:id])\n @card_font_family.destroy\n\n respond_to do |format|\n format.html { redirect_to card_font_families_url }\n format.json { head :no_content }\n end\n end", "def create\n @allocation = Allocation.new(params[:allocation])\n\n respond_to do |format|\n if @allocation.save\n format.html { redirect_to @allocation, notice: 'Allocation was successfully created.' }\n format.json { render json: @allocation, status: :created, location: @allocation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @allocation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mtb_among_card_type = MtbAmongCardType.new(params[:mtb_among_card_type])\n\n respond_to do |format|\n if @mtb_among_card_type.save\n format.html { redirect_to @mtb_among_card_type, notice: 'Mtb among card type was successfully created.' }\n format.json { render json: @mtb_among_card_type, status: :created, location: @mtb_among_card_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mtb_among_card_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @allocation = Allocation.new(allocation_params)\n\n respond_to do |format|\n if @allocation.save\n format.html { redirect_to @allocation, notice: 'Allocation was successfully created.' }\n format.json { render :show, status: :created, location: @allocation }\n else\n format.html { render :new }\n format.json { render json: @allocation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @create_request_skill = CreateRequestSkill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @create_request_skill }\n end\n end", "def new\n @format_lookup = FormatLookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @format_lookup }\n end\n end", "def new\n @gravity = Gravity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gravity }\n end\n end", "def new\n @txt4 = Txt4.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @txt4 }\n end\n end", "def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end", "def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end", "def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end", "def create\n @subject_allocation = SubjectAllocation.new(subject_allocation_params)\n\n respond_to do |format|\n if @subject_allocation.save\n format.html { redirect_to subject_allocations_path, notice: 'Subject allocation was successfully created.' }\n format.json { render :show, status: :created, location: @subject_allocation }\n else\n format.html { render :new }\n format.json { render json: @subject_allocation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @stylist = Stylist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stylist }\n end\n end", "def new\n @pdf = Pdf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pdf }\n end\n end", "def new\n @txt3 = Txt3.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @txt3 }\n end\n end", "def new\n @space = Space.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @space }\n end\n end", "def new\n @protein = Protein.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @protein }\n end\n end", "def create\n @glyph = Glyph.new(params[:glyph])\n\n respond_to do |format|\n if @glyph.save\n format.html { redirect_to @glyph, notice: 'Glyph was successfully created.' }\n format.json { render json: @glyph, status: :created, location: @glyph }\n else\n format.html { render action: \"new\" }\n format.json { render json: @glyph.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @mallet_command = MalletCommand.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mallet_command }\n end\n end", "def create\n @allocation = Allocation.new(allocation_params)\n\n respond_to do |format|\n if @allocation.save\n format.html { redirect_to @allocation, notice: t(:allocation_created) }\n format.json { render :show, status: :created, location: @allocation }\n else\n format.html { render :new }\n format.json { render json: @allocation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @create_classified_ad = CreateClassifiedAd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @create_classified_ad }\n end\n end", "def create\n @fonte_de_recurso = FonteDeRecurso.new(fonte_de_recurso_params)\n\n respond_to do |format|\n if @fonte_de_recurso.save\n addlog(\"Fonte e recurso criada\")\n format.html { redirect_to @fonte_de_recurso, notice: 'Fonte de recurso criado com sucesso.' }\n format.json { render :show, status: :created, location: @fonte_de_recurso }\n else\n format.html { render :new }\n format.json { render json: @fonte_de_recurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @ref_protein = RefProtein.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ref_protein }\n end\n end", "def new\n @assunto_processual = AssuntoProcessual.new\n\n respond_to do |format|\n format.html { render layout: nil } # new.html.erb\n format.json { render json: @assunto_processual }\n end\n end", "def new\n @mtb_card = MtbCard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mtb_card }\n end\n end", "def new\n @tdc2sasmapping = Tdc2sasmapping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tdc2sasmapping }\n end\n end", "def new\n @sentence = Sentence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sentence }\n end\n end", "def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end", "def new\n @manifestation_type = ManifestationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manifestation_type }\n end\n end", "def new\n @stack = Stack.new\n @stack.set_default_attributes\n # TO DO - DON'T HAVE IT CREATE A NEW THING IN A DATABASE, YET\n @stack.save\n @card = Card.new\n @card.type = \"TextCard\"\n @card.stack_id = @stack.id\n #redirect to create a new card\n # redirect_to new_stack_card_path(@stack)\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cards }\n end\n\n end", "def create\n @language_family = LanguageFamily.new(language_family_params)\n\n respond_to do |format|\n if @language_family.save\n format.html { redirect_to @language_family, notice: 'Language family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @language_family }\n else\n format.html { render action: 'new' }\n format.json { render json: @language_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @request = @skill.requests.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @space_cat = SpaceCat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @space_cat }\n end\n end", "def new\n @mtb_among_card_expantion = MtbAmongCardExpantion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mtb_among_card_expantion }\n end\n end", "def new\n @corpus = Corpus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corpus }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "def new\n @body_style_categorization = BodyStyleCategorization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @body_style_categorization }\n end\n end", "def create\n @construction_style = ConstructionStyle.new(params[:construction_style])\n\n respond_to do |format|\n if @construction_style.save\n format.html { redirect_to @construction_style, notice: 'Construction style was successfully created.' }\n format.json { render json: @construction_style, status: :created, location: @construction_style }\n else\n format.html { render action: \"new\" }\n format.json { render json: @construction_style.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @questionwise_marks_distribution = QuestionwiseMarksDistribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionwise_marks_distribution }\n end\n end", "def new\n @award = Award.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @award }\n end\n end", "def new\n @award = Award.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @award }\n end\n end", "def new\n @caracteristica_cartum = CaracteristicaCartum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caracteristica_cartum }\n end\n end", "def create\n @model_acronym = ModelAcronym.new(model_acronym_params)\n\n respond_to do |format|\n if @model_acronym.save\n format.html { redirect_to @model_acronym, notice: 'Model acronym was successfully created.' }\n format.json { render action: 'show', status: :created, location: @model_acronym }\n else\n format.html { render action: 'new' }\n format.json { render json: @model_acronym.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @space_amenity = SpaceAmenity.new(space_amenity_params)\n\n respond_to do |format|\n if @space_amenity.save\n format.html { redirect_to @space_amenity, notice: 'Space amenity was successfully created.' }\n format.json { render :show, status: :created, location: @space_amenity }\n else\n format.html { render :new }\n format.json { render json: @space_amenity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @folha_fonte_recurso = Folha::FonteRecurso.new(params[:folha_fonte_recurso])\n\n respond_to do |format|\n if @folha_fonte_recurso.save\n format.html { redirect_to(@folha_fonte_recurso, :notice => 'Fonte recurso cadastrado com sucesso.') }\n format.xml { render :xml => @folha_fonte_recurso, :status => :created, :location => @folha_fonte_recurso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @folha_fonte_recurso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @amendment = Amendment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @amendment }\n end\n end", "def new\n @spanish_vocab = SpanishVocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spanish_vocab }\n end\n end", "def create\n @m_card = MCard.new(m_card_params)\n respond_to do |format|\n if @m_card.save\n format.html { redirect_to m_cards_path, notice: 'カード追加しました' }\n format.json { render action: 'show', status: :created, location: m_cards_path }\n else\n format.html { render action: 'new' }\n format.json { render json: @m_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @safety_card }\n end\n end", "def new\n @missionmaker = Missionmaker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @missionmaker }\n end\n end", "def new\n @kit = Kit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kit }\n end\n end", "def new\n @corporation = Corporation.new\n @page_header = \"Добавление новой Корпорации\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corporation }\n end\n end", "def new\n @campaign = Campaign.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @campaign }\n end\n end", "def new\n @book_format = BookFormat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_format }\n end\n end", "def update\n @card_font_family = CardFontFamily.find(params[:id])\n\n respond_to do |format|\n if @card_font_family.update_attributes(params[:card_font_family])\n format.html { redirect_to @card_font_family, notice: 'Card font family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_font_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @teaching_format = TeachingFormat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teaching_format }\n end\n end", "def create\n @bibliography_style = BibliographyStyle.new(bibliography_style_params)\n\n respond_to do |format|\n if @bibliography_style.save\n format.html { redirect_to @bibliography_style, notice: 'Bibliography style was successfully created.' }\n format.json { render :show, status: :created, location: @bibliography_style }\n else\n format.html { render :new }\n format.json { render json: @bibliography_style.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @atr = Atr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @atr }\n end\n end", "def new\n @document_format = DocumentFormat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_format }\n end\n end", "def create\n @texttocorrect = Texttocorrect.new(texttocorrect_params)\n\n respond_to do |format|\n if @texttocorrect.save\n format.html { redirect_to @texttocorrect, notice: 'Texttocorrect was successfully created.' }\n format.json { render :show, status: :created, location: @texttocorrect }\n else\n format.html { render :new }\n format.json { render json: @texttocorrect.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @card_set = CardSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_set }\n end\n end" ]
[ "0.79074895", "0.70507497", "0.6903067", "0.61349833", "0.60049313", "0.60009766", "0.5960521", "0.58572", "0.5854738", "0.58233094", "0.57233936", "0.56212837", "0.55723643", "0.55496264", "0.5477544", "0.54649806", "0.5435956", "0.5429204", "0.54198223", "0.54026717", "0.538568", "0.5351747", "0.53458637", "0.53409594", "0.533369", "0.53324884", "0.5330696", "0.53032935", "0.5300525", "0.5292588", "0.52907133", "0.5286155", "0.5277201", "0.5275826", "0.52752817", "0.5267801", "0.5264648", "0.52627736", "0.525873", "0.5255501", "0.5254515", "0.5252598", "0.5249282", "0.52479625", "0.52479625", "0.52479625", "0.5246185", "0.5244371", "0.5242534", "0.52342975", "0.5218857", "0.52171636", "0.52105534", "0.5205753", "0.52042633", "0.51974976", "0.51963294", "0.5195536", "0.518385", "0.51831794", "0.5181956", "0.51810354", "0.517929", "0.51779085", "0.5174242", "0.5174091", "0.5173542", "0.5169165", "0.51676404", "0.5163568", "0.5160447", "0.5160447", "0.5160447", "0.5160447", "0.5160447", "0.51555127", "0.5154193", "0.5147318", "0.5144258", "0.5144258", "0.51399964", "0.51379025", "0.513742", "0.5131819", "0.51311624", "0.5126464", "0.512169", "0.5121169", "0.51206905", "0.51202285", "0.51201564", "0.510101", "0.50981975", "0.50978553", "0.50971633", "0.50947326", "0.50901467", "0.5083622", "0.5080461", "0.507605" ]
0.79214334
0
POST /card_font_alignments POST /card_font_alignments.json
def create @card_font_alignment = CardFontAlignment.new(params[:card_font_alignment]) respond_to do |format| if @card_font_alignment.save format.html { redirect_to @card_font_alignment, notice: 'Card font alignment was successfully created.' } format.json { render json: @card_font_alignment, status: :created, location: @card_font_alignment } else format.html { render action: "new" } format.json { render json: @card_font_alignment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @card_font_alignment = CardFontAlignment.find(params[:id])\n\n respond_to do |format|\n if @card_font_alignment.update_attributes(params[:card_font_alignment])\n format.html { redirect_to @card_font_alignment, notice: 'Card font alignment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_font_alignment.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @card_font_alignment = CardFontAlignment.find(params[:id])\n @card_font_alignment.destroy\n\n respond_to do |format|\n format.html { redirect_to card_font_alignments_url }\n format.json { head :no_content }\n end\n end", "def create\n @card_font_family = CardFontFamily.new(params[:card_font_family])\n\n respond_to do |format|\n if @card_font_family.save\n format.html { redirect_to @card_font_family, notice: 'Card font family was successfully created.' }\n format.json { render json: @card_font_family, status: :created, location: @card_font_family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card_font_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.build(font_set_params)\n @font_families = get_font_family_array(@project)\n\n respond_to do |format|\n if @font_set.save\n format.html { redirect_to project_details_url(@project), notice: 'Font set was successfully created.' }\n format.json { render :show, status: :created, location: @font_set }\n else\n format.html { render :new }\n format.json { render json: @font_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @card_font_alignment = CardFontAlignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_font_alignment }\n end\n end", "def font_set_params\n params.require(:font_set).permit(:sass,\n :project_id,\n :name,\n :main_headline,\n :secondary_headline,\n :body,\n :byline,\n :pullquote,\n :blockquote,\n :big_number,\n :big_number_label)\n end", "def show\n @card_font_alignment = CardFontAlignment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_font_alignment }\n end\n end", "def update\n @card_font_family = CardFontFamily.find(params[:id])\n\n respond_to do |format|\n if @card_font_family.update_attributes(params[:card_font_family])\n format.html { redirect_to @card_font_family, notice: 'Card font family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_font_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @card_font_family = CardFontFamily.find(params[:id])\n @card_font_family.destroy\n\n respond_to do |format|\n format.html { redirect_to card_font_families_url }\n format.json { head :no_content }\n end\n end", "def update\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.find(params[:id])\n @font_families = get_font_family_array(@project)\n respond_to do |format|\n if @font_set.update(font_set_params)\n format.html { redirect_to project_details_url(@project), notice: 'Font set was successfully updated.' }\n format.json { render :show, status: :ok, location: @font_set }\n else\n format.html { render :edit }\n format.json { render json: @font_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alignment = Alignment.new(params[:alignment])\n\n respond_to do |format|\n if @alignment.save\n format.html { redirect_to(@alignment, :notice => 'Alignment was successfully created.') }\n format.xml { render :xml => @alignment, :status => :created, :location => @alignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alignment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def serif_params\n params[:serif]\n end", "def new\n @card_font_family = CardFontFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_font_family }\n end\n end", "def load_fonts\n\n # Load fonts.\n self.load_single_font('Across The Road')\n self.load_single_font('Alabama')\n self.load_single_font('Arial')\n self.load_single_font('Arial Narrow')\n self.load_single_font('Arty Signature')\n self.load_single_font('Asem Kandis')\n self.load_single_font('Autograf')\n self.load_single_font('Born Ready')\n self.load_single_font('Brittany Signature')\n self.load_single_font('Bulgatti')\n self.load_single_font('Courier New')\n self.load_single_font('Estelly')\n self.load_single_font('Friday Vibes')\n self.load_single_font('From Skyler')\n self.load_single_font('Gallatone')\n self.load_single_font('Halimun')\n self.load_single_font('Hello Santtiny')\n self.load_single_font('Just Realize')\n self.load_single_font('Just Signature')\n self.load_single_font('Mayestica')\n self.load_single_font('Menlo')\n self.load_single_font('Notera')\n self.load_single_font('Prestige Signature')\n self.load_single_font('Reinata')\n self.load_single_font('Santos Dumont')\n self.load_single_font('SF Mono')\n self.load_single_font('Shopping List')\n self.load_single_font('Signatures')\n self.load_single_font('Signerica')\n self.load_single_font('Silver Pen')\n self.load_single_font('Sophistica')\n self.load_single_font('Source Code Pro')\n self.load_single_font('Southampton')\n self.load_single_font('Thankfully')\n self.load_single_font('The Jacklyn')\n self.load_single_font('Tomatoes')\n self.load_single_font('Wanted Signature')\n self.load_single_font('White Angelica')\n self.load_single_font('Whitney')\n self.load_single_font('Whitney Bold')\n self.load_single_font('Whitney Index Rounded')\n self.load_single_font('Whitney Index Squared')\n self.load_single_font('Xtreem')\n self.load_single_font('Gotham Condensed')\n\n end", "def alignments\n map { |alignment| alignment }\n end", "def create\n @serif = Serif.new(serif_params)\n\n respond_to do |format|\n if @serif.save\n format.html { redirect_to @serif, notice: 'Serif was successfully created.' }\n format.json { render :show, status: :created, location: @serif }\n else\n format.html { render :new }\n format.json { render json: @serif.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_font_set_and_project\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.find(params[:id])\n @font_families = get_font_family_array(@project)\n end", "def add_font(font_filename, mimetype)\n font_filename2 = File.join( @dcpdir, File.basename(font_filename) )\n File.copy(font_filename, font_filename2)\n @packing_list << DCPPKLAsset.create_asset( \n\tfont_filename2,\n\tShellCommands.uuid_gen,\n\tmimetype,\n\tasdcp_digest( font_filename2 ),\n\tFile.size(font_filename2))\n end", "def get_font_latin_attributes(font)\n return [] unless font\n\n attributes = []\n attributes << 'typeface' << font[:_name] if ptrue?(font[:_name])\n attributes << 'pitchFamily' << font[:_pitch_family] if font[:_pitch_family]\n attributes << 'charset' << font[:_charset] if font[:_charset]\n\n attributes\n end", "def create\n @txt = Txt.new(params[:txt])\n\n \n respond_to do |format|\n if @txt.save\n \n # long text parser \n $KCODE='utf8'\n require 'jcode'\n d_str =''\n @txt.longtext.each {|s_str| \n while s_str.jsize > NUM_WORD_PER_LINE\n tmp_str = s_str.scan(/./)[0,NUM_WORD_PER_LINE].join\n d_str += tmp_str + \"\\n\\n\"\n s_str = s_str[tmp_str.size,s_str.size-tmp_str.size]\n if s_str == nil then break end\n #puts s_str.jsize \n end\n if s_str!=nil then d_str += s_str end\n d_str += \"\\n\"\n }\n \n #--- path and name. to be config/updated in new environments\n font_path = 'D:\\\\fonts'\n images_path = \"public/images\"\n output_path = 'public/images/outputs'\n bg_image_path = images_path + \"/\"+ \"background.png\"\n\n require 'find'\n # do the same thing for each available fonts\n Find.find(font_path) do |f|\n img = Magick::Image.read(bg_image_path).first #图片路径\n src_img = Magick::Image.read(images_path+'/user_image.JPG').first # to be replaced with user's picture url\n src_img.crop_resized!(320,320) # 照片的目标尺寸\n src_img.border!(10, 10, \"#f0f0ff\") #相框的颜色,宽度\n frame_img = Magick::Image.read(images_path+'/frame.png').first # picture frame\n frame_img.composite!(src_img, 0, 0, Magick::OverCompositeOp)\n img.composite!(frame_img, 20, 20, Magick::OverCompositeOp)\n \n gc= Magick::Draw.new\n gc.annotate(img, 0, 0, 420, 50, d_str) do #可以设置文字的位置,参数分别为路径、宽度、高度、横坐标、纵坐标\n #self.gravity = Magick::CenterGravity\n self.font = f\n self.pointsize = FONT_SIZE #字体的大小\n self.fill = '#fff' #字体的颜色\n self.stroke = \"none\"\n end \n font_file_name = File.basename(f, 'ttf')\n file_path = output_path + \"/\"+ @txt.image_url + \"_\" + font_file_name + \"png\" \n img.write(file_path) \n end\n \n #@path = file_name\n format.html { redirect_to(@txt, :notice => 'Txt was successfully created.') }\n format.xml { render :xml => @txt, :status => :created, :location => @txt }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @txt.errors, :status => :unprocessable_entity }\n end\n end\n end", "def convert_font_args(params)\n return unless params\n font = {\n :_name => params[:name],\n :_color => params[:color],\n :_size => params[:size],\n :_bold => params[:bold],\n :_italic => params[:italic],\n :_underline => params[:underline],\n :_pitch_family => params[:pitch_family],\n :_charset => params[:charset],\n :_baseline => params[:baseline] || 0\n }\n\n # Convert font size units.\n font[:_size] *= 100 if font[:_size] && font[:_size] != 0\n\n font\n end", "def align\n @genome = Genome.find(params[:id])\n @proteins = Protein.all\n @method = params[:method]\n\n if params[:method] == 'local'\n @message = 'Local alignment'\n align_all_local\n elsif params[:method] == 'global'\n @message = 'Global alignment'\n align_all_global\n end\n\n end", "def set_font\n font_families.update(\n 'HealthQuestPDF' => {\n normal: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-regular-webfont.ttf'),\n medium: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-bold-webfont.ttf'),\n bold: HealthQuest::Engine.root.join('lib', 'fonts', 'bitter-bold.ttf')\n }\n )\n font 'HealthQuestPDF'\n end", "def insert_text_format\n attributes.fetch(:insertTextFormat)\n end", "def convert_fonts\n out = \"\"\n sass.each_line do |line|\n line.gsub!(/(\\s*)(word-spacing|letter-spacing|font-size|line-height|margin-[^\\s]+|margin|padding-[\\s]+|padding)\\s*:(.*)/) do |m|\n # indent rule: value\n m = \"#{$1}#{$2}: #{CSS.val_to_em($3)}\"\n end\n out << line\n end\n self.sass = out\n end", "def create\n @text_size = TextSize.new(params[:text_size])\n\n respond_to do |format|\n if @text_size.save\n format.html { redirect_to @text_size, notice: 'Text size was successfully created.' }\n format.json { render json: @text_size, status: :created, location: @text_size }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text_size.errors, status: :unprocessable_entity }\n end\n end\n end", "def to_pdf requester, user, questionnaire, url_prefix, short_version=false\n font_families.update(\n \"DejaVuSans\" => { # Using DejaVuSans because it provides the 'filled_check_box' and the 'check_box' icons.\n :bold => \"#{Rails.root}/public/data/fonts/DejaVuSans-Bold.ttf\",\n :bold_italic => \"#{Rails.root}/public/data/fonts/DejaVuSans-BoldOblique.ttf\",\n :italic => \"#{Rails.root}/public/data/fonts/DejaVuSans-Oblique.ttf\",\n :normal => \"#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf\"\n }\n )\n font \"DejaVuSans\"\n self.font_size = 9\n\n #check_box = \"\\xE2\\x98\\x90\"\n #filled_check_box = \"\\xE2\\x98\\x91\"\n\n ap = ApplicationProfile.first\n current_instance = (ap && ap.sub_title) || Rails.root.to_s.split('/')[3].split('-').first\n ap_logo = ap && ap.logo && ap.logo.path\n fallback_logo = Dir.glob(\"public/assets/logos/#{current_instance.split('-').first}*\", File::FNM_CASEFOLD).first\n logo = ap_logo || \"#{Rails.root}/#{fallback_logo}\"\n image logo, position: :right, width: 150 if logo\n text \"#{current_instance.upcase}\", size: 14, style: :bold\n\n move_down 10\n\n banner = questionnaire.header.path\n if banner.present? && File.exist?(banner)\n image banner, :position => :left, :width => 550\n end\n\n move_down 20\n\n authorization = AuthorizedSubmitter.find_by_questionnaire_id_and_user_id(questionnaire.id, user.id)\n I18n.locale = authorization.language\n questionnaire_field = ( questionnaire.questionnaire_fields.find_by_language(authorization.language) || questionnaire.questionnaire_fields.find_by_is_default_language(true) )\n text \"#{questionnaire_field.title.html_safe}\", :size => 16, :style => :bold\n #text \"Language: #{questionnaire.language_english_name}\"\n\n move_down 18\n\n text \"#{OrtSanitize.white_space_cleanse(questionnaire_field.introductory_remarks).gsub(\"\\n\", \"\\n\\n\")}\", :inline_format => true\n\n start_new_page\n\n fields = {}\n\n puts \"#{Time.now} - Started generating #{short_version ? \"short\" : \"\"} PDF for - #{questionnaire_field.title} - for #{user.full_name}\"\n logger.info \"#{Time.now} - Started generating #{short_version ? \"short\" : \"\"} PDF for - #{questionnaire_field.title} - for #{user.full_name}\"\n\n begin\n sections = questionnaire.sections\n sections.each_with_index do |section, i|\n fields.clear\n section.objects_fields_in authorization.language, fields\n answers = section.section_and_descendants_answers_for(user).select{ |ans| ans.filled_answer? }\n root_section_to_pdf(authorization.language, section, user, fields, answers, url_prefix, short_version)\n\n # new page for every new root section (if we're doing a short_version pdf only add the new page if the answers aren't empty)\n # the last check on the if is related with checking if there is any content for the next page\n if i < sections.size-1 && (!short_version || !answers.empty?) && page.content.stream !=\"/DeviceRGB cs\\n0.000 0.000 0.000 scn\\n/DeviceRGB CS\\n0.000 0.000 0.000 SCN\\nq\\n\" && cursor != 720.0\n # puts \"the cursor is here #{cursor}\"\n start_new_page\n end\n end\n\n #footer [ margin_box.left, margin_box.bottom + 25 ] do\n repeat(:all, :dynamic => true) do\n draw_text \"#{questionnaire_field.title} [#{user.full_name}, #{user.country}]\", :size => 7, :at => [0, -15]\n draw_text \"Page #{page_number} of #{page_count}\", :size => 8, :at => [500, (questionnaire.title.size > 50 ? -6 : -15)]\n end\n\n pdf_file = questionnaire.pdf_files.find_by_user_id_and_is_long(user.id, !short_version) || PdfFile.new(:questionnaire => questionnaire, :user => user, :is_long => !short_version)\n if !pdf_file.new_record? && File.exist?(pdf_file.location)\n FileUtils.rm(pdf_file.location)\n end\n\n sanitized_title = questionnaire.title[0,35].strip.\n gsub!(/[^0-9A-Za-z.\\-]/, '_')\n\n pdf_file.name = \"#{sanitized_title}_#{short_version ? \"short\" : \"long\"}_#{DateTime.now.strftime(\"%d%m%Y\")}.pdf\"\n location_rel = \"private/questionnaires/#{questionnaire.id}/users/#{user.id}/\"\n location_abs = \"#{Rails.root}/#{location_rel}\"\n if !File.directory? location_abs\n FileUtils.mkdir_p(location_abs)\n end\n pdf_file.location = location_rel + pdf_file.name\n pdf_file.save\n render_file pdf_file.location\n\n if File.directory?(\"#{Rails.root}/private/questionnaires/#{questionnaire.id}/users/#{user.id}/generating_#{short_version ? \"short\" : \"long\"}_pdf\")\n FileUtils.rmdir(\"#{Rails.root}/private/questionnaires/#{questionnaire.id}/users/#{user.id}/generating_#{short_version ? \"short\" : \"long\"}_pdf\")\n end\n\n puts \"#{Time.now.to_s} - PDF Successfully generated - #{questionnaire_field.title} - for #{user.full_name}\"\n logger.info \"#{Time.now.to_s} - PDF Successfully generated - #{questionnaire_field.title} - for #{user.full_name}\"\n\n rescue => e\n UserMailer.pdf_generation_failed(requester, user, questionnaire, e.message).deliver\n\n logger.info \"#{Time.now.to_s} - PDF failed to generate - #{questionnaire_field.title} - for #{user.full_name} - with error: #{e.message}\"\n logger.info e.backtrace\n\n if File.directory?(\"#{Rails.root}/private/questionnaires/#{questionnaire.id}/users/#{user.id}/generating_#{short_version ? \"short\" : \"long\"}_pdf\")\n FileUtils.rmdir(\"#{Rails.root}/private/questionnaires/#{questionnaire.id}/users/#{user.id}/generating_#{short_version ? \"short\" : \"long\"}_pdf\")\n end\n\n return\n end\n\n # mail the requester about the pdf being generated. (can be the user or an admin)\n UserMailer.pdf_generated(requester, questionnaire, user).deliver\n end", "def fonts(workbook, _center, heading, _colors)\n worksheet = workbook.add_worksheet('Fonts')\n\n worksheet.set_column(0, 0, 30)\n worksheet.set_column(1, 1, 10)\n\n worksheet.write(0, 0, \"Font name\", heading)\n worksheet.write(0, 1, \"Font size\", heading)\n\n fonts = []\n fonts << [10, 'Arial']\n fonts << [12, 'Arial']\n fonts << [14, 'Arial']\n fonts << [12, 'Arial Black']\n fonts << [12, 'Arial Narrow']\n fonts << [12, 'Century Schoolbook']\n fonts << [12, 'Courier']\n fonts << [12, 'Courier New']\n fonts << [12, 'Garamond']\n fonts << [12, 'Impact']\n fonts << [12, 'Lucida Handwriting']\n fonts << [12, 'Times New Roman']\n fonts << [12, 'Symbol']\n fonts << [12, 'Wingdings']\n fonts << [12, 'A font that doesn\\'t exist']\n\n i = 0\n fonts.each do |font|\n format = workbook.add_format\n\n format.set_size(font[0])\n format.set_font(font[1])\n\n i += 1\n worksheet.write(i, 0, font[1], format)\n worksheet.write(i, 1, font[0], format)\n end\n end", "def add_font_family(pdf:, name:, root:)\n if root == 'OldStandard'\n # No Bold-Italic variant in OldStandard\n bold_italic_name = \"#{root}-Bold.ttf\"\n else\n bold_italic_name = \"#{root}-BoldItalic.ttf\"\n end\n\n pdf.font_families.update(\n name => {\n normal: Rails.root.join('vendor', 'fonts', root,\n \"#{root}-Regular.ttf\").to_s,\n italic: Rails.root.join('vendor', 'fonts', root,\n \"#{root}-Italic.ttf\").to_s,\n bold: Rails.root.join('vendor', 'fonts', root,\n \"#{root}-Bold.ttf\").to_s,\n bold_italic: Rails.root.join('vendor', 'fonts', root,\n bold_italic_name).to_s\n }\n )\n end", "def set_fonts\n font_families.update(\"Arial\" => {\n :normal => \"#{Rails.root}/vendor/assets/fonts/Arial.ttf\",\n :bold => \"#{Rails.root}/vendor/assets/fonts/Arial-Bold.ttf\"\n })\n font \"Arial\"\n end", "def process_alignment\n # init vars\n @names = []\n @seqs = []\n \n @alignment = \"-B #{@basename}.aln\"\n\n # import alignment file\n @content = IO.readlines(@infile).map {|line| line.chomp}\n \n #check alignment for gap-only columns\n remove_inserts\n \n #write query-file\n File.open(@infile, \"w\") do |file|\n file.write(\">#{@names[0]}\\n\")\n file.write(\"#{@seqs[0]}\\n\")\n end\n \n #write aln-file\n File.open(@basename + \".aln\", \"w\") do |file|\n @names.each_index do |num|\n file.write(\"Sequence#{num} \")\n file.write(\" \") if (num < 10)\n file.write(\" \") if (num < 100)\n file.write(\"#{@seqs[num]}\\n\")\n end\n end\n end", "def alignment\n fetch('dnd.alignments')\n end", "def set_font_sizes(font_sizes:)\n {\n method: \"Page.setFontSizes\",\n params: { fontSizes: font_sizes }.compact\n }\n end", "def create\n @serif = nil\n case params[:serif][:type]\n when \"ReplySerif\"\n @serif = ReplySerif.new(permitted_params)\n when \"PopularSerif\"\n @serif = PopularSerif.new(permitted_params)\n when \"NewSerif\"\n @serif = NewSerif.new(permitted_params)\n end\n\n respond_to do |format|\n if @serif.save\n format.html { redirect_to action: \"edit\", id: @serif.id, notice: 'Serif was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def prepare_fonts # :nodoc:\n fonts = {}\n\n @xf_formats.each { |format| format.set_font_info(fonts) }\n\n @font_count = fonts.size\n\n # For the DXF formats we only need to check if the properties have changed.\n @dxf_formats.each do |format|\n # The only font properties that can change for a DXF format are: color,\n # bold, italic, underline and strikethrough.\n format.has_dxf_font(true) if format.color? || format.bold? || format.italic? || format.underline? || format.strikeout?\n end\n end", "def get_font_style_attributes(font)\n return [] unless font\n\n attributes = []\n attributes << 'sz' << font[:_size] if ptrue?(font[:_size])\n attributes << 'b' << font[:_bold] if font[:_bold]\n attributes << 'i' << font[:_italic] if font[:_italic]\n attributes << 'u' << 'sng' if font[:_underline]\n\n attributes << 'baseline' << font[:_baseline]\n attributes\n end", "def set_serif\n @serif = Serif.find(params[:id])\n end", "def call\n if words.size < 3\n color_size = 3\n elsif words.size > 9\n color_size = 9\n else\n color_size = words.size\n end\n\n # This will raise an exception if you pass a color ramp that doesn't\n # exist in ColorBrewer.\n colors = ColorBrewer::SEQUENTIAL_COLOR_SCHEMES[color_size].fetch(color)\n\n # Write out to PDF and return the PDF\n pdf_with_header(header: header) do |pdf|\n # Get the path to the font file itself. Again, it'll raise if you\n # pass a bad font.\n font_path = pdf.font_families.fetch(font)[:normal]\n\n # Get our point sizes for each word\n range = (words.values.min..words.values.max)\n words_to_points = words.each_with_object({}) do |(word, freq), ret|\n ret[word] = point_size_for(frequency_range: range,\n frequency: freq)\n end\n\n # Build the canvas and place the words\n canvas = Canvas.new(words: words_to_points, font_path: font_path)\n positions = words_to_points.each_with_object({}) do |(word, size), ret|\n ret[word] = [canvas.place_word(word: word, size: size), size]\n end\n\n pdf.font(font)\n\n # Compute how much space we have and how we should scale from our\n # canvas to the PDF\n space_x = pdf.bounds.width\n space_y = pdf.bounds.height - 18 - 20\n\n scale_x = space_x / canvas.width\n scale_y = space_y / canvas.height\n scale = [scale_x, scale_y].min\n\n # Center the block of text. Which of these dimensions is larger is\n # stochastic, so don't care about test coverage\n x_offset = y_offset = 0\n # :nocov:\n if scale == scale_x\n y_offset = (space_y - scale * canvas.height) / 2\n else\n x_offset = (space_x - scale * canvas.width) / 2\n end\n # :nocov:\n\n # Draw all the words, stroked in the darkest color from the color\n # scheme\n pdf.stroke_color(colors.last[1, 6])\n pdf.line_width(0.25)\n\n positions.each_with_index do |(word, (pos, size)), i|\n pdf.fill_color(colors[i % colors.size][1, 6])\n pdf.text_rendering_mode(:fill_stroke) do\n pdf.draw_text(word, size: size * scale,\n at: [pos[0] * scale + x_offset,\n pos[1] * scale + y_offset])\n end\n end\n end\n end", "def keyframe_font_sizes(scroll_offset = 0)\n data = { }\n\n initial_pos = calculate_scroll_position(:initial, scroll_offset)\n target_start_pos = calculate_scroll_position(:target_start, scroll_offset)\n target_end_pos = calculate_scroll_position(:target_end, scroll_offset)\n final_pos = calculate_scroll_position(:final, scroll_offset)\n\n data[\"data-#{initial_pos}\"] = \" font-size: #{ @layer.font_size * @layer.start_state_keyframe.scale }em;\"\n data[\"data-#{target_start_pos}\"] = \" font-size: #{ @layer.font_size * @layer.target_state_keyframe.scale }em;\"\n data[\"data-#{target_end_pos}\"] = \" font-size: #{ @layer.font_size * @layer.target_state_keyframe.scale }em;\"\n data[\"data-#{final_pos}\"] = \" font-size: #{ @layer.font_size * @layer.end_state_keyframe.scale }em;\"\n\n data\n end", "def text_align(alignment)\n Kernel.raise ArgumentError, \"Unknown alignment constant: #{alignment}\" unless ALIGN_TYPE_NAMES.key?(alignment.to_i)\n primitive \"text-align #{ALIGN_TYPE_NAMES[alignment.to_i]}\"\n end", "def create\n @card = Card.new(card_params)\n mm = 3.543307\n forms = params.require(:card).permit(:name, :kana_name, :department, :postalcode, :address_prefectural, :address_city, :address_street, :address_building, :tel, :email, :course, :laboratory, :free_text, :card_template, :paper_template)\n\n paper_template = PaperTemplate.find(forms[:paper_template])\n paper = File.read(\"app/assets/images/paper/\" + paper_template.path)\n\n card_template = CardTemplate.find(forms[:card_template])\n svg = REXML::Document.new(open(\"app/assets/images/card/\" + card_template.path))\n\n # jikanganai\n svg.root.elements[\"//*[@id='text_name']\"].text = forms[:name]\n\n if card_template.department\n if forms[:department].present?\n svg.root.elements[\"//*[@id='text_department']\"].text = School.find(Department.find(forms[:department]).school).name + Department.find(forms[:department]).name\n else \n svg.root.elements[\"//*[@id='text_department']\"].text = \"\"\n end\n end\n\n if card_template.course and forms[:course]\n if forms[:course].present?\n svg.root.elements[\"//*[@id='text_course']\"].text = Course.find(forms[:course]).name\n else\n svg.root.elements[\"//*[@id='text_course']\"].text = \"\"\n end\n end\n\n \n if card_template.laboratory and forms[:laboratory]\n if forms[:laboratory].present?\n svg.root.elements[\"//*[@id='text_lab']\"].text = Laboratory.find(forms[:laboratory]).name\n else\n svg.root.elements[\"//*[@id='text_lab']\"].text = \"\"\n end\n end\n\n if card_template.tel\n if forms[:tel].present?\n svg.root.elements[\"//*[@id='text_tel']\"].text = forms[:tel]\n else\n svg.root.elements[\"//*[@id='text_tel']\"].text = \"\"\n end\n end\n\n if card_template.email\n if forms[:email].present?\n svg.root.elements[\"//*[@id='text_email']\"].text = forms[:email]\n else\n svg.root.elements[\"//*[@id='text_email']\"].text = \"\"\n end\n end\n\n if card_template.free\n if forms[:free_text].present?\n svg.root.elements[\"//*[@id='text_free']\"].text = forms[:free_text]\n else\n svg.root.elements[\"//*[@id='text_free']\"].text = \"\"\n end\n end\n\n if card_template.address_city\n if forms[:address_city].present?\n svg.root.elements[\"//*[@id='text_address']\"].text = Prefectural.find(forms[:address_prefectural]).name + forms[:address_city] + forms[:address_street] + forms[:address_building]\n else\n svg.root.elements[\"//*[@id='text_address']\"].text = \"\"\n end\n end\n\n card_text = \"\"\n xMargin = paper_template.margin_x * mm\n yMargin = paper_template.margin_y * mm\n xSize = card_template.size_x * mm\n ySize = card_template.size_y * mm\n debug = \"\"\n for xNum in 0..(paper_template.cols - 1) do\n for yNum in 0..(paper_template.rows - 1) do\n x = xMargin + xSize * xNum\n y = yMargin + ySize * yNum\n svgText = svg.root.to_s\n \n svgText.gsub!(/<svg[^>]+>/, '')\n svgText.gsub!(/<\\/svg>/, '')\n svgText.gsub!(/id='([^']+)'/) { \"id='\" + $1 + xNum.to_s + \"_\" + yNum.to_s + \"'\" }\n svgText.gsub!(/x='([0-9.]+)'/) { \"x='\" + ($1.to_f + x).to_s + \"'\" }\n svgText.gsub!(/y='([0-9.]+)'/) { \"y='\" + ($1.to_f + y).to_s + \"'\" }\n svgText.gsub!(/d='m ([0-9.]+),([0-9.]+)/) { \"d='m #{($1.to_f + x).to_s},#{($2.to_f + y).to_s}\" }\n\n paper.gsub!(/<g \\/>/, svgText + \"<g />\")\n end\n end\n paper.gsub!(/\"/, \"'\")\n\n filename = SecureRandom.hex\n svgFile = File.open(\"tmp/#{filename}.svg\", 'w')\n svgFile.puts paper\n pdf = `cat tmp/#{filename}.svg | cairosvg -` \n svgFile.close\n File.unlink(\"tmp/#{filename}.svg\")\n\n #pdf = `echo \"#{paper}\" | cairosvg -`\n send_data pdf, filename: \"card.pdf\", type: \"application/pdf\", disposition: \"inline\"\n \n end", "def add_text! (text, xoff, yoff, width, height, font, size, html_color, align=:left)\n color = Color::RGB.from_html(html_color)\n cmd = (align == :center) ? \"ZC\" : \"ZA\"\n parts = [URI.escape(text), xoff, yoff, width, height, font, size].map {|x| x.to_s} +\n [color.r, color.g, color.b].map {|c| (c*255).to_i }\n cmd << parts.join(\",\")\n @transforms << cmd\n self\n end", "def process_text_options(options)\n if options[:style]\n raise 'Bad font family' unless font.family\n font(font.family, style: options[:style])\n end\n\n # must compare against false to keep kerning on as default\n unless options[:kerning] == false\n options[:kerning] = font.has_kerning_data?\n end\n\n options[:size] ||= font_size\n end", "def font_setup\n font_families.update(\"Montserrat\" => {\n :normal => \"vendor/assets/fonts/Montserrat/Montserrat-Regular.ttf\",\n :italic => \"vendor/assets/fonts/Montserrat/Montserrat-Italic.ttf\",\n :bold => \"vendor/assets/fonts/Montserrat/Montserrat-Bold.ttf\",\n })\n font \"Montserrat\"\n end", "def align=(align)\n set_align(align)\n generate_buffers\n end", "def create\n @statement = Statement.new(statement_params)\n @test = @statement.test.id\n\n path_to_file = \"#{Rails.root}/app/assets/images/cert#{@statement.id}.pdf\"\n\n pdf = CombinePDF.load \"#{@statement.test.certificate.path}\" \n\n if !pdf.pages.empty?\n\n #a = \"Привет\".encode(\"UTF-8\")\n\n # create a textbox and add it to the existing pdf on page 2 #{@statement.fio} #{@statement.position} \n pdf.pages[0].textbox @statement.position, height: 60, width: 450, y: 400, x: 82, :font => :time_new_roman, font_color: [0, 0.2, 0.26274509803], max_font_size: 16\n pdf.pages[0].textbox @statement.place, height: 60, width: 450, y: 380, x: 82, :font => :time_new_roman, font_color: [0, 0.2, 0.26274509803], max_font_size: 16\n #Суспеснкого районе г . Казани ниже\n pdf.pages[0].textbox @statement.phone, height: 60, width: 450, y: 360, x: 82, :font => :time_new_roman, font_color: [0, 0.2, 0.26274509803], max_font_size: 16\n pdf.pages[0].textbox @statement.name, height: 60, width: 450, y: 320, x: 82, :font => :time_new_roman, font_color: [0, 0.2, 0.26274509803], max_font_size: 35\n pdf.pages[0].textbox @statement.fio, height: 60, width: 450, y: 280, x: 82, :font => :time_new_roman, font_color: [0, 0.2, 0.26274509803], max_font_size: 35\n # output the new pdf which now contains your dynamic data\n pdf.save path_to_file\n File.open(path_to_file) do |f|\n @statement.certificate = f\n end\n File.delete(path_to_file) if File.exist?(path_to_file)\n end\n\n respond_to do |format|\n if @statement.save\n format.html { redirect_to root_path, notice: 'Statement was successfully created.' }\n else\n format.html { render :new}\n format.json { render json: @statement.errors, status: :unprocessable_entity }\n end\n end\n end", "def align(align=nil)\n @options[:align] = align unless align.nil?\n @options[:align]\n end", "def textalignment=(textAlignment)\n @elementHash[:textalignment] = textAlignment\n end", "def update!(**args)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_name = args[:font_name] if args.key?(:font_name)\n end", "def show\n @card_font_family = CardFontFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_font_family }\n end\n end", "def load_single_font(name)\n \n # Determine path to font file.\n font_file_name = name.gsub(/\\s+/, \"\")\n path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}.ttf\")\n return unless File.file?(path)\n\n # Determine variants.\n italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Italic.ttf\")\n bold_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Bold.ttf\")\n bold_italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-BoldItalic.ttf\")\n\n # Build hash of variants.\n font_hash = { normal: path }\n font_hash[:italic] = italics_path if File.file?(italics_path)\n font_hash[:bold] = bold_path if File.file?(bold_path)\n font_hash[:bold_italic] = bold_italics_path if File.file?(bold_italics_path)\n\n # Add font.\n self.font_families.update(name => font_hash)\n\n end", "def set_data_font(data_type)\n @maqj_default_font = contents.font.dup unless @maqj_default_font\n contents.font.name = QuestData::FONTNAMES[data_type] ? \n QuestData::FONTNAMES[data_type] : @maqj_default_font.name\n contents.font.size = QuestData::FONTSIZES[data_type] ? \n QuestData::FONTSIZES[data_type] : @maqj_default_font.size\n contents.font.bold = QuestData::FONTBOLDS.keys.include?(data_type) ? \n QuestData::FONTBOLDS[data_type] : @maqj_default_font.bold\n contents.font.italic = QuestData::FONTITALICS.keys.include?(data_type) ?\n QuestData::FONTITALICS[data_type] : @maqj_default_font.italic\n case data_type\n when :objectives then change_color(@maqj_objective_color) if @maqj_objective_color\n when :name then change_color(quest_name_colour(@quest)) if @quest\n else\n change_color(text_color(QuestData::COLOURS[data_type])) if QuestData::COLOURS.keys.include?(data_type)\n end\n end", "def create\n @fonte_de_recurso = FonteDeRecurso.new(fonte_de_recurso_params)\n\n respond_to do |format|\n if @fonte_de_recurso.save\n addlog(\"Fonte e recurso criada\")\n format.html { redirect_to @fonte_de_recurso, notice: 'Fonte de recurso criado com sucesso.' }\n format.json { render :show, status: :created, location: @fonte_de_recurso }\n else\n format.html { render :new }\n format.json { render json: @fonte_de_recurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end", "def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end", "def create\n @texttocorrect = Texttocorrect.new(texttocorrect_params)\n\n respond_to do |format|\n if @texttocorrect.save\n format.html { redirect_to @texttocorrect, notice: 'Texttocorrect was successfully created.' }\n format.json { render :show, status: :created, location: @texttocorrect }\n else\n format.html { render :new }\n format.json { render json: @texttocorrect.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize_fonts(application)\r\n\t[12, 14, 16, 18, 24].each() do |size|\r\n\t\tFONT[\"Courier #{size}\"] = FXFont.new(application, 'Courier New', size)\r\n\t\tFONT[\"Helvetica #{size}\"] = FXFont.new(application, 'Helvetica', size)\r\n\tend\r\n\t\r\n\tFONT['Courier 24 bold'] = FXFont.new(application, 'Courier New', 24, FXFont::Bold)\r\nend", "def load_single_font(name)\n\n # Determine path to font file.\n font_file_name = name.gsub(/\\s+/, \"\")\n path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}.ttf\")\n return unless File.file?(path)\n\n # Determine variants.\n italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Italic.ttf\")\n bold_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Bold.ttf\")\n bold_italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-BoldItalic.ttf\")\n\n # Build hash of variants.\n font_hash = { normal: path }\n font_hash[:italic] = italics_path if File.file?(italics_path)\n font_hash[:bold] = bold_path if File.file?(bold_path)\n font_hash[:bold_italic] = bold_italics_path if File.file?(bold_italics_path)\n\n # Add font.\n self.font_families.update(name => font_hash)\n\n end", "def update\n respond_to do |format|\n if @serif.update(serif_params)\n format.html { redirect_to @serif, notice: 'Serif was successfully updated.' }\n format.json { render :show, status: :ok, location: @serif }\n else\n format.html { render :edit }\n format.json { render json: @serif.errors, status: :unprocessable_entity }\n end\n end\n end", "def skills(skills)\n @pdf.table skills do\n cells.borders = []\n cells.padding = 2\n rows(0..skills.size).columns(0).padding_right = 60\n end\n @pdf.text \"\\n\"\n end", "def init_font_families\n # Set the known family groups. These font families will be used to\n # enable bold and italic markers to be included within text\n # streams. HTML forms will be used... <b></b> <i></i>\n @font_families[\"Helvetica\"] =\n {\n \"b\" => 'Helvetica-Bold',\n \"i\" => 'Helvetica-Oblique',\n \"bi\" => 'Helvetica-BoldOblique',\n \"ib\" => 'Helvetica-BoldOblique'\n }\n @font_families['Courier'] =\n {\n \"b\" => 'Courier-Bold',\n \"i\" => 'Courier-Oblique',\n \"bi\" => 'Courier-BoldOblique',\n \"ib\" => 'Courier-BoldOblique'\n }\n @font_families['Times-Roman'] =\n {\n \"b\" => 'Times-Bold',\n \"i\" => 'Times-Italic',\n \"bi\" => 'Times-BoldItalic',\n \"ib\" => 'Times-BoldItalic'\n }\n end", "def register_font_from_pdf_object(font_name, font_object)\n # FIXME:\n # - add stream deflation for the CMap file.\n # - add :Encoding CMaps (such as :WinAnsiEncoding etc`)\n # - the ToUnicode CMap parsing assumes 8 Bytes <0F0F> while 16 Bytes and multiple unicode chars are also possible.\n\n # first, create cmap, as it will be used to correctly create the widths directory.\n\n # find the CMap from one of the two systems (TrueType vs. Type0 fonts)\n # at the moment doen't suppot :Encoding cmaps...\n cmap = {}\n if font_object[:ToUnicode]\n to_unicode = font_object[:ToUnicode]\n to_unicode = to_unicode[:referenced_object] if to_unicode[:is_reference_only]\n # deflate the cmap file stream before parsing\n to_unicode = create_deep_copy to_unicode\n CombinePDF::PDFFilter.inflate_object to_unicode\n # parse the deflated stream\n cmap = parse_cmap to_unicode[:raw_stream_content]\n else\n warn \"didn't find ToUnicode object for #{font_object}\"\n return false\n end\n\n # second, create the metrics directory.\n metrics = {}\n old_widths = font_object\n if font_object[:DescendantFonts]\n old_widths = font_object[:DescendantFonts]\n old_widths = old_widths[:referenced_object][:indirect_without_dictionary] if old_widths.is_a?(Hash) && old_widths[:is_reference_only]\n old_widths = old_widths[0][:referenced_object]\n avrg_height = 360\n avrg_height = old_widths[:XHeight] if old_widths[:XHeight]\n avrg_height = (avrg_height + old_widths[:CapHeight]) / 2 if old_widths[:CapHeight]\n avrg_width = old_widths[:AvgWidth] || 0\n avarage_bbox = [0, 0, avrg_width, avrg_height] # data is missing for full box metrics, just ignore\n end\n\n # compute the metrics values using the appropiate system (TrueType vs. Type0 fonts)\n cmap_inverted = {}\n cmap.each { |k, v| cmap_inverted[v.hex] = k }\n if old_widths[:W]\n old_widths = old_widths[:W]\n if old_widths.is_a?(Hash) && old_widths[:is_reference_only]\n old_widths = old_widths[:referenced_object][:indirect_without_dictionary]\n end\n old_widths = create_deep_copy old_widths\n while old_widths[0]\n a = old_widths.shift\n b = old_widths.shift\n if b.is_a?(Array)\n b.each_index { |i| metrics[cmap_inverted[(a + i)] || (a + i)] = { wx: b[i], boundingbox: avarage_bbox } }\n else\n c = old_widths.shift\n (b - a).times { |i| metrics[cmap_inverted[(a + i)] || (a + i)] = { wx: c[0], boundingbox: avarage_bbox } }\n end\n\n end\n elsif old_widths[:Widths]\n first_char = old_widths[:FirstChar]\n old_widths = old_widths[:Widths]\n if old_widths.is_a?(Hash) && old_widths[:is_reference_only]\n old_widths = old_widths[:referenced_object][:indirect_without_dictionary]\n end\n old_widths.each_index { |i| metrics[cmap_inverted[(i + first_char)] || (i + first_char)] = { wx: old_widths[i], boundingbox: avarage_bbox } }\n else\n warn \"didn't find widths object for #{old_widths}\"\n return false\n end\n # register the font and return the font object\n cmap = nil if cmap.empty?\n CombinePDF::Fonts.register_font font_name, metrics, font_object, cmap\n end", "def create\n @folha_fonte_recurso = Folha::FonteRecurso.new(params[:folha_fonte_recurso])\n\n respond_to do |format|\n if @folha_fonte_recurso.save\n format.html { redirect_to(@folha_fonte_recurso, :notice => 'Fonte recurso cadastrado com sucesso.') }\n format.xml { render :xml => @folha_fonte_recurso, :status => :created, :location => @folha_fonte_recurso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @folha_fonte_recurso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @player = Player.new(player_params)\n @player.hit_points = @player.dnd_class.hit_die\n @player.user_id = current_user.id\n #if true == false\n #puts @player.alignment_id\n if player_params[:gender] == '1'\n @player.gender = \"Feminino\"\n else\n @player.gender = \"Masculino\"\n end\n\n if player_params[:alignment_id].eql? 'Leal e Bom'\n @player.alignment_id = 1\n elsif player_params[:alignment_id].eql? 'Leal e Neutro'\n @player.alignment_id = 2\n elsif player_params[:alignment_id].eql? 'Leal e Mau'\n @player.alignment_id = 3\n elsif player_params[:alignment_id].eql? 'Neutro e Bom'\n @player.alignment_id = 4\n elsif player_params[:alignment_id].eql? 'Neutro Puro'\n @player.alignment_id = 5\n elsif player_params[:alignment_id].eql? 'Neutro e Mau'\n @player.alignment_id = 6\n elsif player_params[:alignment_id].eql? 'Caótico e Bom'\n @player.alignment_id = 7\n elsif player_params[:alignment_id].eql? 'Caótico e Neutro'\n @player.alignment_id = 8\n elsif player_params[:alignment_id].eql? 'Caótico e Mau'\n @player.alignment_id = 9\n end\n #end\n \n respond_to do |format|\n if @player.save\n if user_signed_in?\n if params[:commit] == t('sheet.Add_Skills')\n format.html {redirect_to edit_player_path(@player)}\n else\n format.html { redirect_to user_chars_path }#, notice: 'Player was successfully created.' }\n end\n elsif master_signer_in?\n format.html { redirect_to dm_char_maker_path } #, notice: 'Player was successfully created.' }\n end\n format.json { render :show, status: :created, location: @player }\n else\n \n \n if user_signed_in?\n format.html { redirect_to user_new_player_path }#, notice: 'Player was successfully created.' }\n else\n format.html { render :new }\n end\n format.json { render json: @player.errors, status: :unprocessable_entity }\n end\n end\n end", "def ajouterTexte(font,texte,couleur,position)\r\n\t\ttexte = GLib.convert(texte, \"ISO-8859-15\", \"UTF-8\") #Conversion de l'UTF8 vers ISO-8859-15\r\n\t\tposition = @justification[position]\r\n\t\t\r\n\t\tr = couleur.red.to_i / 256\r\n\t\tv = couleur.green.to_i / 256\r\n\t\tb = couleur.blue.to_i / 256\r\n\t\t\r\n\t\tvaleur = ((b * 256) + v) * 256 + r\t\r\n\t\t\r\n\t\t\r\n\t\tf = font.split()\r\n\t\t\r\n\t\ttaille = f.pop().to_i\r\n\t\tstylePolice = f.pop() if f.include?(\"Bold\") || f.include?(\"Italic\") || f.include?(\"Bold Italic\")\r\n\t\tpolice = f.join(\" \")\r\n\t\t\r\n\t\ttailleDefaut = taille\r\n\t\t\r\n\t\ttab = []\r\n\t\t\r\n\t\tr = %r{(<big>.*</big>)|(<small>.*</small>)|(<span size=.*>.*</span>)}\r\n\t\ttexte.split(r).each do |c|\r\n\t\t\tif %r{<big>(.*)</big>}.match(c)\r\n\t\t\t\ttexte = $1\r\n\t\t\t\ttaille = tailleDefaut + 2\r\n\t\t\telsif %r{<small>(.*)</small>}.match(c)\r\n\t\t\t\ttexte = $1\r\n\t\t\t\ttaille = tailleDefaut - 2\r\n\t\t\telsif %r{<span size=\\\"(x{1,2})-large\\\">(.*)</span>}.match(c)\r\n\t\t\t\tcase $1\r\n\t\t\t\t\twhen \"x\"\r\n\t\t\t\t\t\ttaille = 22\r\n\t\t\t\t\twhen \"xx\"\r\n\t\t\t\t\t\ttaille = 26\r\n\t\t\t\tend\r\n\t\t\t\ttexte = $2\r\n\t\t\telse\r\n\t\t\t\ttaille = tailleDefaut\r\n\t\t\t\ttexte = c\r\n\t\t\tend\r\n\t\t\ttab << [texte,taille]\r\n\t\tend\r\n\t\r\n\t\tre = %r{(<u>.*</u>)|(<b>.*</b>)|(<i>.*</i>)|(<s>.*</s>)}\r\n\t\ttab.each do |t|\r\n\t\t\tt[0].split(re).each do |d|\r\n\t\t\t\tif %r{<u>(.*)</u>}.match(d)\r\n\t\t\t\t\ts = $1\r\n\t\t\t\t\[email protected] = true\r\n\t\t\t\telsif %r{<b>(.*)</b>}.match(d)\r\n\t\t\t\t\ts = $1\r\n\t\t\t\t\[email protected] = true\r\n\t\t\t\telsif %r{<i>(.*)</i>}.match(d)\r\n\t\t\t\t\ts = $1\r\n\t\t\t\t\[email protected] = true\r\n\t\t\t\telsif %r{<s>(.*)</s>}.match(d)\r\n\t\t\t\t\ts = $1\r\n\t\t\t\t\[email protected] = true\r\n\t\t\t\telse\r\n\t\t\t\t\ts = d\r\n\t\t\t\t\[email protected] = false\r\n\t\t\t\t\[email protected] = false\r\n\t\t\t\t\[email protected] = false\r\n\t\t\t\t\[email protected] = false\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\[email protected] = true if stylePolice == \"Bold\" || stylePolice == \"Bold Italic\"\r\n\t\t\t\[email protected] = true if stylePolice == \"Italic\" || stylePolice == \"Bold Italic\"\r\n\t\t\t\[email protected] = police\r\n\t\t\t\[email protected] = t[1]\r\n\t\t\t\[email protected] = valeur\r\n\t\t\t\[email protected] = position\r\n\t\t\t\[email protected](s)\r\n\t\t\t\t\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def AddFont(family, style='', file='')\n\t\tif (family.empty?)\n\t\t\treturn;\n\t\tend\n\n\t\t#Add a TrueType or Type1 font\n\t\tfamily = family.downcase\n\t\tif ((!@is_unicode) and (family == 'arial'))\n\t\t\tfamily = 'helvetica';\n\t\tend\n\n\t\tstyle=style.upcase\n\t\tstyle=style.gsub('U','');\n\t\tstyle=style.gsub('D','');\n\t\tif (style == 'IB')\n\t\t\tstyle = 'BI';\n\t\tend\n\n\t\tfontkey = family + style;\n\t\t# check if the font has been already added\n\t\tif !@fonts[fontkey].nil?\n\t\t\treturn;\n\t\tend\n\n\t\tif (file=='')\n\t\t\tfile = family.gsub(' ', '') + style.downcase + '.rb';\n\t\tend\n\t\tfont_file_name = getfontpath(file)\n\t\tif (font_file_name.nil?)\n\t\t\t# try to load the basic file without styles\n\t\t\tfile = family.gsub(' ', '') + '.rb';\n \t\tfont_file_name = getfontpath(file)\n\t\tend\n if font_file_name.nil?\n\t\t\tError(\"Could not find font #{file}.\")\n end\n\t\trequire(getfontpath(file))\n\t\tfont_desc = TCPDFFontDescriptor.font(file)\n\n\t\tif (font_desc[:name].nil? and @@fpdf_charwidths.nil?)\n\t\t\tError('Could not include font definition file');\n\t\tend\n\n\t\ti = @fonts.length+1;\n\t\tif (@is_unicode)\n\t\t\t@fonts[fontkey] = {'i' => i, 'type' => font_desc[:type], 'name' => font_desc[:name], 'desc' => font_desc[:desc], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'enc' => font_desc[:enc], 'file' => font_desc[:file], 'ctg' => font_desc[:ctg], 'cMap' => font_desc[:cMap], 'registry' => font_desc[:registry]}\n\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\telse\n\t\t\t@fonts[fontkey]={'i' => i, 'type'=>'core', 'name'=>@core_fonts[fontkey], 'up'=>-100, 'ut'=>50, 'cw' => font_desc[:cw]}\n\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\tend\n\n\t\tif (!font_desc[:diff].nil? and (!font_desc[:diff].empty?))\n\t\t\t#Search existing encodings\n\t\t\td=0;\n\t\t\[email protected];\n\t\t\t1.upto(nb) do |i|\n\t\t\t\tif (@diffs[i]== font_desc[:diff])\n\t\t\t\t\td = i;\n\t\t\t\t\tbreak;\n\t\t\t\tend\n\t\t\tend\n\t\t\tif (d==0)\n\t\t\t\td = nb+1;\n\t\t\t\t@diffs[d] = font_desc[:diff];\n\t\t\tend\n\t\t\t@fonts[fontkey]['diff'] = d;\n\t\tend\n\t\tif (font_desc[:file] and font_desc[:file].length > 0)\n\t\t\tif (font_desc[:type] == \"TrueType\") or (font_desc[:type] == \"TrueTypeUnicode\")\n\t\t\t\t@font_files[font_desc[:file]] = {'length1' => font_desc[:originalsize]}\n\t\t\telse\n\t\t\t\t@font_files[font_desc[:file]] = {'length1' => font_desc[:size1], 'length2' => font_desc[:size2]}\n\t\t\tend\n\t\tend\n\tend", "def align\n @options[:align]\n end", "def align_my_text\n unless @clone[@line_count].nil?\n @clone[@line_count].gsub!(/\\\\V\\[([0-9]+)\\]/i) { $game_variables[$1.to_i] }\n @clone[@line_count].gsub!(/\\\\V\\[([0-9]+)\\]/i) { $game_variables[$1.to_i] }\n @clone[@line_count].gsub!(/\\\\N\\[([0-9]+)\\]/i) { $game_actors[$1.to_i].name }\n @clone[@line_count].gsub!(/\\\\(?:alil|alic|alir|ar|ac|al)/){\"\"}\n @clone[@line_count].gsub!(/\\\\(?:keep|k|trans|t)/){\"\"}\n @clone[@line_count].gsub!(/\\\\(?:swap|uswap|flip|uflip|right|left)/){\"\"}\n @clone[@line_count].gsub!(/\\\\(?:s>|s<|f>|f<|f|l)/){\"\"}\n @clone[@line_count].gsub!(/\\\\IC\\[([0-9]+)\\]/i){\"[..]\"}\n @clone[@line_count].gsub!(/\\\\(?:C|FI)\\[([0-9]+)\\]/i){\"\"}\n @clone[@line_count].gsub!(/\\\\(?:G|B|I)/i){\"\"}\n @clone[@line_count].gsub!(/\\\\(?:>|<|\\.|\\\\|\\^|\\||!)/){\"\"}\n @clone[@line_count].gsub!(/\\\\pos\\[(\\d+):(\\d+)\\]/i){\"\"}\n linewidth = Graphics.width - 32 - @contents_x # Sets the width of a line\n textwidth = contents.text_size(@clone[@line_count]).width# Gets text width\n else\n linewidth = Graphics.width - 32 - @contents_x\n textwidth = contents.text_size(@text).width\n end\n \n if @lineali[@line_count] # Gets space for alignment\n newwidth = (linewidth - textwidth) / 2 * @lineali[@line_count]\n else\n newwidth = (linewidth - textwidth) / 2 * @halign\n end\n \n if @swapme # Sets the new alignment\n @contents_x = newwidth\n else\n @contents_x += newwidth \n end\n end", "def normalize_font(source, destination, options = {})\n hexa = options[:hexa] || {}\n interm = source.dirname.join(source.basename('.*').to_s + '.svg')\n if interm.exist?\n puts \"No conversion needed for #{interm}\".white\n else\n command(\"fontforge -quiet -script #{@convert_script} #{source} svg\")\n end\n i = File.open(interm)\n doc = Nokogiri::XML(i) do |config|\n config.nonet.strict.noblanks\n end\n i.close\n doc.root.xpath('//svg:glyph[@d]', SVG_NAMESPACES).each do |glyph|\n name = glyph.attr('glyph-name')\n unicode = glyph.attr('unicode').to_s\n if unicode[0]\n hex = '%4.4x' % unicode[0].ord\n name = hexa[hex] if hexa[hex]\n end\n if name && name =~ /^[a-z0-9]+((\\_|\\-)[a-z0-9]+)*$/\n glyph['glyph-name'] = name.gsub(/[^a-z0-9]+/, '-')\n else\n puts \" - weird name (#{unicode.inspect}): #{name.inspect.red} \"\n end\n end\n doc.root.default_namespace = SVG_NAMESPACES[:svg]\n for name, url in SVG_NAMESPACES\n doc.root.add_namespace(name.to_s, url)\n end\n File.open(destination, 'wb') do |f|\n f.write doc.to_s\n end\n end", "def make_pdf purchase, experience\n pdf = Prawn::Document.new :page_layout => :portrait\n\n # Para dibujar los ejes\n # pdf.fill_color \"363636\"\n # stroke_axis pdf\n\n # Header\n pdf.fill_color \"363636\"\n pdf.fill_rectangle [0, 720], 540, 40\n\n # Logo PuntosPoint\n pdf.image \"/#{Rails.root}/app/assets/images/logo_grande.png\", :at => [10, 670], width: 178, height: 70\n\n # Linea (como si fuera un hr)\n pdf.move_down 130\n pdf.stroke_horizontal_rule\n\n # Imagen de la experiencia\n p experience.image.url(:thumb)\n image = experience.image.url\n pdf.image open(image), :at => [10, 580], width: 184, height: 137\n\n y_coordinate = 0\n\n # Datos de la experiencia\n pdf.bounding_box([205, 580], :width => 320, :height => 330) do\n # Para dibujar contexto\n # pdf.stroke_bounds\n\n # Nombre Experiencia\n pdf.font_size 14\n pdf.font 'Helvetica', style: :bold\n pdf.text experience.name, :align => :justify\n\n # Enganche Experiencia\n pdf.font_size 10\n pdf.font 'Helvetica', style: :normal\n pdf.fill_color \"006699\"\n pdf.text experience.summary, :align => :justify\n\n # Detalles\n pdf.move_down 20\n pdf.fill_color \"363636\"\n pdf.text \"<b>#{Experience.human_attribute_name(:place)}:</b> #{experience.place}\", :inline_format => true, :leading => 5, :align => :justify\n # pdf.text \"<b>#{Experience.human_attribute_name(:comuna)}:</b> #{experience.comuna_name}\", :inline_format => true, :leading => 5, :align => :justify\n pdf.text \"<b>#{Experience.human_attribute_name(:validity_starting_at)}:</b> #{I18n.l experience.validity_starting_at, format: :long}\", :inline_format => true, :leading => 5, :align => :justify\n pdf.text \"<b>#{Experience.human_attribute_name(:validity_ending_at)}:</b> #{I18n.l experience.validity_ending_at, format: :long}\", :inline_format => true, :leading => 5, :align => :justify\n\n # 580 : Posicion Y del bounding_box\n # 330 : Alto máximo del bounding_box\n # pdf.cursor : Espacio del bounding_box no utilizado\n # 430 : Alto mínimo\n y_coordinate = [580 - 330 + pdf.cursor, 430].min\n end\n\n # Dejo el cursor en la ultima linea donde se escribio en el bounding_box anterior\n pdf.move_cursor_to y_coordinate\n\n # Agrando la fuente para los códigos\n pdf.font_size 12\n\n alto = 40\n ancho = 240\n\n # Código interno\n pdf.fill_color \"DDDDDD\"\n pdf.fill_rounded_rectangle [10, pdf.cursor], ancho, alto, 5\n pdf.fill_color \"363636\"\n pdf.bounding_box([20, pdf.cursor - (alto - pdf.font_size)/2], width: ancho, height: alto) do\n pdf.text \"Ticket de Compra: <b>#{@purchase.code}</b>\", :inline_format => true\n end\n\n # Códigos de validación\n pdf.fill_color \"DDDDDD\"\n pdf.fill_rounded_rectangle [10, pdf.cursor], ancho, alto + @purchase.reference_codes.count * (pdf.font_size + 2), 5\n pdf.fill_color \"363636\"\n\n pdf.bounding_box([20, pdf.cursor - (alto - pdf.font_size)/2], width: ancho - 20, height: pdf.font_size) do\n pdf.text \"#{Purchase.human_attribute_name(:reference_codes)}:\", :inline_format => true\n end\n\n pdf.bounding_box([20, pdf.cursor - (alto - pdf.font_size)/2 + pdf.font_size], width: ancho - 20, height: @purchase.reference_codes.count * (pdf.font_size + 2)) do\n @purchase.reference_codes.each_with_index do |rc, index|\n pdf.text \"<b>#{rc}</b>\", :inline_format => true, :align => :center\n end\n end\n\n # Forma de canje de la Experiencia\n pdf.font_size 10\n pdf.fill_color \"DDDDDD\"\n # NOTA: Para usar todo el alto disponible cambiar 150 => y_coordinate\n pdf.fill_rounded_rectangle [260, y_coordinate], 265, 150, 5\n pdf.fill_color \"363636\"\n # NOTA: Para usar todo el alto disponible usar height: y_coordinate - 20\n pdf.bounding_box([270, y_coordinate - 10], :width => 245, :height => 125) do\n # Para dibujar contexto\n # pdf.stroke_bounds\n\n # Título\n pdf.font_size 14\n pdf.text \"<b>#{Experience.human_attribute_name(:exchange_mechanism)}</b>\", :inline_format => true\n pdf.text \"\\n\"\n pdf.font_size 10\n\n # Mas información en: http://www.w3schools.com/tags/ref_entities.asp\n irregular_words = [\n [/&quot;/, '\"'],\n [/&apos;/, \"'\"],\n [/&amp;/, '&'],\n [/&lt;/, '<'],\n [/&gt;/, '>'],\n\n [/&nbsp;/, ' '],\n [/&iexcl;/, '¡'],\n [/&cent;/, '¢'],\n [/&pound;/, '£'],\n [/&curren;/, '¤'],\n [/&yen;/, '¥'],\n [/&brvbar;/, '¦'],\n [/&sect;/, '§'],\n [/&uml;/, '¨'],\n [/&copy;/, '©'],\n [/&ordf;/, 'ª'],\n [/&laquo;/, '«'],\n [/&not;/, '¬'],\n [/&shy;/, ''],\n [/&reg;/, '®'],\n [/&macr;/, '¯'],\n [/&deg;/, '°'],\n [/&plusmn;/, '±'],\n [/&sup3;/, '³'],\n [/&acute;/, '´'],\n [/&micro;/, 'µ'],\n [/&para;/, '¶'],\n [/&middot;/, '·'],\n [/&cedil;/, '¸'],\n [/&sup1;/, '¹'],\n [/&ordm;/, 'º'],\n [/&raquo;/, '»'],\n [/&frac14;/, '¼'],\n [/&frac12;/, '½'],\n [/&frac34;/, '¾'],\n [/&iquest;/, '¿'],\n [/&times;/, '×'],\n [/&divide;/, '÷'],\n\n [/&Agrave;/, 'À'],\n [/&Aacute;/, 'Á'],\n [/&Acirc;/, 'Â'],\n [/&Atilde;/, 'Ã'],\n [/&Auml;/, 'Ä'],\n [/&Aring;/, 'Å'],\n [/&AElig;/, 'Æ'],\n [/&AElig;/, 'Æ'],\n [/&Ccedil;/, 'Ç'],\n [/&Egrave;/, 'È'],\n [/&Eacute;/, 'É'],\n [/&Ecirc;/, 'Ê'],\n [/&Euml;/, 'Ë'],\n [/&Igrave;/, 'Ì'],\n [/&Iacute;/, 'Í'],\n [/&Icirc;/, 'Î'],\n [/&Iuml;/, 'Ï'],\n [/&ETH;/, 'Ð'],\n [/&Ntilde;/, 'Ñ'],\n [/&Ograve;/, 'Ò'],\n [/&Oacute;/, 'Ó'],\n [/&Ocirc;/, 'Ô'],\n [/&Otilde;/, 'Õ'],\n [/&Ouml;/, 'Ö'],\n [/&Oslash;/, 'Ø'],\n [/&Ugrave;/, 'Ù'],\n [/&Uacute;/, 'Ú'],\n [/&Ucirc;/, 'Û'],\n [/&Uuml;/, 'Ü'],\n [/&Yacute;/, 'Ý'],\n [/&THORN;/, 'Þ'],\n [/&szlig;/, 'ß'],\n\n [/&agrave;/, 'à'],\n [/&aacute;/, 'á'],\n [/&acirc;/, 'â'],\n [/&atilde;/, 'á'],\n [/&auml;/, 'ä'],\n [/&aring;/, 'å'],\n [/&aelig;/, 'æ'],\n [/&ccedil;/, 'ç'],\n [/&egrave;/, 'è'],\n [/&eacute;/, 'á'],\n [/&ecirc;/, 'ê'],\n [/&euml;/, 'ë'],\n [/&igrave;/, 'ì'],\n [/&iacute;/, 'í'],\n [/&icirc;/, 'î'],\n [/&iuml;/, 'ï'],\n [/&eth;/, 'ð'],\n [/&ntilde;/, 'ñ'],\n [/&ograve;/, 'ò'],\n [/&oacute;/, 'ó'],\n [/&ocirc;/, 'ô'],\n [/&otilde;/, 'õ'],\n [/&ouml;/, 'ö'],\n [/&oslash;/, 'ø'],\n [/&ugrave;/, 'ù'],\n [/&uacute;/, 'ú'],\n [/&ucirc;/, 'û'],\n [/&uuml;/, 'ü'],\n [/&yacute;/, 'ý'],\n [/&thorn;/, 'þ'],\n [/&yuml;/, 'ÿ'],\n\n [/&euro;/, '€'],\n [/&trade;/, '™']\n ]\n\n # Quito tags HTML que prawn no conoce\n exchange_mechanism = experience.exchange_mechanism.html_safe.gsub(/<\\/?[^>]+>/, '')\n irregular_words.each do |irregular_word|\n exchange_mechanism = exchange_mechanism.gsub(irregular_word[0], irregular_word[1])\n end\n\n # NOTA: Para usar todo el alto disponible\n # pdf.text_box exchange_mechanism, at: [0, pdf.cursor], :width => ancho, :height => y_coordinate - (y_coordinate - pdf.cursor), :overflow => :truncate, :align => :justify\n pdf.text_box exchange_mechanism, at: [0, pdf.cursor], :width => ancho, :height => 100, :overflow => :truncate, :align => :justify\n end\n\n return pdf\n end", "def analyze_glyphs_for_fallback_font_support fragment_hash\n fragment_font = fragment_hash[:font] || (original_font = @document.font.family)\n if (fragment_font_styles = fragment_hash[:styles])\n if fragment_font_styles.include? :bold\n fragment_font_opts = { style: (fragment_font_styles.include? :italic) ? :bold_italic : :bold }\n elsif fragment_font_styles.include? :italic\n fragment_font_opts = { style: :italic }\n end\n end\n fallback_fonts = @fallback_fonts.drop 0\n font_glyph_pairs = []\n @document.save_font do\n fragment_hash[:text].each_char do |char|\n font_glyph_pairs << [(find_font_for_this_glyph char, fragment_font, fragment_font_opts || {}, (fallback_fonts.drop 0)), char]\n end\n end\n # NOTE: don't add a :font to fragment if it wasn't there originally\n font_glyph_pairs.each {|pair| pair[0] = nil if pair[0] == original_font } if original_font\n form_fragments_from_like_font_glyph_pairs font_glyph_pairs, fragment_hash\n end", "def post_document_paragraph_run_font(request)\n data, _status_code, _headers = post_document_paragraph_run_font_with_http_info(request)\n request_token if _status_code == 401\n data\n end", "def generate_alignment\n raise ArgumentError, 'Missing genome FASTA file.' unless @genome_file\n raise ArgumentError, 'Missing transcripts FASTA file.' unless @transcripts_file\n \n # Prepare the BLAT alignment\n blat = Alignment::BLAT.new(@blat_options.merge({ out_format: :tab, database: @genome_file }))\n \n # Optionally set a permanent file to write the results to\n @alignment_file ||= \"#{@transcripts_file}.alignment\"\n blat.output_file = @alignment_file\n \n puts \"Running BLAT alignment...\" if @verbose\n \n # Run\n result_file = blat.run(@transcripts_file)\n result_file.path\n end", "def create\n campaign_id = session[:active_camp]\n ####################################################################\n\n params[:adword_text][:amount] = (params[:adword_text][:amount].to_i)*1000000\n api_v = get_api_version()\n gr_name = params[:adword_text][:name_gr]\n gr_amount = params[:adword_text][:amount]\n ad_group_id = add_ad_groups(campaign_id, api_v, gr_name, gr_amount)\n params[:adword_text][:group_id] = ad_group_id\n puts\"------------------------\"\n puts ad_group_id\n puts\"------------------------\"\n \n ###################################################################\n #ad_group_id = 15011254977\n ad_name = params[:adword_text][:name]\n ad_desc1 = params[:adword_text][:ad_desc1]\n ad_desc2 = params[:adword_text][:ad_desc2]\n ad_url = params[:adword_text][:ad_url]\n ad_display = params[:adword_text][:ad_display]\n add_text_id = add_text_ads( ad_group_id, ad_name, ad_desc1, ad_desc2, ad_url, ad_display)\n params[:adword_text][:adw_id] = add_text_id\n ##########################################################################################\n\n @ad_group = AdGroup.new(:name => params[:adword_text][:name_gr], :amount => params[:adword_text][:amount], :gr_id => ad_group_id, :campaing_id => campaign_id)\n respond_to do |format|\n if @ad_group.save\n format.html { \n @adword_text = AdwordText.new(adword_text_params)\n respond_to do |format|\n if @adword_text.save\n format.html { redirect_to @adword_text, notice: 'Adword text was successfully created.' }\n format.json { render :show, status: :created, location: @adword_text }\n else\n format.html { render :new }\n format.json { render json: @adword_text.errors, status: :unprocessable_entity }\n end\n end\n }\n format.json { render :show, status: :created, location: @ad_group }\n else\n format.html { render :new }\n format.json { render json: @ad_group.errors, status: :unprocessable_entity }\n end\n end \n end", "def add_text(x, y, text, size = nil, angle = 0, word_space_adjust = 0)\n if text.kind_of?(Numeric) and size.kind_of?(String)\n text, size = size, text\n warn PDF::Writer::Lang[:add_text_parameters_reversed] % caller[0]\n end\n\n if size.nil? or size <= 0\n size = @font_size\n end\n\n select_font(\"Helvetica\") if @fonts.empty?\n\n text = text.to_s\n\n # If there are any open callbacks, then they should be called, to show\n # the start of the line\n @callbacks.reverse_each do |ii|\n info = ii.dup\n info[:x] = x\n info[:y] = y\n info[:angle] = angle\n info[:status] = :start_line\n\n info[:tag][self, info]\n end\n if angle == 0\n add_content(\"\\nBT %.3f %.3f Td\" % [x, y])\n else\n rad = PDF::Math.deg2rad(angle)\n tt = \"\\nBT %.3f %.3f %.3f %.3f %.3f %.3f Tm\"\n tt = tt % [ Math.cos(rad), Math.sin(rad), -Math.sin(rad), Math.cos(rad), x, y ]\n add_content(tt)\n end\n\n if (word_space_adjust != 0) or not ((@word_space_adjust.nil?) and (@word_space_adjust != word_space_adjust))\n @word_space_adjust = word_space_adjust\n add_content(\" %.3f Tw\" % word_space_adjust)\n end\n\n pos = -1\n start = 0\n loop do\n pos += 1\n break if pos == text.size\n font_change = true\n tag_size, text, font_change = quick_text_tags(text, pos, font_change)\n\n if tag_size != 0\n if pos > start\n part = text[start, pos - start]\n tt = \" /F#{find_font(@current_font).font_id}\"\n tt << \" %.1f Tf %d Tr\" % [ size, @current_text_render_style ]\n tt << \" (#{PDF::Writer.escape(part)}) Tj\"\n add_content(tt)\n end\n\n if font_change\n current_font!\n else\n add_content(\" ET\")\n xp = x\n yp = y\n tag_size, text, font_change, xp, yp = text_tags(text, pos, font_change, true, xp, yp, size, angle, word_space_adjust)\n\n # Restart the text object\n if angle.zero?\n add_content(\"\\nBT %.3f %.3f Td\" % [xp, yp])\n else\n rad = PDF::Math.deg2rad(angle)\n tt = \"\\nBT %.3f %.3f %.3f %.3f %.3f %.3f Tm\"\n tt = tt % [ Math.cos(rad), Math.sin(rad), -Math.sin(rad), Math.cos(rad), xp, yp ]\n add_content(tt)\n end\n\n if (word_space_adjust != 0) or (word_space_adjust != @word_space_adjust)\n @word_space_adjust = word_space_adjust\n add_content(\" %.3f Tw\" % [word_space_adjust])\n end\n end\n\n pos += tag_size - 1\n start = pos + 1\n end\n end\n\n if start < text.size\n part = text[start..-1]\n\n tt = \" /F#{find_font(@current_font).font_id}\"\n tt << \" %.1f Tf %d Tr\" % [ size, @current_text_render_style ]\n tt << \" (#{PDF::Writer.escape(part)}) Tj\"\n add_content(tt)\n end\n add_content(\" ET\")\n\n # XXX: Experimental fix.\n @callbacks.reverse_each do |ii|\n info = ii.dup\n info[:x] = x\n info[:y] = y\n info[:angle] = angle\n info[:status] = :end_line\n info[:tag][self, info]\n end\n end", "def update!(**args)\n @base_line = args[:base_line] if args.key?(:base_line)\n @character_height = args[:character_height] if args.key?(:character_height)\n @color = args[:color] if args.key?(:color)\n @confidence = args[:confidence] if args.key?(:confidence)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_size = args[:font_size] if args.key?(:font_size)\n @font_size_float = args[:font_size_float] if args.key?(:font_size_float)\n @font_type = args[:font_type] if args.key?(:font_type)\n @has_uncertain_height = args[:has_uncertain_height] if args.key?(:has_uncertain_height)\n @horizontal_scale = args[:horizontal_scale] if args.key?(:horizontal_scale)\n @is_bold = args[:is_bold] if args.key?(:is_bold)\n @is_italic = args[:is_italic] if args.key?(:is_italic)\n @is_small_caps = args[:is_small_caps] if args.key?(:is_small_caps)\n @is_strikeout = args[:is_strikeout] if args.key?(:is_strikeout)\n @is_subscript = args[:is_subscript] if args.key?(:is_subscript)\n @is_superscript = args[:is_superscript] if args.key?(:is_superscript)\n @is_suspicious = args[:is_suspicious] if args.key?(:is_suspicious)\n @is_underlined = args[:is_underlined] if args.key?(:is_underlined)\n @not_ocrable_per_qa = args[:not_ocrable_per_qa] if args.key?(:not_ocrable_per_qa)\n @penalty = args[:penalty] if args.key?(:penalty)\n @serif_probability = args[:serif_probability] if args.key?(:serif_probability)\n end", "def set_font_families(font_families:)\n {\n method: \"Page.setFontFamilies\",\n params: { fontFamilies: font_families }.compact\n }\n end", "def update!(**args)\n @estimated_font_sizes = args[:estimated_font_sizes] if args.key?(:estimated_font_sizes)\n @font_size_histogram = args[:font_size_histogram] if args.key?(:font_size_histogram)\n @mean_symbols_per_block = args[:mean_symbols_per_block] if args.key?(:mean_symbols_per_block)\n @mean_symbols_per_line = args[:mean_symbols_per_line] if args.key?(:mean_symbols_per_line)\n @mean_symbols_per_paragraph = args[:mean_symbols_per_paragraph] if args.key?(:mean_symbols_per_paragraph)\n @mean_symbols_per_word = args[:mean_symbols_per_word] if args.key?(:mean_symbols_per_word)\n @mean_words_per_block = args[:mean_words_per_block] if args.key?(:mean_words_per_block)\n @mean_words_per_line = args[:mean_words_per_line] if args.key?(:mean_words_per_line)\n @mean_words_per_paragraph = args[:mean_words_per_paragraph] if args.key?(:mean_words_per_paragraph)\n @median_block_space = args[:median_block_space] if args.key?(:median_block_space)\n @median_even_printed_box = args[:median_even_printed_box] if args.key?(:median_even_printed_box)\n @median_full_even_printed_box = args[:median_full_even_printed_box] if args.key?(:median_full_even_printed_box)\n @median_full_odd_printed_box = args[:median_full_odd_printed_box] if args.key?(:median_full_odd_printed_box)\n @median_full_printed_box = args[:median_full_printed_box] if args.key?(:median_full_printed_box)\n @median_height = args[:median_height] if args.key?(:median_height)\n @median_horizontal_dpi = args[:median_horizontal_dpi] if args.key?(:median_horizontal_dpi)\n @median_line_height = args[:median_line_height] if args.key?(:median_line_height)\n @median_line_space = args[:median_line_space] if args.key?(:median_line_space)\n @median_line_span = args[:median_line_span] if args.key?(:median_line_span)\n @median_odd_printed_box = args[:median_odd_printed_box] if args.key?(:median_odd_printed_box)\n @median_paragraph_indent = args[:median_paragraph_indent] if args.key?(:median_paragraph_indent)\n @median_paragraph_space = args[:median_paragraph_space] if args.key?(:median_paragraph_space)\n @median_printed_box = args[:median_printed_box] if args.key?(:median_printed_box)\n @median_symbols_per_block = args[:median_symbols_per_block] if args.key?(:median_symbols_per_block)\n @median_symbols_per_line = args[:median_symbols_per_line] if args.key?(:median_symbols_per_line)\n @median_symbols_per_paragraph = args[:median_symbols_per_paragraph] if args.key?(:median_symbols_per_paragraph)\n @median_symbols_per_word = args[:median_symbols_per_word] if args.key?(:median_symbols_per_word)\n @median_vertical_dpi = args[:median_vertical_dpi] if args.key?(:median_vertical_dpi)\n @median_width = args[:median_width] if args.key?(:median_width)\n @median_words_per_block = args[:median_words_per_block] if args.key?(:median_words_per_block)\n @median_words_per_line = args[:median_words_per_line] if args.key?(:median_words_per_line)\n @median_words_per_paragraph = args[:median_words_per_paragraph] if args.key?(:median_words_per_paragraph)\n @num_block_spaces = args[:num_block_spaces] if args.key?(:num_block_spaces)\n @num_blocks = args[:num_blocks] if args.key?(:num_blocks)\n @num_line_spaces = args[:num_line_spaces] if args.key?(:num_line_spaces)\n @num_lines = args[:num_lines] if args.key?(:num_lines)\n @num_non_graphic_blocks = args[:num_non_graphic_blocks] if args.key?(:num_non_graphic_blocks)\n @num_pages = args[:num_pages] if args.key?(:num_pages)\n @num_paragraph_spaces = args[:num_paragraph_spaces] if args.key?(:num_paragraph_spaces)\n @num_paragraphs = args[:num_paragraphs] if args.key?(:num_paragraphs)\n @num_symbols = args[:num_symbols] if args.key?(:num_symbols)\n @num_words = args[:num_words] if args.key?(:num_words)\n end", "def parse_font_options(options = {})\n return if (options.keys & [:fg_color, :sz, :b, :i, :u, :strike, :outline, :shadow, :charset, :family, :font_name]).empty?\n\n Axlsx.instance_values_for(fonts.first).each do |key, value|\n # Thanks for that 1.8.7 - cant do a simple merge...\n options[key.to_sym] = value unless options.key?(key.to_sym)\n end\n font = Font.new(options)\n font.color = Color.new(rgb: options[:fg_color]) if options[:fg_color]\n font.name = options[:font_name] if options[:font_name]\n options[:type] == :dxf ? font : fonts << font\n end", "def align\n align = {}\n format.each_with_index do |format, index|\n align[index] = (NUMBER_FORMATS.include?(format) ? :right : :left)\n end\n align\n end", "def font_setup\n %Q(font \"#{@font},#{@fontsize}\")\n end", "def convert_fonts(sass)\n out = \"\"\n sass.each_line do |line|\n line.gsub!(/(\\s*)(word-spacing|letter-spacing|font-size|line-height|margin-[^\\s]+|margin|padding-[\\s]+|padding)\\s*:(.*)/) do |m|\n # :spacing :rule :value\n m = \"%s%s: %s\" % [$1, $2, CSS.val_to_em($3)]\n end\n out << line\n end\n out\n end", "def print_align(io, sequences, labels, opts={})\n opts = {:cutoff => 70, :start => 0, :chars => 20}.merge(opts)\n (start, length, chars) = opts.values_at(:start, :cutoff, :chars)\n spacer = \" \"\n\n if opts[:template]\n sequences.unshift(opts[:template])\n labels.unshift(opts[:template_label])\n end\n\n all_stats = Array.new(6,0)\n loop do\n fin = false\n\n max_length = 0\n lines = []\n consensus_line = \"\"\n fragments = sequences.map do |string|\n fin = (start >= string.length )\n break if fin\n\n string_frag = string[start, length]\n\n string_frag\n end ; break if fin\n\n doubles = fragments.zip(labels)\n\n doubles = doubles.select {|frag, _| (frag.size > 0) && (frag =~ /[^-]/) }\n\n max_length = doubles.map {|frag, _| frag.size }.max\n\n (cs, stats) = consensus_string_and_stats( doubles.map {|frag,_| frag } )\n all_stats = all_stats.zip(stats).map {|a,b| a + b }\n\n doubles.push( [cs, \"<CONSENSUS>\"] )\n\n lines = doubles.map {|frag, label| [exactly_chars(label, chars),spacer,frag].join }\n\n ## the counters at the top of the line\n start_s = start.to_s\n finish_s = (start + max_length).to_s\n count_line_gap = max_length - (start_s.size + finish_s.size)\n count_line = [start_s, spacer]\n unless count_line_gap < 1\n count_line << \" \" * count_line_gap\n end\n io.puts [exactly_chars(\"\", chars), spacer, count_line.join].join\n\n io.puts lines.join(\"\\n\")\n\n io.puts \" \" # separator between lines\n start += length\n end\n end", "def align\n unless defined?(@align); parse_align; end\n @align\n end", "def align\n unless defined?(@align); parse_align; end\n @align\n end", "def set_font(key, font)\r\n # Add :Font key to content hash unless there is no key\r\n unless @content[pn(:Resources)].has_key?(pn(:Font))\r\n @content[pn(:Resources)].update(pn(:Font) => pd)\r\n end\r\n # Add font symbol to :Font hash\r\n unless @content[pn(:Resources)][pn(:Font)].has_key?(key)\r\n @content[pn(:Resources)][pn(:Font)].update(key => font.reference)\r\n end\r\n end", "def add_font font\n @fonts.push(font).uniq! if font\n font\n end", "def update!(**args)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_size = args[:font_size] if args.key?(:font_size)\n @median_height = args[:median_height] if args.key?(:median_height)\n @median_line_height = args[:median_line_height] if args.key?(:median_line_height)\n @median_line_space = args[:median_line_space] if args.key?(:median_line_space)\n @median_line_span = args[:median_line_span] if args.key?(:median_line_span)\n @median_width = args[:median_width] if args.key?(:median_width)\n @num_line_spaces = args[:num_line_spaces] if args.key?(:num_line_spaces)\n @num_lines = args[:num_lines] if args.key?(:num_lines)\n @num_symbols = args[:num_symbols] if args.key?(:num_symbols)\n end", "def draw_attributes\n draw_header\n \n change_color(system_color)\n #draw_text(5, 32, self.width, 24, \"Categoria:\")\n draw_text(5, 32, self.width, 24, \"Atributos:\")\n change_color(normal_color)\n \n 8.times do |i|\n draw_text(5, 56 + i * 24, 131, 24, Vocab.param(i))\n end\n\n 8.times do |i|\n change_color(normal_color)\n draw_text(self.width - 108, 54 + i * 24, 64, 24, \"#{@item.params[i].to_i}\")\n draw_text(self.width - 75, 54 + i * 24, 64, 24, \"→\")\n change_color(@enchant[:effects][i] > 0 ? power_up_color : normal_color)\n draw_text(self.width - 54, 54 + i * 24, 64, 24, \"#{(@item.params[i] + @enchant[:effects][i]).to_i}\")\n end\n end", "def send_award_letter\n update_attribute(:award_letter_sent_at, Time.now)\n update_attribute(:award_letter_text, award_letter_text)\n end", "def bibliography_style_params\n params.require(:bibliography_style).permit(:standard, :document_type_id, :field_id, :sequence, :format)\n end", "def update_font\n self.contents.font.name = @window.fontName\n #self.recalculate_maxlength\n self.refresh\n end", "def create\n @attention_center = AttentionCenter.new(attention_center_params)\n\n respond_to do |format|\n if @attention_center.save\n format.html { redirect_to @attention_center, notice: 'Attention center was successfully created.' }\n format.json { render :show, status: :created, location: @attention_center }\n else\n format.html { render :new }\n format.json { render json: @attention_center.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alignment_position = AlignmentPosition.new(params[:alignment_position])\n\n respond_to do |format|\n if @alignment_position.save\n format.html { redirect_to(@alignment_position, :notice => 'Alignment position was successfully created.') }\n format.xml { render :xml => @alignment_position, :status => :created, :location => @alignment_position }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alignment_position.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @award = Award.new(award_params)\n respond_to do |format|\n if @award.save\n a_data = JSON.parse params[:json_string]\n a_data.each do |a|\n @item = get_new_award_item(@award, a) unless a.nil?\n end\n AwardMailer.approval_request(@award)\n if current_user.admin\n format.html { redirect_to patient_path(@award.patient), notice: 'Award was successfully created.' }\n else\n format.html { redirect_to new_patient_path, notice: 'Award was successfully created.' }\n end\n format.json { render :show, status: :created, location: @award }\n else\n format.html { render :new }\n format.json { render json: @award.errors, status: :unprocessable_entity }\n end\n end\n end", "def single_image\n page_number = 1\n\n input_image_path = \"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/page#{page_number}.jpg\"\n image = Magick::Image.read(input_image_path)[0]\n json_path =\"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/output-#{page_number}-to-#{page_number}.json\"\n json_text = File.read(json_path)\n json = JSON.parse(json_text)\n\n bounding_box = json[\"responses\"].first[\"textAnnotations\"][1][\"boundingPoly\"]\n vertices = bounding_box[\"vertices\"]\n\n draw = Magick::Draw.new\n\n # For drawing boxes around all words.\n # text_annotations = json[\"responses\"].first[\"textAnnotations\"][1..-1]\n # text_annotations.each do |text_annotation|\n # bounding_box = text_annotation[\"boundingPoly\"]\n # vertices = bounding_box[\"vertices\"]\n\n # p1 = [ vertices[0]['x'], vertices[0]['y'] ]\n # p2 = [ vertices[1]['x'], vertices[1]['y'] ]\n # p3 = [ vertices[3]['x'], vertices[3]['y'] ]\n # p4 = [ vertices[2]['x'], vertices[2]['y'] ]\n\n # draw.line(p1[0],p1[1], p2[0], p2[1])\n # draw.line(p1[0],p1[1], p3[0], p3[1])\n # draw.line(p2[0],p2[1], p4[0], p4[1])\n # draw.line(p3[0],p3[1], p4[0], p4[1])\n # end\n\n # For drawing colored boxes around all symbols\n\n confidence_symbols_to_colors = {\n very_confidence: '#BED1D8',\n moderately_confidence: '#FFAE03',\n sort_of_confidence: '#E67F0D',\n low_confidence: '#E9190F'\n }\n\n numbers_to_confidence_symbols = {\n 80..100 => :very_confidence,\n 50..80 => :moderately_confidence,\n 31..50 => :sort_of_confidence,\n 0..30 => :low_confidence\n }\n\n pages = json[\"responses\"].first[\"fullTextAnnotation\"]['pages']\n blocks = pages.map{|p| p['blocks'] }.flatten.compact\n paragraphs = blocks.map{|b| b['paragraphs'] }.flatten.compact\n words = paragraphs.map{|p| p['words'] }.flatten.compact\n symbols = words.map{|w| w['symbols'] }.flatten.compact\n symbol_total = symbols.count\n symbols.each.with_index do |symbol, index|\n puts \"Processing symbol #{index} of #{symbol_count}\"\n bounding_box = symbol[\"boundingBox\"]\n vertices = bounding_box[\"vertices\"]\n confidence_number = (symbol['confidence'] * 100).to_i\n confidence_symbol = numbers_to_confidence_symbols.select{|n| n === confidence_number }.values.first\n color = confidence_symbols_to_colors[confidence_symbol]\n\n draw.stroke(color)\n draw.stroke_width(5)\n\n p1 = [ vertices[0]['x'], vertices[0]['y'] ]\n p2 = [ vertices[1]['x'], vertices[1]['y'] ]\n p3 = [ vertices[3]['x'], vertices[3]['y'] ]\n p4 = [ vertices[2]['x'], vertices[2]['y'] ]\n\n draw.line(p1[0],p1[1], p2[0], p2[1])\n draw.line(p1[0],p1[1], p3[0], p3[1])\n draw.line(p2[0],p2[1], p4[0], p4[1])\n draw.line(p3[0],p3[1], p4[0], p4[1])\n\n draw.draw(image)\n end\n output_image_path = \"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/page#{page_number}.5px.symbols.jpg\"\n image.write(output_image_path)\nend", "def bucketized_alignment\n # split reads into buckets according to their size and err_rate\n @buckets = bucketize(@err_rate)\n\n # perform alignment on each bucket\n @buckets.reverse_each do |lower, upper, mismatches|\n @names.set_bucket(lower, upper)\n mapped, unmapped = align(\n @ref, @ref_base, @software,\n { annotation: @annotation,\n tophat_aligner: @tophat_aligner,\n mismatches: mismatches\n }\n )\n @mapped_bams << mapped\n @unmapped_bams << unmapped\n @max_mismatches = [@max_mismatches, mismatches].max\n end\n\n # merge alignments\n @names.unset_bucket\n unbucketize(@mapped_bams, @names.get('mapped_merged'))\n unbucketize(@unmapped_bams, @names.get('unmapped_merged'))\n end", "def type1_font_names\n if @options[:built_in_fonts]\n PdfK::FONT_NAMES\n else\n AFM::font_names\n end\n end", "def create\n @annotation = Annotation.new(params[:annotation].permit(:start_video, :end_video, :text, :top_align, :left_align, :color))\n\n if @annotation.save\n render json: @annotation, status: :created, location: @annotation\n else\n render json: @annotation.errors, status: :unprocessable_entity\n end\n end", "def create\n @campaign = Campaign.create!(name: params[:name], dm_id: params[:dm_id], theme: params[:theme], setting: params[:setting], calendar_id: params[:calendar_id], starting_level: params[:starting_level], skillset_id: params[:skillset_id], custom_notes: params[:custom_notes], starting_month: params[:month], starting_weekday: params[:weekday], starting_day: params[:day], starting_year: params[:year], starting_age: params[:age], current_month: params[:month], current_weekday: params[:weekday], current_day: params[:day], current_year: params[:year], current_age: params[:age])\n\n params[:race_ids].each do |ri|\n CampaignRace.create!(campaign_id: @campaign.id, race_id: ri)\n end\n\n params[:klass_ids].each do |ki|\n CampaignKlass.create!(campaign_id: @campaign.id, klass_id: ki)\n end\n\n render json: @campaign, status: 201\n\n end" ]
[ "0.6230673", "0.6140851", "0.6020684", "0.59134793", "0.5847937", "0.5342949", "0.53206", "0.5187375", "0.5163735", "0.51530045", "0.5037608", "0.50356025", "0.49705786", "0.49447054", "0.49132535", "0.4880144", "0.4845965", "0.47975308", "0.47599897", "0.4710284", "0.4700965", "0.46972466", "0.46636432", "0.46559003", "0.46225062", "0.45998076", "0.45672825", "0.45594174", "0.45527503", "0.4543411", "0.45368245", "0.45354438", "0.45347583", "0.45209804", "0.45062977", "0.45005468", "0.44900325", "0.44848588", "0.44815364", "0.447879", "0.44688657", "0.4448257", "0.44421664", "0.44372287", "0.44264987", "0.44040555", "0.4400141", "0.43989253", "0.43936512", "0.43901527", "0.4384241", "0.43814838", "0.437123", "0.43610954", "0.43610954", "0.4356752", "0.43526947", "0.4340622", "0.43381882", "0.43281838", "0.43223003", "0.43192464", "0.43158433", "0.43150574", "0.43054414", "0.4300579", "0.4294322", "0.42825815", "0.4279246", "0.4279023", "0.42759672", "0.42743745", "0.42721826", "0.4269965", "0.426494", "0.4257729", "0.4257023", "0.42539734", "0.42516783", "0.42416754", "0.42379567", "0.4234565", "0.42293867", "0.4212106", "0.4212106", "0.42049047", "0.4190829", "0.41905674", "0.41890195", "0.41885293", "0.41785982", "0.4177831", "0.4177251", "0.417509", "0.4168838", "0.41673875", "0.41666606", "0.41601437", "0.41543373", "0.41538697" ]
0.7196551
0