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 |
---|---|---|---|---|---|---|
display all stock info | def full_info(db)
info = db.execute("SELECT stocks2.company_name,stocks2.stock_ticker,stocks2.stock_price,stocks2.stock_exchange,stocks1.recommendation FROM stocks2 JOIN stocks1 ON stocks2.recommendation_id = stocks1.id;")
puts ""
info.each do |category|
puts "
Company Name : #{category['company_name']}
Stock Ticker : #{category['stock_ticker']}
Stock Price : #{category['stock_price']}
Stock Exchange: #{category['stock_exchange']}
Rating : #{category['recommendation']}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @stock = Stock.find(params[:id])\n @items = @stock.item\n @stock_audits = @stock.stock_audit\n end",
"def stocks\n\n end",
"def index\n render :layout => \"user\"\n #Stock.test 'SK6U.SI'\n #Stock.searchSymbol 'starhub'\n #Stock.historicalData 'CC3.SI','2013-07-21','2013-07-25'\n end",
"def show\n\t\t\n\t\t#Show total items and prices\n\t\tputs \"\\nShopping list: \"\n @list_products.each {|key, val| print val, \" \", key, \" \",productsMarket[key], \"$\\n\"} \n\tend",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def show\n\t\tyahoo_client = YahooFinance::Client.new\n\t\t@data = yahoo_client.quotes([\"AER\", \"AYR\", \"FLY\", \"AL\", \"ACY\", \"WLFC\"], [:symbol, :name, :ask, :change, :change_in_percent, :market_capitalization])\n\tend",
"def index\n @stock_tickers = StockTicker.all\n end",
"def show\n if Stock.check_valid(params[:symbol])\n if Stock.not_exists?(params[:symbol])\n create\n end\n $stock = Stock.find(params[:symbol])\n # Gather and check chart data\n @input = Stock.get_overview(params)\n if @input === 404\n not_found\n else\n @data = YahooFinance.quotes([params[:symbol]], [:name, :last_trade_price, :ask, :bid, :open, :close, :volume, :market_capitalization, :dividend_yield, :dividend_per_share, :change, :change_in_percent, :last_trade_date, :stock_exchange])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: $stock }\n end\n end\n else\n not_found\n end\n end",
"def show\n @portfolio = Portfolio.find(params[:id])\n\n \n # @stocks = YahooFinance.quotes([@portfolio.stocks.group_by(&:stock_symbol)], [:ask, :bid], { raw: false } )\n # additional resources :\n # https://github.com/herval/yahoo-finance\n # https://github.com/rlazoti/yahoofinance-example/blob/master/view_stocks.rb\n\n @stocks = YahooFinance.quotes(@portfolio.stocks.group_by(&:stock_symbol), [:ask, :bid, :symbol, :last_trade_price], { raw: false } )\n \n\n @stock = Stock.new\n @stock.portfolio_id = @portfolio.id\n end",
"def print_data\n response = @quandl_client.get_stock\n abort 'Unable to find data for this search' if response['dataset'].nil? || response['dataset'].empty?\n\n prepare_result(response)\n display_result\n end",
"def index\n \t@stocks = Stock.all\n \t#@stock = current_user.stocks\n end",
"def show\n cache_recent_item(:exchange, @exchange.id, @exchange.trading_code)\n\n @trading_symbols_grid = initialize_grid(TradingSymbol.where(exchange_id: @exchange.id))\n end",
"def show\n drop_breadcrumb(\"股票\")\n drop_breadcrumb(\"#{@stock.name}(#{@stock.market}:#{@stock.code})\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n @quote = YahooFinance::get_standard_quotes(@stock.ticker)[@stock.ticker]\n @tweets = Twitter.search('$' + @stock.ticker).results\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def index\n @company_inventory_stocks = CompanyInventoryStock.all\n end",
"def get_stocks\n @stocks = Stock.where(user_id: session[:current_user_id]).order(\"ticker_symbol ASC\")\n end",
"def index\n @stores = Stock.all\n end",
"def index\n @stock_prices = StockPrice.all\n end",
"def show\n @stock = Stock.find(params[:id])\n default_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock }\n end\n end",
"def view_my_stocks(prompt, user)\n # groups stocks owned by specified user and sums up the quantity per stock symbol\n # total = 0 \n array = []\n stocks_qty = self.stocks.group(:stock_symbol).sum(:stock_qty)\n\n stocks_qty.each do |key, value|\n current_price = find_stock(key).current_price\n yesterdays_price = find_stock(key).yesterdays_price\n differential = ((yesterdays_price - current_price).abs / yesterdays_price)*100\n \n differential_checker(current_price, yesterdays_price, key, value, array,differential)\n end\n\n table = TTY::Table.new header: ['Stock Symbol', 'Quantity', 'Yesterdays Share Price', 'Todays Share Price', '% Change'], rows: array\n puts table.render(:unicode)\n end",
"def index\n @stock_products = StockProduct.all\n end",
"def index\n @asset_stocks = AssetStock.all\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @sp500_stock = Sp500Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sp500_stock }\n end\n end",
"def show\n @records = Record.all.where(stock_id: @stock.id).order(date: :desc).limit(5)\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock }\n end\n end",
"def stocks(refresh = false)\n @stocks = nil if refresh\n @stocks ||= begin\n @client.get(\"venues/#{@venue_symbol}/stocks\")['symbols'] rescue nil\n end\n end",
"def list_stock_search_menu\n choice_num = 1\n puts_blanks\n puts \"::: #{@company_name} STOCK MENU :::\".colorize( :blue )\n blank\n puts \"What would you like to view about #{@company_name}?\"\n blank\n @@company_choices.each do |choice|\n puts \"[#{choice_num}] #{choice[:title]}\"\n choice_num += 1\n end\n\n puts \"[a] to run all\"\n puts \"[x] Exit Program\"\n end",
"def list_books\n puts \"\"\n puts \"Current Catalogue:\"\n puts \"\"\n puts \"A-G:\"\n \t@shelf_ag.to_s\n \tputs \"H-P:\"\n \t@shelf_hp.to_s\n \tputs \"Q-Z:\"\n \t@shelf_qz.to_s\n end",
"def index\n @runs = @stocks_util.user_runs\n @selected_run = @stocks_util.selected_run\n set_stocks\n @stocks_util.enrich_stock_from_yahoo(@stocks) if @stocks.size != 0\n end",
"def index\n session[:product] = params[:product] if params[:product]\n @stocks = Stock.product session[:product]\n default_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stocks }\n end\n end",
"def show\n @stocklist = Stocklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stocklist }\n end\n end",
"def index\n @addstocks = Addstock.all\n end",
"def show\n @currencies = CryptocurrenciesService.new.get_top\n end",
"def index\n @stocking_products = StockingProduct.all\n end",
"def list\n Terminal::Table.new(title: \"Items in Stock\", headings: [ 'Code', 'Name', 'Price'], rows: to_a)\n end",
"def import_stock_hourly_display\n #JdeItemAvailability.import_stock_hourly_display\n SalesProductivity.generate_productivity\n end",
"def stockquote(stock)\n url = URI(\"https://apidojo-yahoo-finance-v1.p.rapidapi.com/market/v2/get-quotes?region=US&symbols=#{@stock}\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n request = Net::HTTP::Get.new(url)\n request[\"x-rapidapi-key\"] = ENV['X_RAPIDAPI_KEY']\n request[\"x-rapidapi-host\"] = 'apidojo-yahoo-finance-v1.p.rapidapi.com'\n \n response = http.request(request)\n quoteResponse = JSON.parse(response.read_body)['quoteResponse']\n result = quoteResponse['result']\n @zero = result[0]\n puts \"Symbol = #{@zero['symbol']}, Exchange = #{@zero['fullExchangeName']}, Bid = #{@zero['bid']}, Ask = #{@zero['ask']}\"\n\n return \"<div class =col>\n <h2>Symbol=<a>#{@zero['symbol']}</a></h2>\n <h4>Exchange=<a>#{@zero['fullExchangeName']}</a></h4>\n <h4>Bid=<a>#{@zero['bid']}</a></h4>\n <h4>Ask=<a>#{@zero['ask']}</a></h4>\n </div>\"\n end",
"def show\n @stockist = Stockist.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @stockist }\n end\n end",
"def show\n @net_investment = 0\n @stock = Stock.find(params[:id])\n @investments = Investment.where(stock_id: @stock.id).limit(10)\n @my_investments = Investment.where(stock_id: @stock.id, member_id: current_member.id)\n @my_investments.each do |investment|\n @net_investment += investment.share_change\n end \n @stock.price = StockQuote::Stock.quote(@stock.ticker).last_trade_price_only\n @stock.save\n require 'net/http'\n\n begin\n @url = 'http://chart.finance.yahoo.com/z?s=%{ticker}' % {ticker: @stock.ticker}\n @resp = Net::HTTP.get_response(URI.parse(@url)) # get_response takes an URI object\n rescue\n print \"Connection error.\"\n end \n end",
"def show\n @prices_history = combined_price_history\n @day_of_week = weekly_price_history\n @month_of_year = monthly_price_history\n end",
"def show\n @total_stock = TotalStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @total_stock }\n end\n end",
"def current_symbols\n @interface.stock_symbols\n end",
"def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end",
"def index\n @product_sample_stocks = ProductSampleStock.all\n end",
"def details\n\n puts \"\"\n puts \"Todays crypto update:\"\n puts \"Volume is the amount of the coin that has been traded with in a certain time frame...fyi\"\n puts \"----------------------------------------------------------------------\"\n puts \"| Coin (Symbol) | Volume (1 day) | Volume (7 day) | Volume (30 day) |\"\n puts \"----------------------------------------------------------------------\"\n puts \"\"\n\n @coins = TheCryptoUpdate::Coin.all[0..99]\n\n @coins.find do |coin|\n puts \" #{coin.name} (#{coin.symbol}) | $#{coin.volume_1d} | $#{coin.volume_7d} | $#{coin.volume_30d} |\"\n end\n\n end",
"def show\n @trades = @stock.trades\n @totalrevenue = @stock.trades.where(:action => \"SELL\").sum('shares*price')\n @totalcost = @stock.trades.where(:action => \"BUY\").sum('shares*price')\n @overall = @totalrevenue - @totalcost\n \n #Trade.where(:action => \"BUY\", :stock_id => 11).sum(shares*price)\n end",
"def show\n @warehouse = Warehouse.find(params[:id])\n @stocks = Stock.where(:company_id => @company.id, :warehouse_id => params[:id]).page(params[:page]).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @warehouse }\n end\n end",
"def index\n headers['Last-Modified'] = Time.now.httpdate\n session_id = nil\n\n if !params[:symbols].nil?\n syms = params[:symbols].split(\",\")\n @stocks = params[:latest] ? [] : Stock.where(symbol: syms)\n\n login_response = AmeritradeHelper.login(params)\n puts \"*** login response #{login_response}\"\n unless login_response.nil?\n session_id = login_response[:session_id]\n login_date = login_response[:login_date]\n end\n\n if !session_id.nil?\n syms.each do |sym|\n new_stocks = AmeritradeHelper.get_stock_symbol(sym, !params[:historic].nil?, params, session)\n @stocks = @stocks + new_stocks unless new_stocks.nil? || !new_stocks.length\n end\n else\n puts \"*** session id is nil\"\n end\n\n else\n @stocks = Stock.all\n end\n\n response = {\n :meta => {\n :session_id => session_id,\n :login_date => login_date\n },\n :data => {\n # :stocks => @stocks.sort_by &:date\n # :stocks => @stocks.order(:date)\n :stocks => @stocks\n }\n }\n\n respond_to do |format|\n format.html\n format.json { render json: response }\n end\n end",
"def list_all_markets\n counter = 1\n Market.all.each do |market|\n puts \"#{counter} #{market.marketname}\"\n puts \" #{market.streetaddress}, #{market.borough}\\n\"\n puts \"\\n\"\n counter +=1\n end\n puts \"\\n\"\n puts \"Enter the number next to a market to see more info\"\n puts \"Or type 'menu' to go back to main menu\"\n puts \"\\n\"\n puts \"\\n\"\n yield\n end",
"def index\n # to get list of stocks associated with the current user only\n @stocks = Stock.where(\"user_id = ?\" , current_user.id)\n end",
"def handle_list( m, params )\n if @stock.length == 0\n m.reply( \"Nothing available.\" ); return\n end\n\n m.reply \"Finite goods: #{@stock.keys.sort.join(', ')}\"\n end",
"def repo_list\n stocks = Price.where(:sec_type => 'Stock')\n @stocks = stocks.collect { |stock| [stock, stock.last_update] }\n @options = Price.where('sec_type != ?','Stock')\n @history = History.all\n end",
"def show\n @stock_disposal = StockDisposal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock_disposal }\n end\n end",
"def show_all()\n if @items.length == 0\n puts \"Shopping list is empty...\"\n else\n @items.each_index{\n |i|\n puts \"#{i+1} - #{@items[i].to_s}\"\n }\n end\n end",
"def display_shelf\n\t\tputs @books\n\tend",
"def show\n require 'finnhub_ruby'\n\n FinnhubRuby.configure do |config|\n config.api_key['token'] = ENV['finhub_api']\n end\n \n finnhub_client = FinnhubRuby::DefaultApi.new\n\n ticker = @short_call.asset\n @price = finnhub_client.quote(ticker).c\n\n @ceilings = [@short_call.ceiling1, @short_call.ceiling2, @short_call.strike]\n @ceiling_names = [\"Celing 1\", \"Celing 2\", \"Strike\"]\n end",
"def get_info_index\n @i = 0\n yahoo_client = YahooFinance::Client.new\n @tickers = Array.new\n @stocks.each do |stock|\n @tickers.push(stock.ticker_symbol)\n end\n #array of the amount change\n @index_data = yahoo_client.quotes([@tickers], [:change])\n end",
"def index\n @stock_collections = StockCollection.all\n end",
"def show\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_stock }\n end\n end",
"def show\n @barcode = @product_stock_book.list_barcode\n @prod = ProductList.where(list_barcode: @product_stock_book.list_barcode).pluck(:extproductcode)\n @old_product_stocks = ProductStockBook.where(:list_barcode => @product_stock_book.list_barcode)\n .where(\"TRUNC(stock_date) < ?\", @product_stock_book.stock_date)\n if @old_product_stocks.present?\n\n @old_product_stock = @old_product_stocks.order(\"stock_date DESC\").first\n if (@old_product_stock.stock_date.month != 3 && @old_product_stock.stock_date.day != 31)\n @prev_closing_stock = @old_product_stock.closing_qty\n\n @prev_date = @old_product_stock.stock_date\n else\n @prev_closing_stock = 0\n @prev_date = \"Not Applicable\"\n end\n\n end\n\n end",
"def show\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_stock }\n end\n end",
"def show\n @stock_entry = StockEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_entry }\n end\n end",
"def show\n @stock_item = StockItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock_item }\n end\n end",
"def stoxx\n puts \"\\n******* stoxx *******\"\n\n # == data format: yyyymmdd[hhmm[ss]]\n startDate = \"20170121\" + \"000000\"\n endDate = \"20170317\" + \"000000\"\n symbol = \"IBM\"\n remote_key = Rails.application.config.bar_chart_key\n\n remote_url = \"https://marketdata.websol.barchart.com\"\n remote_url += \"/getHistory.json?key=\" + remote_key + \"&symbol=\" + symbol\n remote_url += \"&type=daily&startDate=\" + startDate + \"&endDate=\" + endDate\n\n json_data = HTTParty.get(remote_url)\n puts \" ** json_data['results'].length: #{json_data['results'].length.inspect}\"\n @stock_data = json_data['results']\n\n end",
"def index\n @stocks = Stock.all \n \n @stocks.each do |x|\n x.price = StockQuote::Stock.quote(x.ticker).last_trade_price_only\n x.save\n end \n end",
"def index\n @stocks = Stock.all.paginate(:page => params[:page], :per_page => 15, :total_entries => 1500)\n \n drop_breadcrumb(\"股票\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stocks }\n end\n end",
"def show\n @stock_price = StockPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_price }\n end\n end",
"def show\n @purchased_stock = PurchasedStock.find(params[:id])\n # update purchased_stock's value_in_stocks\n current_value_in_stocks = 0 \n if (@purchased_stock.total_qty > 0)\n new_value = ((YahooStock::Quote.new(:stock_symbols => [@purchased_stock.stock_code]).results(:to_array).output[0][1].to_f) * 100).to_i\n end\n @purchased_stock.value_in_stocks = new_value * @purchased_stock.total_qty\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchased_stock }\n end\n end",
"def show\n @purchased_stock = PurchasedStock.find(params[:id])\n # update purchased_stock's value_in_stocks\n current_value_in_stocks = 0 \n if (@purchased_stock.total_qty > 0)\n new_value = ((YahooStock::Quote.new(:stock_symbols => [@purchased_stock.stock_code]).results(:to_array).output[0][1].to_f) * 100).to_i\n end\n @purchased_stock.value_in_stocks = new_value * @purchased_stock.total_qty\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchased_stock }\n end\n end",
"def show\n @history = ExchangeRecord.get_historical_data(@exchange_combination.base,\n @exchange_combination.target)\n end",
"def index\n @uniform_stock_receiveds = UniformStockReceived.all\n @search = UniformStockReceived.search(params[:q])\n @uniform_stock_receiveds = @search.result\n end",
"def show\n @stock_transaction = StockTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_transaction }\n end\n end",
"def info\n puts \"All stations:\"\n @stations.each.with_index(1) do |station|\n puts \"#{station.name}: \"\n station.show_trains(\"Cargo\")\n station.show_trains(\"Passenger\")\n end\n\n puts \"All routes:\"\n show_routes\n puts \"All trains:\"\n show_trains\n puts \"All wagons:\"\n show_wagons\n end",
"def stock_market; end",
"def show\n @crypto_asset = crypto_asset_data\n @stock_asset = stock_asset_data\n end",
"def show\r\n @exchange_rates = get_latest\r\n end",
"def index_old\n @stocks = Stock.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stocks }\n end\n end",
"def show\n puts @name\n puts @quantity\n end",
"def index\n @stock_results = StockResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stock_results }\n end\n end",
"def index\n @asset_stock_statuses = AssetStockStatus.all\n end",
"def stockview\n @items = Item.all.paginate(:page => params[:page], per_page: 10)\n render action: :stock\n end",
"def index\n @stocks = Stock.all\n\n # 表示用書式に編集\n @stocks.each do |stock|\n stock.code = stock.code.floor\n end\n end",
"def show\n @pair.update_ticker if @pair.ticker.nil?||@pair.ticker.old?\n end",
"def index\n @paperstocks = Paperstock.all\n end",
"def brand_stock(brand)\n \"Toy Stock: #{brand.stock}\"\n end",
"def print_client_total\n puts \"Total of all stocks held: \"\n # odd = stocks.select.each_with_index { |str, i| i.even? } \n # puts stocks.price\n # puts Hash[*stock_splits = stocks.map { |x| x.to_s.split(' ') }]\n # puts Hash[*stocks]\n end",
"def userStocks\n render :json => StockPresenter.new.getStocks(current_user.id)\n end",
"def index\n @stock_prices = StockPrice.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stock_prices }\n end\n end",
"def show_history_items_page\n \t@sold = Transaction.find_all_by_seller_id(current_user.id)\n @bought = Transaction.find_all_by_buyer_id(current_user.id)\n end",
"def index\n @product = Product.find(params[:product_id])\n @product_stocks = @product.product_stocks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_stocks }\n end\n end",
"def show\n if params[:id] == \"0\"\n @stock = Stock.where(\"code='#{params[:code]}' or gpcode='#{params[:code]}'\").first\n else\n @stock = Stock.find(params[:id])\n end\n\n if @stock && @stock.name.blank? && !params[:name].blank?\n @stock.name = params[:name].strip\n @stock.save\n end\n\n code = @stock.try(:code) || params[:code]\n if params[:refresh]\n Stock.refresh_one code\n @stock = Stock.where(\"code='#{code}' or gpcode='#{code}'\").first\n end\n\n @fin_reports = FinReport.where(fd_code:@stock.code).order(\"fd_repdate desc\").all\n dest_currency = @stock.stamp=='us' ? FinReport::CURRENCY_USD : FinReport::CURRENCY_HKD\n\n # 计算年报\n @fy_matrix = FinReport.fy_matrix @stock,@fin_reports\n fd_years = @fy_matrix[:fd_year].reverse\n\n weeklines = Weekline.where(code:@stock.code).where(\"day > '#{2.year.ago}'\").order(\"day asc\").select(\"day,close\").all\n days = weeklines.map {|r| r.day}\n prices = weeklines.map {|r| r.close}\n\n @fy_chart = {}\n if !fd_years.blank?\n series = []\n #series << [\"股价(#{dest_currency})\",prices || fy_matrix[:fd_price].reverse]\n #@fy_chart[:price] = highchart_line(\"年报-股价\",days || fd_years,series)\n\n series = []\n series << [\"收益增长率\",@fy_matrix[:up_rate_of_profit].reverse]\n series << [\"P/E\",@fy_matrix[:pe].reverse]\n @fy_chart[:up_rate_of_profit] = highchart_line(\"年报-收益增长率\",fd_years,series)\n\n series = []\n series << [\"每股收益(#{dest_currency}\",@fy_matrix[:fd_profit_base_share].reverse]\n series << [\"每股现金(#{dest_currency})\",@fy_matrix[:fd_cash_base_share].reverse]\n @fy_chart[:profit_base_share] = highchart_line(\"年报-每股收益\",fd_years,series)\n end\n\n # 计算季报\n @q_matrix = FinReport.q_matrix @stock,@fin_reports\n q_arr = @q_matrix[:fd_repdate].reverse\n\n @q_chart = {}\n if !q_arr.blank?\n series = []\n series << [\"股价(#{dest_currency})\",prices || @q_matrix[:fd_price].reverse]\n @q_chart[:price_quarter] = highchart_line(\"季报-股价\",days || q_arr,series)\n\n series = []\n series << [\"P/E\",@q_matrix[:pe].reverse]\n series << [\"收益增长率\",@q_matrix[:up_rate_of_profit].reverse]\n @q_chart[:pe_of_lastyear] = highchart_line(\"季报-PE\",q_arr,series)\n\n series = []\n series << [\"每股收益(#{dest_currency})\",@q_matrix[:fd_profit_base_share].reverse]\n series << [\"4季度累计(#{dest_currency})\",@q_matrix[:sum_profit_of_lastyear].reverse]\n @q_chart[:profit_base_share] = highchart_line(\"季报-每股收益\",q_arr,series)\n\n series = []\n series << [\"经营净额(#{dest_currency})\",@q_matrix[:operating_cash].reverse]\n series << [\"投资净额(#{dest_currency})\",@q_matrix[:invest_cash].reverse]\n series << [\"融资净额(#{dest_currency})\",@q_matrix[:loan_cash].reverse]\n series << [\"总现金(#{dest_currency})\",@q_matrix[:cash_and_deposit].reverse]\n @q_chart[:cash_base_share] = highchart_line(\"季报-现金流\",q_arr,series)\n\n series = []\n series << [\"净利润(#{dest_currency})\",@fy_matrix[:profit].reverse]\n @q_chart[:profit] = highchart_line(\"年报-净利润\",fd_years,series)\n\n series = []\n series << [\"权益回报率\",@q_matrix[:profit_of_holderright].reverse]\n series << [\"净利润增长率\",@q_matrix[:up_rate_of_pure_profit].reverse]\n @fy_chart[:profit_of_holderright] = highchart_line(\"季报-权益回报率%\",q_arr,series)\n\n series = []\n series << [\"现金净额(#{dest_currency})\",@q_matrix[:fd_cash_base_share].reverse]\n series << [\"投资活动净额(#{dest_currency})\",@q_matrix[:invest_cash_base_share].reverse]\n series << [\"融资活动净额(#{dest_currency})\",@q_matrix[:loan_cash_base_share].reverse]\n @fy_chart[:cash_invest_base_share] = highchart_line(\"季报-每股投融资现金流\",q_arr,series)\n\n series = []\n series << [\"股东权益占比\",@q_matrix[:fd_rights_rate].reverse]\n series << [\"流动负债/资产\",@q_matrix[:fd_debt_rate].reverse]\n @fy_chart[:debt_rate] = highchart_line(\"季报-权益债务\",q_arr,series)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def display_shelf\n\t\ti=0\n\t\twhile i < @books.length\n\t\t\t@books[i].display_book\n\t\t\ti+=1\n\t\tend\n\tend",
"def index\n @stockists = Stockist.all.paginate :page => params[:page], :per_page => 30\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @stockists }\n end\n end",
"def display_port\n @port.each do |x|\n puts \"Company: #{x.name}\"\n puts \"Shares: #{x.shares}\"\n puts \"Price: #{x.price}#{x.currency}\"\n puts \"To USD: $#{sprintf('%.2f', x.con)}\"\n puts \"Total: #{x.total}#{x.currency}\"\n puts\n end\n end"
] | [
"0.7258694",
"0.7220351",
"0.72107476",
"0.7159445",
"0.70638436",
"0.70638436",
"0.70638436",
"0.70638436",
"0.69971085",
"0.695509",
"0.6935364",
"0.693432",
"0.69110006",
"0.68549937",
"0.68522435",
"0.68075544",
"0.68004185",
"0.6786964",
"0.67383635",
"0.67300165",
"0.67047536",
"0.670364",
"0.66828674",
"0.66619587",
"0.6652781",
"0.6646927",
"0.6646927",
"0.6646927",
"0.6646927",
"0.66387594",
"0.6612228",
"0.6596675",
"0.65860415",
"0.6578348",
"0.6570143",
"0.6553386",
"0.65472203",
"0.654604",
"0.654179",
"0.65351236",
"0.653408",
"0.65325624",
"0.65324706",
"0.65306777",
"0.6505227",
"0.6504407",
"0.6504169",
"0.6503668",
"0.65013945",
"0.64800245",
"0.64785665",
"0.64665824",
"0.64640784",
"0.6444528",
"0.6410872",
"0.6409219",
"0.6406688",
"0.6403552",
"0.6391473",
"0.6390976",
"0.63895357",
"0.63645226",
"0.6357776",
"0.63461643",
"0.6329146",
"0.632088",
"0.6319872",
"0.6312612",
"0.6288911",
"0.6288848",
"0.6288107",
"0.6272258",
"0.6253963",
"0.6236761",
"0.6235438",
"0.6235438",
"0.62276113",
"0.62203425",
"0.6218776",
"0.62158024",
"0.6206972",
"0.62003785",
"0.61979795",
"0.6197175",
"0.6190042",
"0.6186472",
"0.6186314",
"0.618359",
"0.61826926",
"0.6179371",
"0.61792135",
"0.6170182",
"0.61699474",
"0.6160213",
"0.6156137",
"0.6124399",
"0.612375",
"0.6121508",
"0.61144876",
"0.61127937",
"0.6107936"
] | 0.0 | -1 |
View stock rating by stock ticker. | def stock_rating_by_ticker(db,stock_ticker)
info =db.execute(<<-SQL
SELECT stocks1.recommendation
FROM stocks2 JOIN stocks1
ON stocks2.recommendation_id = stocks1.id
Where stock_ticker="#{stock_ticker}";
SQL
)
puts "==========================================="
info.each do |category|
puts "
Rating : #{category['recommendation']}"
end
puts "==========================================="
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @stock = Stock.find(params[:id])\n @quote = YahooFinance::get_standard_quotes(@stock.ticker)[@stock.ticker]\n @tweets = Twitter.search('$' + @stock.ticker).results\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def ticker\n Ticker.find ticker_id\n end",
"def get_stocks\n @stocks = Stock.where(user_id: session[:current_user_id]).order(\"ticker_symbol ASC\")\n end",
"def get_shares_of_stock(ticker)\n number_of_shares = 0\n @stocks.each do |item|\n if item.ticker == ticker\n number_of_shares = item.shares\n end\n end\n number_of_shares\n end",
"def show\n set_rating\n end",
"def index\n @stock_tickers = StockTicker.all\n end",
"def ticker\n Client.current.get(\"#{resource_url}/ticker\")\n end",
"def show\n goodreads = Goodreads.new.book_by_isbn(@book.isbn)\n @rating = goodreads.average_rating.to_f\n @num_ratings = goodreads.work.ratings_count\n rescue\n @rating = 0.0\n @ratings_count = 0\n end",
"def show\n @pair.update_ticker if @pair.ticker.nil?||@pair.ticker.old?\n end",
"def show\r\n @exchange_rates = get_latest\r\n end",
"def show\n @recommendedstickers = Sticker.find(Sticker.pluck(:id).sample)\n end",
"def show\n\t\t@widget = Widget.find(params[:id])\n\t\t@rate = @widget.ratings.average :rate\n\tend",
"def set_stock_ticker\n @stock_ticker = StockTicker.find(params[:id])\n end",
"def stock_watchlist(ticker)\n YahooFinance::Client.new.quotes(ticker, watchlist_info)\n end",
"def rating #Getter\n @rating\n end",
"def stocks\n\n end",
"def get_stock(stock_ticker)\n stock = StockQuote::Stock.quote(stock_ticker)\n return stock\nend",
"def show\n @portfolio = Portfolio.find(params[:id])\n\n \n # @stocks = YahooFinance.quotes([@portfolio.stocks.group_by(&:stock_symbol)], [:ask, :bid], { raw: false } )\n # additional resources :\n # https://github.com/herval/yahoo-finance\n # https://github.com/rlazoti/yahoofinance-example/blob/master/view_stocks.rb\n\n @stocks = YahooFinance.quotes(@portfolio.stocks.group_by(&:stock_symbol), [:ask, :bid, :symbol, :last_trade_price], { raw: false } )\n \n\n @stock = Stock.new\n @stock.portfolio_id = @portfolio.id\n end",
"def show\n @net_investment = 0\n @stock = Stock.find(params[:id])\n @investments = Investment.where(stock_id: @stock.id).limit(10)\n @my_investments = Investment.where(stock_id: @stock.id, member_id: current_member.id)\n @my_investments.each do |investment|\n @net_investment += investment.share_change\n end \n @stock.price = StockQuote::Stock.quote(@stock.ticker).last_trade_price_only\n @stock.save\n require 'net/http'\n\n begin\n @url = 'http://chart.finance.yahoo.com/z?s=%{ticker}' % {ticker: @stock.ticker}\n @resp = Net::HTTP.get_response(URI.parse(@url)) # get_response takes an URI object\n rescue\n print \"Connection error.\"\n end \n end",
"def show\n @stock = Stock.find(params[:id])\n @buyers = @stock.buyers\n if current_user\n @current_favorite = current_user.favorites.find_by(stock_id: @stock.id)\n end\n end",
"def index\n @engine_ratings = EngineRating.all\n end",
"def show_rating(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V1/ShowRating\", Yahoo::Api.merge(opts))\r\n end",
"def rating\r\n\t\t@rating\r\n\tend",
"def show\n @sticker = Sticker.find(params[:id])\n end",
"def rating\n @rating\n end",
"def show\n if Stock.check_valid(params[:symbol])\n if Stock.not_exists?(params[:symbol])\n create\n end\n $stock = Stock.find(params[:symbol])\n # Gather and check chart data\n @input = Stock.get_overview(params)\n if @input === 404\n not_found\n else\n @data = YahooFinance.quotes([params[:symbol]], [:name, :last_trade_price, :ask, :bid, :open, :close, :volume, :market_capitalization, :dividend_yield, :dividend_per_share, :change, :change_in_percent, :last_trade_date, :stock_exchange])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: $stock }\n end\n end\n else\n not_found\n end\n end",
"def index\n @runs = @stocks_util.user_runs\n @selected_run = @stocks_util.selected_run\n set_stocks\n @stocks_util.enrich_stock_from_yahoo(@stocks) if @stocks.size != 0\n end",
"def share_prices\n stock_market.market.first\n end",
"def show\n @trades = @stock.trades\n @totalrevenue = @stock.trades.where(:action => \"SELL\").sum('shares*price')\n @totalcost = @stock.trades.where(:action => \"BUY\").sum('shares*price')\n @overall = @totalrevenue - @totalcost\n \n #Trade.where(:action => \"BUY\", :stock_id => 11).sum(shares*price)\n end",
"def show\n @current_book = Book.find(@book.id)\n @rating = @book.ratings.new\n end",
"def show\n @stock = Stock.find(params[:id])\n @items = @stock.item\n @stock_audits = @stock.stock_audit\n end",
"def index\n @ratings = Rating.all\n end",
"def index\n @ratings = Rating.all\n end",
"def index\n @ratings = Rating.all\n end",
"def show\n @purchased_stock = PurchasedStock.find(params[:id])\n # update purchased_stock's value_in_stocks\n current_value_in_stocks = 0 \n if (@purchased_stock.total_qty > 0)\n new_value = ((YahooStock::Quote.new(:stock_symbols => [@purchased_stock.stock_code]).results(:to_array).output[0][1].to_f) * 100).to_i\n end\n @purchased_stock.value_in_stocks = new_value * @purchased_stock.total_qty\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchased_stock }\n end\n end",
"def show\n @purchased_stock = PurchasedStock.find(params[:id])\n # update purchased_stock's value_in_stocks\n current_value_in_stocks = 0 \n if (@purchased_stock.total_qty > 0)\n new_value = ((YahooStock::Quote.new(:stock_symbols => [@purchased_stock.stock_code]).results(:to_array).output[0][1].to_f) * 100).to_i\n end\n @purchased_stock.value_in_stocks = new_value * @purchased_stock.total_qty\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchased_stock }\n end\n end",
"def index\n render :layout => \"user\"\n #Stock.test 'SK6U.SI'\n #Stock.searchSymbol 'starhub'\n #Stock.historicalData 'CC3.SI','2013-07-21','2013-07-25'\n end",
"def index\n @stocks = Stock.all \n \n @stocks.each do |x|\n x.price = StockQuote::Stock.quote(x.ticker).last_trade_price_only\n x.save\n end \n end",
"def ratings_ranking(*args)\n @client.get \"#{@path}/ratings/ranking\", Hash[*args]\n end",
"def show\n @ticker = Ticker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticker }\n end\n end",
"def ticker\n ticker = get('/api/1/BTCUSD/ticker')\n Ticker.instance.buy = value_currency ticker['buy']\n Ticker.instance.high = value_currency ticker['high']\n Ticker.instance.price = value_currency ticker['last_all']\n Ticker.instance.low = value_currency ticker['low']\n Ticker.instance.sell = value_currency ticker['sell']\n Ticker.instance.volume = value_bitcoin ticker['vol']\n Ticker.instance.vwap = value_currency ticker['vwap']\n Ticker.instance.avg = value_currency ticker['avg']\n Ticker.instance.last_local = value_currency ticker['last_local']\n Ticker.instance\n end",
"def raw_stock_data_for_ticker(ticker)\n all_ticker_data = raw_stock_data.select { |r| r[0] == ticker }\n end",
"def rating\n rating_calculator.rate(raters)\n end",
"def index_ratings\n @rating = Rating.all\n end",
"def rating\n response[\"rating\"]\n end",
"def rating\n cached_rating\n end",
"def index\n @stock_prices = StockPrice.all\n end",
"def show\n @overall = overall_rating\n end",
"def index\n \t@stocks = Stock.all\n \t#@stock = current_user.stocks\n end",
"def set_ticker\n @ticker = Ticker.find(params[:id])\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @finale_ratings = FinaleRating.all\n end",
"def book_ticker(options)\n request :public, :get, :bookTicker, options\n end",
"def show\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating_alt }\n end\n end",
"def index\n @rates = Rate.all\n end",
"def index\n @rates = Rate.all\n end",
"def index\n @rates = Rate.all\n end",
"def index\n @rates = Rate.all\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rating }\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rating }\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def index\n @tickers = TickerSymbol.all\n end",
"def show\n # Update the view counter if the viewer has a unique session hash\n impressionist(@post, nil, { unique: [:session_hash] })\n\n # Checks if the current trader is allowed to buy the item in this post\n if current_trader\n @in_buy_cat = ApprovedBuyCat.where(trader_id: current_trader.id).where(status: \"1\").exists?(:buy_cat_id => @post.subcategory_id)\n end\n @bid = Bid.new(post_id: @post.id)\n\n # Get the rating for the post\n ratings = Trade.includes(:post).where(posts: { trader_id: @post.trader_id } ).collect{|m| m.rating.to_i}.compact\n length = ratings.collect{|m| if m != 0\n m\n end}.compact.length\n\n @rating = ratings.sum.to_f / (length == 0? 1 : length)\n if @rating == nil\n @rating = 0\n end\n\n end",
"def show\n # @todo comment this out and replace with proper user 'deleted' flag\n if User.where(id: @book.user_id.to_s.to_i).exists?(conditions = :none)\n @book_user = User.find(@book.user_id)\n else\n @book_user = User.find_by(username: 'removedUser')\n end\n @rating = Rate.where(rateable_id: @book.id)\n unless @rating.empty?\n @sum = 0\n @rating.each do |rate|\n @sum += rate.stars_num\n end\n @final_rating = @sum / @rating.length\n @remaining_stars = 5 - @final_rating\n end\n end",
"def index\n # to get list of stocks associated with the current user only\n @stocks = Stock.where(\"user_id = ?\" , current_user.id)\n end",
"def index\n @rating = Rating.all\n # This is where the list of all the ratings of the stylists will be controlled\n end",
"def show\n @stock_price = StockPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_price }\n end\n end",
"def saw\n @rates = Rate.all\n end",
"def show\n @fooddrinks = Fooddrink.all\n Fooddrink.update_avg_qty(@fooddrink)\n @recommends = Fooddrink.where(user_id: @fooddrink.user_id).where.not(id: @fooddrink.id).order(created_at: :desc)\n end",
"def stock_price(ticker)\n\tstock_price = StockQuote::Stock.quote(ticker).last_trade_price_only\n\t\"The price of #{ticker} is $#{stock_price}\"\nend",
"def index\n @album_ratings = AlbumRating.all\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def view_my_stocks(prompt, user)\n # groups stocks owned by specified user and sums up the quantity per stock symbol\n # total = 0 \n array = []\n stocks_qty = self.stocks.group(:stock_symbol).sum(:stock_qty)\n\n stocks_qty.each do |key, value|\n current_price = find_stock(key).current_price\n yesterdays_price = find_stock(key).yesterdays_price\n differential = ((yesterdays_price - current_price).abs / yesterdays_price)*100\n \n differential_checker(current_price, yesterdays_price, key, value, array,differential)\n end\n\n table = TTY::Table.new header: ['Stock Symbol', 'Quantity', 'Yesterdays Share Price', 'Todays Share Price', '% Change'], rows: array\n puts table.render(:unicode)\n end",
"def index\n @dish_ratings = DishRating.all\n end",
"def show\n @rating = Rating.new\n @rating.beer = @beer\n end",
"def rating\n rating_id.get_object.name\n end",
"def livequote(ticker)\n\tfunction = 'TIME_SERIES_INTRADAY'\n\tsymbol = ticker\n\tinterval = '1min' \n\tapikey = '4528' #provided at registration\n\turl = \"http://www.alphavantage.co/query?function=#{function}&symbol=#{symbol}&interval=#{interval}&apikey=#{apikey}\"\n\turi = URI(url)\n\tresponse = Net::HTTP.get(uri)\n\tinfo = JSON.parse(response)\n\treturn info.values[1].values[0].values[3].to_f.round(2)\nend",
"def stock_market; end",
"def show\n authorize @workshop\n values = @workshop.ratings.pluck(:value)\n @average_rating = values.inject(&:+).to_f / values.size\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n @dev = User.find(params[:id])\n @ratings = RatingService::get_ratings(@dev)\n end",
"def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end",
"def show\n @kifu = Kifu.find(params[:id])\n if @kifu.view\n @kifu.view += 1\n else\n @kifu.view = 1\n end\n @kifu.save\n @rate = nil\n @favorite = nil\n\n if @kifu.rates.length >= 1\n sum = 0.0\n @kifu.rates.each do |r|\n sum += r.rate\n end\n # 小数点第1位で四捨五入\n @rate = ((sum / @kifu.rates.length) * 10).round / 10.0\n end\n\n # 同じものは1つしかないはず。。\n @favorites = Favorite.find(:all, :conditions => ['user_id = ? and kifu_id = ?', current_user.id, params[:id]])\n @favorite = @favorites[0]\n \n # @kifu, @rate, @favorite\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kifu }\n end\n end",
"def get_summary_of_10ks(ticker) \n # check whether the summary for this ticker has already retrieved, in the cache\n if @summary_cache.exists?(ticker)\n return @summary_cache.lookup(ticker)\n end\n\n # reports for this ticker wasn't in the cache, so retrieve them\n summary = get_summary_of_10ks_from_scratch(ticker)\n\n # insert this set of reports into the cache\n if !summary.nil?\n @summary_cache.insert(ticker, summary)\n end\n\n return summary\n end",
"def show\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n render json: rating\r\n end",
"def stock_price(ticker)\r\n\tstock_price = StockQuote::Stock.quote(ticker).last_trade_price_only\r\n\t\"The price of #{ticker} is $#{stock_price}\"\r\nend",
"def rating\n return @rating\n end",
"def rating\n r = Rating.create_from_database(rating_id.to_i)\n r.rating\n end",
"def index\n # @favorite_stocks = FavoriteStock.all\n @favorite_stocks = FavoriteStock.where(:user_id => current_user)\n end",
"def show\n\t\tyahoo_client = YahooFinance::Client.new\n\t\t@data = yahoo_client.quotes([\"AER\", \"AYR\", \"FLY\", \"AL\", \"ACY\", \"WLFC\"], [:symbol, :name, :ask, :change, :change_in_percent, :market_capitalization])\n\tend",
"def index\n @tickers = Ticker.all\n end",
"def index\n @channel_rates = ChannelRate.all\n end",
"def set_stock\n if params[:id]\n @stock = Stock.find(params[:id])\n elsif params[:ticker_symbol]\n @stock = Stock.find_by_ticker_symbol(params[:ticker_symbol])\n end\n @stock.update_price if @stock and Time.now - @stock.updated_at > 1.minute \n end"
] | [
"0.631439",
"0.6221746",
"0.61881375",
"0.60670185",
"0.6023123",
"0.6011484",
"0.6006157",
"0.59581685",
"0.5951628",
"0.5937563",
"0.59231937",
"0.5920202",
"0.5919826",
"0.5901018",
"0.5854697",
"0.5853447",
"0.5838837",
"0.5830437",
"0.58225834",
"0.58210045",
"0.58164966",
"0.581564",
"0.57708883",
"0.5748399",
"0.57348186",
"0.57078105",
"0.57070786",
"0.57009834",
"0.5695981",
"0.5681287",
"0.56718564",
"0.56696934",
"0.56696934",
"0.56696934",
"0.56311965",
"0.56311965",
"0.5601268",
"0.5594099",
"0.5589295",
"0.556984",
"0.5568384",
"0.5563777",
"0.55613077",
"0.55584043",
"0.55215245",
"0.5518113",
"0.5516311",
"0.54926735",
"0.54923034",
"0.54828274",
"0.547423",
"0.547423",
"0.547423",
"0.547423",
"0.5458368",
"0.54577035",
"0.5457001",
"0.54505295",
"0.54505295",
"0.54505295",
"0.54505295",
"0.5437701",
"0.54376674",
"0.54325163",
"0.54325163",
"0.54325163",
"0.5423113",
"0.54211515",
"0.5420644",
"0.5409691",
"0.53994894",
"0.5397086",
"0.5390041",
"0.5365495",
"0.5361363",
"0.53537637",
"0.53474164",
"0.53474164",
"0.53474164",
"0.53474164",
"0.53447247",
"0.53430307",
"0.5336336",
"0.5331456",
"0.53313035",
"0.53236693",
"0.53170437",
"0.5313859",
"0.53051573",
"0.53042996",
"0.52921236",
"0.5291307",
"0.5287664",
"0.52868795",
"0.52858627",
"0.5284746",
"0.52843547",
"0.5279039",
"0.5275589",
"0.52740395"
] | 0.60575294 | 4 |
view stocks by certain price | def stock_by_price(db,price)
info =db.execute(<<-SQL
SELECT stocks2.stock_ticker, stocks2.stock_price FROM stocks2 Where stock_price >"#{price}";
SQL
)
puts "These follwing stocks are above $#{price}."
puts "==========================================="
info.each do |category|
puts "
Stock Ticker : #{category['stock_ticker']}
Stock Price : #{category['stock_price']}"
end
puts "==========================================="
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @stock_prices = StockPrice.all\n end",
"def index\n @prices = Price.all\n end",
"def index\n @prices = Price.all\n end",
"def show\n @portfolio = Portfolio.find(params[:id])\n\n \n # @stocks = YahooFinance.quotes([@portfolio.stocks.group_by(&:stock_symbol)], [:ask, :bid], { raw: false } )\n # additional resources :\n # https://github.com/herval/yahoo-finance\n # https://github.com/rlazoti/yahoofinance-example/blob/master/view_stocks.rb\n\n @stocks = YahooFinance.quotes(@portfolio.stocks.group_by(&:stock_symbol), [:ask, :bid, :symbol, :last_trade_price], { raw: false } )\n \n\n @stock = Stock.new\n @stock.portfolio_id = @portfolio.id\n end",
"def show\n @trades = @stock.trades\n @totalrevenue = @stock.trades.where(:action => \"SELL\").sum('shares*price')\n @totalcost = @stock.trades.where(:action => \"BUY\").sum('shares*price')\n @overall = @totalrevenue - @totalcost\n \n #Trade.where(:action => \"BUY\", :stock_id => 11).sum(shares*price)\n end",
"def index\n # @prices = Price.where(name:['木瓜(元/公斤)','蘿蔔(元/公斤)','香菇(太空包)乾(元/公斤)']).order(:name)\n @prices = Price.order(:name)\n #get_json\n end",
"def search_by_price(database, price)\n\tsearch_result = database.execute(<<-SQL \n\t\t\tSELECT * FROM restaurants WHERE price<= \"#{price}\" ORDER BY price\n\t\tSQL\n\t\t) \n\tprint(search_result, \"price\")\nend",
"def stocks\n\n end",
"def get_stocks\n @stocks = Stock.where(user_id: session[:current_user_id]).order(\"ticker_symbol ASC\")\n end",
"def index\n # Apply the search control filter.\n # Note: `like` method here is not built-in Rails scope. You need to define it by yourself.\n # prices_scope = Prices.filter(params[:filter]) if params[:filter]\n prices_scope = Price.titlesearch(params[:filter])\n # prices_scope = Price.test\n #prices_scope = Price.all\n smart_listing_create :prices,prices_scope, partial: \"prices/list\",\n default_sort: {title: \"asc\"}\n\n #@prices = Price.all\n#end\n # else\n # @prices = Price.all\n end",
"def index\n @prices = @prices.includes(:good).paginate( :page => params[:page])\n end",
"def index\n @credit_point_packs = CreditPointPack.order_by_price\n end",
"def show\n @stock_price = StockPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_price }\n end\n end",
"def all_prices\n request :public, :get, :price\n end",
"def index\n @list_prices = ListPrice.all\n end",
"def index\n @product_prices = ProductPrice.where(user_id: current_user.user_id).search(params[:search]).paginate(page: params[:page], per_page: 50).order('updated_at DESC')\n end",
"def index\n @stocks = Stock.all \n \n @stocks.each do |x|\n x.price = StockQuote::Stock.quote(x.ticker).last_trade_price_only\n x.save\n end \n end",
"def stockview\n @items = Item.all.paginate(:page => params[:page], per_page: 10)\n render action: :stock\n end",
"def index\r\n @base_prices = BasePrice.all\r\n end",
"def share_prices\n stock_market.market.first\n end",
"def index\n @stag_prices = StagPrice.all\n end",
"def prices (currency='TWD')\n get '/prices/' + currency\n end",
"def index\n @credits_offers = CreditsOffer.order(:price).all\n end",
"def price\n \n end",
"def index\n @stock_products = StockProduct.all\n end",
"def index\n @prices = Price.where(:category => \"Pielęgnacja dłoni\")\n @prices_feet = Price.where(:category => \"Pielęgnacja stóp\")\n @prices_face = Price.where(:category => \"Pielęgnacja twarzy\")\n @prices_cp = Price.where(:category => \"Zabiegi firmowe (Rejuvi)\")\n @prices_beauty = Price.where(:category => \"Zabiegi upiększające\")\n @prices_make_up = Price.where(:category => \"Makijaż okolicznościowy\")\n @prices_depilation = Price.where(:category => \"Depilacja woskiem\")\n @prices_massage = Price.where(:category => \"Masaż\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prices }\n end\n end",
"def index\n @admin_prices = Price.all\n end",
"def index\n @housingtypeprices = Housingtypeprice.all\n end",
"def index\n @auto_parts = AutoPart.all.order(:price)\n end",
"def prices(id, where)\n Price.find(:all, :conditions=>\"dish_id=#{id} and freezer='#{where}'\")\n end",
"def sell_price\r\n price\r\n end",
"def index\n @price_quotes = PriceQuote.all\n end",
"def index\n if params[\"type\"] == \"NSE\"\n @stocks = Stock.where(type: \"NSE\")\n elsif params[\"type\"] == \"BSE\"\n @stocks = Stock.where(type: \"BSE\")\n else\n @stocks = Stock.all\n end\n end",
"def index\n @core_stock_products = Core::StockProduct.find_mine(params).paginate(page: params[:page])\n end",
"def show\n @stock = Stock.find(params[:id])\n @items = @stock.item\n @stock_audits = @stock.stock_audit\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @economy_prices = EconomyPrice.all\n end",
"def price\n @sibit.price\n end",
"def index\n \t@items = Item\n \t@items = @items.where(\" price >=?\",params[:price_from]) if params[:price_from]\n \t@items = @items.where(\"created_at >= ?\",1.day.ago) if params[:today]\n \t@items = @items.where(\"votes_count >=?\",params[:votes_from]) if params[:votes_from]\n \t@items = @items.order(\"votes_count DESC\",\"price\")\n\n end",
"def show\n if Stock.check_valid(params[:symbol])\n if Stock.not_exists?(params[:symbol])\n create\n end\n $stock = Stock.find(params[:symbol])\n # Gather and check chart data\n @input = Stock.get_overview(params)\n if @input === 404\n not_found\n else\n @data = YahooFinance.quotes([params[:symbol]], [:name, :last_trade_price, :ask, :bid, :open, :close, :volume, :market_capitalization, :dividend_yield, :dividend_per_share, :change, :change_in_percent, :last_trade_date, :stock_exchange])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: $stock }\n end\n end\n else\n not_found\n end\n end",
"def index\n @prices = authorized_scope(venue.prices).includes(:courts)\n if params[:day].present?\n day = params[:day].to_s\n raise WrongActionError unless Price::WEEKDAYS.map(&:to_s).include?(day)\n @prices = @prices.where(\"#{day}\": true)\n end\n\n # TODO: filter ones by sport, so it doesn't render golf prices when looking for tennis\n\n @prices = @prices.uniq\n end",
"def index\n @products = Product.all\n \n Product.create(:title => \"Buritto\", :description => \"Dang this is good!\", :price => 8.99, :stock_quantity => 4)\n \n Product.create(:title => \"Taco\", :description => \"It's like a nacho sandwich!\", :price => 3.95, :stock_quantity => 10) \n \n Product.create(:title => \"Diablo 3\", :description => \"Nourishment for the soul.\", :price => 19.99, :stock_quantity => 667) \n \n Product.create(:title => \"Chicken\", :description => \"Staple for any nuclear family dinner\", :price => 6.99, :stock_quantity => 13) \n \n Product.create(:title => \"Steak\", :description => \"If they ask for it well done, we kindly but firmly ask them to leave\", :price => 12.74, :stock_quantity => 36)\n \n end",
"def index\n @search = current_user.company_prices.search(params[:search])\n @company_prices = @search.page(params[:page]).per_page(21).order(\"created_at DESC\")\n end",
"def stock_market; end",
"def set_stock_price\n @stock_price = StockPrice.find(params[:id])\n end",
"def index\n @stocking_products = StockingProduct.all\n end",
"def index\n @vehicle_prices = VehiclePrice.all\n end",
"def index\n read_exchange_rate\n @conditions = Array.new\n\n @conditions << \"sold_at BETWEEN '#{Date.new(params[:sold_at][\"sold_at(1i)\"].to_i, params[:sold_at][\"sold_at(2i)\"].to_i, 1)}' AND '#{Date.new(params[:sold_at][\"sold_at(1i)\"].to_i, params[:sold_at][\"sold_at(2i)\"].to_i, -1)}'\" if params[:sold_at]\n @conditions << \"price_original >= #{params[:low_price]}\" unless params[:low_price].blank?\n @conditions << \"price_original <= #{params[:high_price]}\" unless params[:high_price].blank?\n @conditions << \"products.category = '#{params[:category]}'\" unless params[:category].blank?\n\n if params[:manufacturer]\n @conditions << \"products.manufacturer = '#{params[:manufacturer]}'\"\n end\n\n @orders = Order.joins(:product).where(@conditions.join(\" AND \")).order(\"sold_at DESC\").all # .page params[:page]\n @sales = @orders.sum(:price_original)\n @average_exchange_rate = (@orders.sum(:price_yen) / @sales).round(2)\n @cost = @orders.sum(:cost)\n @shipping_cost = @orders.sum(:shipping_cost)\n @ebay_cost = @sales * 0.1\n @paypal_cost = (@sales * 0.039 + 0.3 * @orders.size)\n @profit = @orders.sum(:profit)\n\n @products_hash = Product.where([\"id IN (?)\", @orders.pluck(:product_id)]).inject(Hash.new) {|h, p| h[p.id] = p; h}\n end",
"def index\n @cryptocurrency_prices = CryptocurrencyPrice.all\n end",
"def index\n @event_prices = EventPrice.all\n end",
"def index\n @stocks = Stock.all\n @totalrevenue = Trade.where(:action => \"SELL\").sum('shares*price')\n @totalcost = Trade.where(:action => \"BUY\").sum('shares*price')\n @overall = @totalrevenue - @totalcost\n\n end",
"def show\n @company_price = CompanyPrice.find(params[:id])\n @company_prices = @company_price.user.company_prices.order(\"created_at DESC\") \n @other_company_prices = CompanyPrice.where(\"category1_id = ? AND user_id != ?\", @company_price.category1_id, @company_price.user_id).order(\"created_at DESC\").limit(6)\n @new_company_prices = CompanyPrice.order(\"created_at DESC\").limit(8)\n end",
"def index\n @fuel_prices = FuelPrice.all\n end",
"def index\n render :layout => \"user\"\n #Stock.test 'SK6U.SI'\n #Stock.searchSymbol 'starhub'\n #Stock.historicalData 'CC3.SI','2013-07-21','2013-07-25'\n end",
"def show\n @search = Search.find(params[:id])\n @search.search_for_statement\n\n @stock = Stock.find_by_ticker(@search.ticker)\n @purchase = Purchase.new\n @payment_plan = PaymentPlan.find_by_name(\"1.99\")\n end",
"def asks_below(price)\n\t\torders.where(\"order_type = 'sell' AND price < '#{price}'\").order(:price)\n\tend",
"def show\n @stock = Stock.find(params[:id])\n @quote = YahooFinance::get_standard_quotes(@stock.ticker)[@stock.ticker]\n @tweets = Twitter.search('$' + @stock.ticker).results\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def price_at(date)\n found_stock = @stocks.select { |stock| stock.date == date }.first\n return nil if found_stock.nil?\n found_stock.opening unless found_stock.opening.nil?\n found_stock.closing if found_stock.opening.nil?\n end",
"def show\n @opNum = 0\n @profit = 0 - @keg.price\n if @keg.endDate\n operations = Operation.where(\"drink_id = ?\", @keg.drink_id).where(\"date > ?\", @keg.startDate).where(\"date < ?\", @keg.endDate)\n operations.each do |op|\n @opNum = @opNum + op.numberDrink.to_s.to_d\n @profit = @profit - op.sum\n end\n else\n operations = Operation.where(\"drink_id = ?\", @keg.drink_id).where(\"date > ?\", @keg.startDate)\n operations.each do |op|\n @opNum = @opNum + op.numberDrink.to_s.to_d\n @profit = @profit - op.sum\n end\n end\n end",
"def index\n @price = Price.find(params[:price_id])\n @taryphs = @price.taryph.all\n\n end",
"def show\n @net_investment = 0\n @stock = Stock.find(params[:id])\n @investments = Investment.where(stock_id: @stock.id).limit(10)\n @my_investments = Investment.where(stock_id: @stock.id, member_id: current_member.id)\n @my_investments.each do |investment|\n @net_investment += investment.share_change\n end \n @stock.price = StockQuote::Stock.quote(@stock.ticker).last_trade_price_only\n @stock.save\n require 'net/http'\n\n begin\n @url = 'http://chart.finance.yahoo.com/z?s=%{ticker}' % {ticker: @stock.ticker}\n @resp = Net::HTTP.get_response(URI.parse(@url)) # get_response takes an URI object\n rescue\n print \"Connection error.\"\n end \n end",
"def get_all_price\n page = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\")) # ça ouvre la page web coinmarket et enregistre dans la variable page \n noko_o = page.xpath(\"//tbody/tr/td/a[@class='price']\") #je prends la page web coinmarket de la variable page et je lui extrait les prix de chaque currencies et je les stock dans la variable noko_o\n currencies_price = noko_o.map { |n| n.text.delete_prefix('$').to_f} # c'est un array qui contient la variable noko_o dont on a extrait les prix , dont on retire le symbole $ \n puts currencies_price # affiche mon tableau currencies sans le symbole $ \n\treturn currencies_price #je récupère tous les prix des monnaies \nend",
"def view_my_stocks(prompt, user)\n # groups stocks owned by specified user and sums up the quantity per stock symbol\n # total = 0 \n array = []\n stocks_qty = self.stocks.group(:stock_symbol).sum(:stock_qty)\n\n stocks_qty.each do |key, value|\n current_price = find_stock(key).current_price\n yesterdays_price = find_stock(key).yesterdays_price\n differential = ((yesterdays_price - current_price).abs / yesterdays_price)*100\n \n differential_checker(current_price, yesterdays_price, key, value, array,differential)\n end\n\n table = TTY::Table.new header: ['Stock Symbol', 'Quantity', 'Yesterdays Share Price', 'Todays Share Price', '% Change'], rows: array\n puts table.render(:unicode)\n end",
"def stockquote(stock)\n url = URI(\"https://apidojo-yahoo-finance-v1.p.rapidapi.com/market/v2/get-quotes?region=US&symbols=#{@stock}\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n request = Net::HTTP::Get.new(url)\n request[\"x-rapidapi-key\"] = ENV['X_RAPIDAPI_KEY']\n request[\"x-rapidapi-host\"] = 'apidojo-yahoo-finance-v1.p.rapidapi.com'\n \n response = http.request(request)\n quoteResponse = JSON.parse(response.read_body)['quoteResponse']\n result = quoteResponse['result']\n @zero = result[0]\n puts \"Symbol = #{@zero['symbol']}, Exchange = #{@zero['fullExchangeName']}, Bid = #{@zero['bid']}, Ask = #{@zero['ask']}\"\n\n return \"<div class =col>\n <h2>Symbol=<a>#{@zero['symbol']}</a></h2>\n <h4>Exchange=<a>#{@zero['fullExchangeName']}</a></h4>\n <h4>Bid=<a>#{@zero['bid']}</a></h4>\n <h4>Ask=<a>#{@zero['ask']}</a></h4>\n </div>\"\n end",
"def sales_price\n Dowstore.priceMarkup(commodity.price,0,2)\n end",
"def price\n closing_price = StockQuote::Stock.quote(ticker).close\n return \"#{closing_price} (Closing)\" if closing_price\n \n opening_price = StockQuote::Stock.quote(ticker).open\n return \"#{opening_price} (Opening)\" if opening_price\n 'Unavailable' #retrun unavailable to neither closing price or opending price is available\n end",
"def show\n @records = Record.all.where(stock_id: @stock.id).order(date: :desc).limit(5)\n end",
"def show\n @prices_history = combined_price_history\n @day_of_week = weekly_price_history\n @month_of_year = monthly_price_history\n end",
"def show\n @breadcrumb = 'read'\n @product = $product\n @supplier = $supplier\n @purchase_price = PurchasePrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_price }\n end\n end",
"def price\n @price\n end",
"def price\n @price\n end",
"def index\n @sells = Sell.where user_id: current_user.id\n \n end",
"def pricing\n request('pricing', :get)\n end",
"def index\n # to get list of stocks associated with the current user only\n @stocks = Stock.where(\"user_id = ?\" , current_user.id)\n end",
"def index\n @stock_tickers = StockTicker.all\n end",
"def price\n \n end",
"def display_price\n\t variations = self.variations.find(:all, :order => \"price ASC\")\n\t if variations.size == 0\n\t return self.price\n\t else\n\t low_price = variations[0].price\n\t high_price = variations[variations.size-1].price\n if low_price == high_price\n return low_price\n else\n return [low_price, high_price]\n end\n end\n end",
"def index\n @dji_prices = DjiPrice.all.order(\"date desc\").paginate(:page => params[:page], :per_page => 15)\n end",
"def show\n @liquor_license = LiquorLicense.find(params[:id])\n @liquor_license_auctions = LiquorLicenseAuction.where(:liquor_license_id => params[:id]).find :all, :order => 'price desc'\n logger.info @liquor_license_auctions\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @liquor_license }\n end\n end",
"def market\n end",
"def get_prices\n\n pricing_column = col_right.div(:class, 'a-span7').divs(:class, 'a-row')\n num_rows = pricing_column.size\n i = 0\n\n while i < num_rows do\n begin\n\n column_title = pricing_column[i].h3.inner_html ## \"Kindle Edition\"\n if column_title == 'Kindle Edition'\n @kindle_price = pricing_column[i + 1].span(:class, 's-price').inner_html\n end\n\n if column_title == 'Paperback'\n @paperback_price = pricing_column[i + 1].span(:class, 's-price').inner_html\n end\n\n rescue Watir::Exception::UnknownObjectException\n # Just do nothing -- we'll advance and try again\n end\n\n i += 1\n end\n end",
"def index\n session[:product] = params[:product] if params[:product]\n @stocks = Stock.product session[:product]\n default_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stocks }\n end\n end",
"def show\n @cart = Cart.find_by(buyer_id:current_buyer.id)\n @entries = CartCarry.where(cart_id:@cart.id)\n @TotalPrice = 0\n @entries.each do |item|\n @TotalPrice += Product.find_by(id:item.product_id).currentPrice * item.quantity\n end\n end",
"def stocked\n @articles = Article.stocked_by(current_user, params[:page])\n end",
"def stock_price(ticker)\r\n\tstock_price = StockQuote::Stock.quote(ticker).last_trade_price_only\r\n\t\"The price of #{ticker} is $#{stock_price}\"\r\nend",
"def stock_price(ticker)\n\tstock_price = StockQuote::Stock.quote(ticker).last_trade_price_only\n\t\"The price of #{ticker} is $#{stock_price}\"\nend",
"def index\n if original_url\n if original_url == \"desc\"\n @products = Product.search(params).paginate(:page => params[:page], :per_page => 10).order('price DESC')\n elsif original_url == \"asc\"\n @products = Product.search(params).paginate(:page => params[:page], :per_page => 10).order('price ASC')\n elsif original_url == \"new\"\n @products = Product.search(params).paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n elsif original_url == \"discount\"\n @products = Product.search(params).paginate(:page => params[:page], :per_page => 10).order('discount DESC')\n elsif original_url == \"down100\"\n @products = Product.where(\"price < 100000\").search(params).paginate(:page => params[:page], :per_page => 10)\n elsif original_url == \"100-200\"\n @products = Product.where(\"price > 100000\").where(\"price < 200000\").search(params).paginate(:page => params[:page], :per_page => 10)\n elsif original_url == \"200-300\"\n @products = Product.where(\"price > 200000\").where(\"price < 300000\").search(params).paginate(:page => params[:page], :per_page => 10)\n elsif original_url == \"300-500\"\n @products = Product.where(\"price > 300000\").where(\"price < 500000\").search(params).paginate(:page => params[:page], :per_page => 10)\n elsif original_url == \"up500\"\n @products = Product.where(\"price > 500000\").search(params).paginate(:page => params[:page], :per_page => 10)\n else\n @products = Product.search(params).paginate(:page => params[:page], :per_page => 10)\n end\n else\n @products = Product.search(params).paginate(:page => params[:page], :per_page => 10)\n end\n end",
"def index\r\n @kilometers_prices = KilometersPrice.all\r\n end",
"def index\n\n @current_prices = []\n @properties = current_user.properties\n\n\n\n @properties.each do |stock|\n url = 'https://www.google.com/finance/info?q=NYSE%3A' + stock.symbol.to_s\n uri = URI(url)\n response = Net::HTTP.get(uri)\n json = JSON.parse(response[5..(response.length - 3)])\n current_price = json[\"l\"].to_f\n @current_prices.push(current_price)\n end\n end",
"def filter_overResistanceSoleXXIVOre\r\n @overResistanceStocksSolexxivore = @@SJA.select(\"stocks.isin, name, last_price, xxivore_resistance\").where(\"xxivore_resistance > 0 AND last_price > xxivore_resistance\").order(:name) \r\n render json: @overResistanceStocksSolexxivore\r\n end",
"def product_stock(toy)\n \"Toy Stock: #{toy.stock}\"\n end",
"def set_stock\n if params[:id]\n @stock = Stock.find(params[:id])\n elsif params[:ticker_symbol]\n @stock = Stock.find_by_ticker_symbol(params[:ticker_symbol])\n end\n @stock.update_price if @stock and Time.now - @stock.updated_at > 1.minute \n end",
"def find(symbol)\n response = Request.new(\"/stock/#{symbol}/quote\").get\n Models::Quote.new(response.body)\n end",
"def index\n @stock_prices = StockPrice.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stock_prices }\n end\n end",
"def prices\n Excursion.all.each do |excursion|\n excursion.price \n end\n end",
"def show\n\n @target = { :lng => cookies[:lng].to_f, :lat => cookies[:lat].to_f}\n\n @services = Service.find_by(slug: params[:id]).salons.joins(:prices).distinct\n @salons = @services.reorder(\"prices.price #{params[:sort] == 'skuplji' ? 'DESC' : 'ASC'}\")\n\n if params[:sort] == 'blizi' or params[:sort] == 'dalji'\n @salons = @services.sort { |l,r| l.distance_to(@target) <=> r.distance_to(@target) }\n end\n\n if params[:sort] == 'dalji'\n @salons = @salons.reverse\n end\n\n @number_of_results = @salons.count\n @salons = @salons.paginate(:page => params[:strana])\n\n\n\n end",
"def special_prices\n prices\n end"
] | [
"0.69174224",
"0.66827065",
"0.66827065",
"0.6642413",
"0.6596903",
"0.65562946",
"0.6541607",
"0.6524333",
"0.6453875",
"0.6356635",
"0.6355919",
"0.63423777",
"0.6339856",
"0.633441",
"0.63135374",
"0.631001",
"0.62855583",
"0.6277117",
"0.62562686",
"0.6248119",
"0.62121475",
"0.61909515",
"0.61900324",
"0.61855406",
"0.61809784",
"0.615999",
"0.61489224",
"0.61425906",
"0.61360323",
"0.6131195",
"0.6124352",
"0.61152446",
"0.61134547",
"0.61126554",
"0.6108664",
"0.6093227",
"0.6093227",
"0.6093227",
"0.6093227",
"0.60925794",
"0.6090965",
"0.6088725",
"0.6074881",
"0.6048516",
"0.6048069",
"0.60253185",
"0.60114115",
"0.6002608",
"0.599541",
"0.59885967",
"0.59877056",
"0.59778625",
"0.597423",
"0.59589624",
"0.5957968",
"0.59551907",
"0.59496576",
"0.5948936",
"0.5947304",
"0.5935306",
"0.5932085",
"0.59283996",
"0.59216684",
"0.5920227",
"0.59195805",
"0.59056634",
"0.5903215",
"0.590306",
"0.5902031",
"0.59020126",
"0.5888691",
"0.5885636",
"0.5884827",
"0.5884827",
"0.5882328",
"0.5879773",
"0.58768976",
"0.58732927",
"0.58656806",
"0.58409923",
"0.58384526",
"0.58364064",
"0.58351594",
"0.5831486",
"0.5828745",
"0.5826545",
"0.5826291",
"0.58168876",
"0.58154255",
"0.58053476",
"0.5802809",
"0.58021945",
"0.58013856",
"0.5796049",
"0.5786842",
"0.5786666",
"0.5785206",
"0.5779264",
"0.5772239",
"0.5769279"
] | 0.6524777 | 7 |
method to display less info about each stock. | def less_info(db)
info = db.execute("SELECT stocks2.stock_ticker,stocks1.recommendation FROM stocks2 JOIN stocks1 ON stocks2.recommendation_id = stocks1.id;")
info.each do |category|
puts "
Stock Ticker : #{category['stock_ticker']}
Rating : #{category['recommendation']}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @stock = Stock.find(params[:id])\n @items = @stock.item\n @stock_audits = @stock.stock_audit\n end",
"def stocks\n\n end",
"def show\n\t\t\n\t\t#Show total items and prices\n\t\tputs \"\\nShopping list: \"\n @list_products.each {|key, val| print val, \" \", key, \" \",productsMarket[key], \"$\\n\"} \n\tend",
"def show\n cache_recent_item(:exchange, @exchange.id, @exchange.trading_code)\n\n @trading_symbols_grid = initialize_grid(TradingSymbol.where(exchange_id: @exchange.id))\n end",
"def import_stock_hourly_display\n #JdeItemAvailability.import_stock_hourly_display\n SalesProductivity.generate_productivity\n end",
"def details\n\n puts \"\"\n puts \"Todays crypto update:\"\n puts \"Volume is the amount of the coin that has been traded with in a certain time frame...fyi\"\n puts \"----------------------------------------------------------------------\"\n puts \"| Coin (Symbol) | Volume (1 day) | Volume (7 day) | Volume (30 day) |\"\n puts \"----------------------------------------------------------------------\"\n puts \"\"\n\n @coins = TheCryptoUpdate::Coin.all[0..99]\n\n @coins.find do |coin|\n puts \" #{coin.name} (#{coin.symbol}) | $#{coin.volume_1d} | $#{coin.volume_7d} | $#{coin.volume_30d} |\"\n end\n\n end",
"def show\n drop_breadcrumb(\"股票\")\n drop_breadcrumb(\"#{@stock.name}(#{@stock.market}:#{@stock.code})\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @records = Record.all.where(stock_id: @stock.id).order(date: :desc).limit(5)\n end",
"def show\n if Stock.check_valid(params[:symbol])\n if Stock.not_exists?(params[:symbol])\n create\n end\n $stock = Stock.find(params[:symbol])\n # Gather and check chart data\n @input = Stock.get_overview(params)\n if @input === 404\n not_found\n else\n @data = YahooFinance.quotes([params[:symbol]], [:name, :last_trade_price, :ask, :bid, :open, :close, :volume, :market_capitalization, :dividend_yield, :dividend_per_share, :change, :change_in_percent, :last_trade_date, :stock_exchange])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: $stock }\n end\n end\n else\n not_found\n end\n end",
"def show\n @trades = @stock.trades\n @totalrevenue = @stock.trades.where(:action => \"SELL\").sum('shares*price')\n @totalcost = @stock.trades.where(:action => \"BUY\").sum('shares*price')\n @overall = @totalrevenue - @totalcost\n \n #Trade.where(:action => \"BUY\", :stock_id => 11).sum(shares*price)\n end",
"def show\n @inform = @study.inform\n @all_cups_price = 0\n @inform.studies.each do |study|\n @all_cups_price += study.price * study.factor\n end\n end",
"def display_each\n puts \" * #{self.experience} experience at #{self.company_name}\"\n end",
"def view_my_stocks(prompt, user)\n # groups stocks owned by specified user and sums up the quantity per stock symbol\n # total = 0 \n array = []\n stocks_qty = self.stocks.group(:stock_symbol).sum(:stock_qty)\n\n stocks_qty.each do |key, value|\n current_price = find_stock(key).current_price\n yesterdays_price = find_stock(key).yesterdays_price\n differential = ((yesterdays_price - current_price).abs / yesterdays_price)*100\n \n differential_checker(current_price, yesterdays_price, key, value, array,differential)\n end\n\n table = TTY::Table.new header: ['Stock Symbol', 'Quantity', 'Yesterdays Share Price', 'Todays Share Price', '% Change'], rows: array\n puts table.render(:unicode)\n end",
"def show\n @net_investment = 0\n @stock = Stock.find(params[:id])\n @investments = Investment.where(stock_id: @stock.id).limit(10)\n @my_investments = Investment.where(stock_id: @stock.id, member_id: current_member.id)\n @my_investments.each do |investment|\n @net_investment += investment.share_change\n end \n @stock.price = StockQuote::Stock.quote(@stock.ticker).last_trade_price_only\n @stock.save\n require 'net/http'\n\n begin\n @url = 'http://chart.finance.yahoo.com/z?s=%{ticker}' % {ticker: @stock.ticker}\n @resp = Net::HTTP.get_response(URI.parse(@url)) # get_response takes an URI object\n rescue\n print \"Connection error.\"\n end \n end",
"def show\n require 'finnhub_ruby'\n\n FinnhubRuby.configure do |config|\n config.api_key['token'] = ENV['finhub_api']\n end\n \n finnhub_client = FinnhubRuby::DefaultApi.new\n\n ticker = @short_call.asset\n @price = finnhub_client.quote(ticker).c\n\n @ceilings = [@short_call.ceiling1, @short_call.ceiling2, @short_call.strike]\n @ceiling_names = [\"Celing 1\", \"Celing 2\", \"Strike\"]\n end",
"def grab_popular_stock\n popular_stocks = @market_doc.css(\"ul.module-body.wsod.most-popular-stocks\")\n popular_stocks.css(\"a.stock\").each do |x|\n name = x.css(\"span.column.stock-name\").text\n price = x.css(\"span.column.stock-price\").text\n change = x.css(\"span.column.stock-change\").text\n @popular_stocks << [name, price, change]\n end\n end",
"def show\n @barcode = @product_stock_book.list_barcode\n @prod = ProductList.where(list_barcode: @product_stock_book.list_barcode).pluck(:extproductcode)\n @old_product_stocks = ProductStockBook.where(:list_barcode => @product_stock_book.list_barcode)\n .where(\"TRUNC(stock_date) < ?\", @product_stock_book.stock_date)\n if @old_product_stocks.present?\n\n @old_product_stock = @old_product_stocks.order(\"stock_date DESC\").first\n if (@old_product_stock.stock_date.month != 3 && @old_product_stock.stock_date.day != 31)\n @prev_closing_stock = @old_product_stock.closing_qty\n\n @prev_date = @old_product_stock.stock_date\n else\n @prev_closing_stock = 0\n @prev_date = \"Not Applicable\"\n end\n\n end\n\n end",
"def info\n puts \"All stations:\"\n @stations.each.with_index(1) do |station|\n puts \"#{station.name}: \"\n station.show_trains(\"Cargo\")\n station.show_trains(\"Passenger\")\n end\n\n puts \"All routes:\"\n show_routes\n puts \"All trains:\"\n show_trains\n puts \"All wagons:\"\n show_wagons\n end",
"def brand_stock(brand)\n \"Toy Stock: #{brand.stock}\"\n end",
"def productinfo\n \tif self.barcode.present?\n \t\tproduct = ProductList.where(list_barcode: self.barcode)\n\t \tif product.present?\n\t \t\tproduct.first.name + \" (\" + self.barcode + \")\"\n\t \telse\n\t \t\t\"<span style=color:violet;font-weight: normal; font-size:11px;>No barcode found in Product (Sell) List </span>\"\n\t \tend\n \telse\n \t\t\"<span style=color:violet;font-weight: normal; font-size:11px;>No barcode found in Product stock </span>\"\n \tend\n \t\n \n end",
"def show\n @portfolio = Portfolio.find(params[:id])\n\n \n # @stocks = YahooFinance.quotes([@portfolio.stocks.group_by(&:stock_symbol)], [:ask, :bid], { raw: false } )\n # additional resources :\n # https://github.com/herval/yahoo-finance\n # https://github.com/rlazoti/yahoofinance-example/blob/master/view_stocks.rb\n\n @stocks = YahooFinance.quotes(@portfolio.stocks.group_by(&:stock_symbol), [:ask, :bid, :symbol, :last_trade_price], { raw: false } )\n \n\n @stock = Stock.new\n @stock.portfolio_id = @portfolio.id\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock }\n end\n end",
"def show\n @stockist = Stockist.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @stockist }\n end\n end",
"def index\n render :layout => \"user\"\n #Stock.test 'SK6U.SI'\n #Stock.searchSymbol 'starhub'\n #Stock.historicalData 'CC3.SI','2013-07-21','2013-07-25'\n end",
"def show\n @warehouse = Warehouse.find(params[:id])\n @stocks = Stock.where(:company_id => @company.id, :warehouse_id => params[:id]).page(params[:page]).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @warehouse }\n end\n end",
"def wrt_brand_stk(stock, format = 6)\n $report_file.puts(\"Number of Products:\" + \"%#{format}s\" % stock.to_s)\nend",
"def show\n\t\tyahoo_client = YahooFinance::Client.new\n\t\t@data = yahoo_client.quotes([\"AER\", \"AYR\", \"FLY\", \"AL\", \"ACY\", \"WLFC\"], [:symbol, :name, :ask, :change, :change_in_percent, :market_capitalization])\n\tend",
"def display_info\n\t\tputs \"Total track number: #{@track_list.length}\"\n\t\tputs \"Total artist number: #{@artist_list.length}\"\n\t\tputs \"Last three played track:\"\n\t\t@last_played.each do |last_played_track|\n puts \"------------ Track Info -------------\"\n\t\t\tputs \"#{last_played_track.to_s}\"\n\t\tend\n\tend",
"def show\n @prices_history = combined_price_history\n @day_of_week = weekly_price_history\n @month_of_year = monthly_price_history\n end",
"def show\n @stock = Stock.find(params[:id])\n @quote = YahooFinance::get_standard_quotes(@stock.ticker)[@stock.ticker]\n @tweets = Twitter.search('$' + @stock.ticker).results\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n default_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock }\n end\n end",
"def show\n @sp500_stock = Sp500Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sp500_stock }\n end\n end",
"def display_shelf\n\t\ti=0\n\t\twhile i < @books.length\n\t\t\t@books[i].display_book\n\t\t\ti+=1\n\t\tend\n\tend",
"def stock_market; end",
"def show_info()\n\t\tputs \"ID: #{@@id}\"\n\t\tputs \"Name: #{@car_name}\"\n\t\tputs \"Make: #{@@make}\"\n\t\tputs \"Cost: #{calc_total_cost} INR\"\n\t\tputs\n\t\tputs \"Review: #{@review}\"\n\t\tputs \"Rating: #{@rating} stars\"\n\tend",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def popular_stocks\n #pluck to pull a column of values from a table\n @stocks = Stock.pluck(:symbol)\n # stock_counts is setting a new hash ready to accept new keys with default value 0\n @stock_counts = Hash.new 0\n @stocks.each do |stock|\n @stock_counts[stock] += 1\n end\n # @sorted_counts is a 2d array, each element of outer array has 2 elements pos 0 & 1\n @sorted_counts = @stock_counts.sort{|a,b| b[1] <=> a[1]}\n render \"popular_stocks\"\n end",
"def display_lib\n\t\ti=0\n\t\twhile i < @shelves.length\n\t\t\tif @shelves[i].num_book != nil\n\t\t\t\t@shelves[i].display_shelf\n\t\t\tend\n\t\t\ti+=1\n\t\tend\n\tend",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def show\n @floors = [@bull_put_spread.floor1, @bull_put_spread.floor2, @bull_put_spread.strike]\n @floor_names = [\"Floor 1\", \"Floor 2\", \"Strike\"]\n @rut_price = 2257.46\n end",
"def display\n p @stk\n end",
"def current_symbols\n @interface.stock_symbols\n end",
"def show\n @pair.update_ticker if @pair.ticker.nil?||@pair.ticker.old?\n end",
"def get_info_index\n @i = 0\n yahoo_client = YahooFinance::Client.new\n @tickers = Array.new\n @stocks.each do |stock|\n @tickers.push(stock.ticker_symbol)\n end\n #array of the amount change\n @index_data = yahoo_client.quotes([@tickers], [:change])\n end",
"def show_history_items_page\n \t@sold = Transaction.find_all_by_seller_id(current_user.id)\n @bought = Transaction.find_all_by_buyer_id(current_user.id)\n end",
"def show_all()\n if @items.length == 0\n puts \"Shopping list is empty...\"\n else\n @items.each_index{\n |i|\n puts \"#{i+1} - #{@items[i].to_s}\"\n }\n end\n end",
"def summary(include_item_specifics = false)\n string = []\n string << title.ljust(80)\n string << \"[#{status.to_s}]\".capitalize.rjust(15)\n\n if has_variations?\n string << \"\\n #{variations.count} Variations:\"\n variations.each do |variation|\n string << \"\\n #{variation[:sku]}: \"\n string << \"#{variation[:quantity_available].to_s.rjust(3)} @ #{(variation[:current_price].symbol + variation[:current_price].to_s).rjust(6)}\"\n string << \" #{variation[:quantity_listed].to_s.rjust(2)} listed, #{variation[:quantity_sold].to_s.rjust(2)} sold\"\n end\n else\n string << \"\\n \"\n string << \"#{quantity_available.to_s} @ \"\n string << \"#{current_price.symbol}#{current_price.to_s}\"\n if best_offer? # Cannot have best offer on variations\n string << ' with Best Offer'\n string << \" #{best_offer_auto_accept_price.symbol}#{best_offer_auto_accept_price}\" if best_offer_auto_accept_price\n string << \" | #{best_offer_minimum_accept_price.symbol}#{best_offer_minimum_accept_price}\" if best_offer_minimum_accept_price\n end\n end\n\n if promotional_sale?\n details = promotional_sale\n starts = details[:start_time]\n ends = details[:end_time]\n original_price = promotional_sale[:original_price]\n string << \"\\n \"\n string << 'ON SALE NOW!' if on_sale_now?\n string << 'was on sale' if Time.now.utc > ends\n string << 'sale scheduled' if Time.now.utc < starts\n string << \" original price #{original_price.symbol}#{original_price.to_s}\"\n string << \" #{starts.strftime('%H:%M %A')}\"\n string << \" until #{ends.strftime('%H:%M %A')}\"\n end\n string << \"\\n\"\n\n string << \"#{quantity_sold.to_s.rjust(4)} sold\"\n if quantity_sold > 0 && status == :completed\n days = (end_time - start_time).round.to_i\n if days > 1\n string << \" in #{days} days\"\n else\n hours = ((end_time.to_time - start_time.to_time) / 1.hour).round\n string << \" in #{hours} hours\"\n end\n end\n\n string << \", #{watch_count} watchers, #{hit_count} page views.\"\n string << \"\\n\"\n\n string << \" SKU: #{sku} Photos: #{photo_urls.count} eBay ID: \"\n string << \"#{relist_parent_id} <= \" unless relist_parent_id.nil?\n string << \"#{ebay_item_id}\"\n string << \" => #{relist_child_id}\" unless relist_child_id.nil?\n\n string << \"\\n \"\n if gtc?\n date_time = (Time.now.utc < end_time) ? Time.now.utc : end_time\n days = (date_time - start_time).round.to_i\n if days > 1\n string << \"GTC [#{days} days]\"\n else\n hours = ((date_time.to_time - start_time.to_time) / 1.hour).round\n string << \"GTC [#{hours} hours]\"\n end\n\n else\n string << \"#{duration} Day\"\n end\n string << \" #{category_1_path.join(' -> ')}\"\n\n string << \"\\n \"\n string << \"#{start_time.strftime('%l:%H%P %A %-d %b').strip} until #{end_time.strftime('%l:%H%P %A %-d %b').strip}\"\n\n if include_item_specifics\n item_specifics.each_pair do |key, value|\n string << \"\\n#{key.rjust(30)} : #{value}\"\n end\n end\n\n string.join\n end",
"def show\n puts @name\n puts @quantity\n end",
"def show\n @suppliers = Supplier.all\n @raw_materials = RawMaterial.all\n super\n end",
"def stockquote(stock)\n url = URI(\"https://apidojo-yahoo-finance-v1.p.rapidapi.com/market/v2/get-quotes?region=US&symbols=#{@stock}\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n request = Net::HTTP::Get.new(url)\n request[\"x-rapidapi-key\"] = ENV['X_RAPIDAPI_KEY']\n request[\"x-rapidapi-host\"] = 'apidojo-yahoo-finance-v1.p.rapidapi.com'\n \n response = http.request(request)\n quoteResponse = JSON.parse(response.read_body)['quoteResponse']\n result = quoteResponse['result']\n @zero = result[0]\n puts \"Symbol = #{@zero['symbol']}, Exchange = #{@zero['fullExchangeName']}, Bid = #{@zero['bid']}, Ask = #{@zero['ask']}\"\n\n return \"<div class =col>\n <h2>Symbol=<a>#{@zero['symbol']}</a></h2>\n <h4>Exchange=<a>#{@zero['fullExchangeName']}</a></h4>\n <h4>Bid=<a>#{@zero['bid']}</a></h4>\n <h4>Ask=<a>#{@zero['ask']}</a></h4>\n </div>\"\n end",
"def print_client_total\n puts \"Total of all stocks held: \"\n # odd = stocks.select.each_with_index { |str, i| i.even? } \n # puts stocks.price\n # puts Hash[*stock_splits = stocks.map { |x| x.to_s.split(' ') }]\n # puts Hash[*stocks]\n end",
"def display_data\n\t\t\t\"#{@model} #{@color} #{@horsepower} #{@year} #{@brand} #{@mpg}\"\n\t\tend",
"def product_stock(toy)\n \"Toy Stock: #{toy.stock}\"\n end",
"def display_shelf\n\t\tputs @books\n\tend",
"def show\n if @movie.stock >= 10\n @text_class = 'success'\n elsif @movie.stock < 10 && @movie.stock > 5\n @text_class = 'warning'\n else\n @text_class = 'danger'\n end\n end",
"def list\n Terminal::Table.new(title: \"Items in Stock\", headings: [ 'Code', 'Name', 'Price'], rows: to_a)\n end",
"def show\n @stock_negativo = @compra.check_detalles_negativos(true)\n end",
"def list_books\n puts \"\"\n puts \"Current Catalogue:\"\n puts \"\"\n puts \"A-G:\"\n \t@shelf_ag.to_s\n \tputs \"H-P:\"\n \t@shelf_hp.to_s\n \tputs \"Q-Z:\"\n \t@shelf_qz.to_s\n end",
"def show\n @purchased_stock = PurchasedStock.find(params[:id])\n # update purchased_stock's value_in_stocks\n current_value_in_stocks = 0 \n if (@purchased_stock.total_qty > 0)\n new_value = ((YahooStock::Quote.new(:stock_symbols => [@purchased_stock.stock_code]).results(:to_array).output[0][1].to_f) * 100).to_i\n end\n @purchased_stock.value_in_stocks = new_value * @purchased_stock.total_qty\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchased_stock }\n end\n end",
"def show\n @purchased_stock = PurchasedStock.find(params[:id])\n # update purchased_stock's value_in_stocks\n current_value_in_stocks = 0 \n if (@purchased_stock.total_qty > 0)\n new_value = ((YahooStock::Quote.new(:stock_symbols => [@purchased_stock.stock_code]).results(:to_array).output[0][1].to_f) * 100).to_i\n end\n @purchased_stock.value_in_stocks = new_value * @purchased_stock.total_qty\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchased_stock }\n end\n end",
"def print_data\n response = @quandl_client.get_stock\n abort 'Unable to find data for this search' if response['dataset'].nil? || response['dataset'].empty?\n\n prepare_result(response)\n display_result\n end",
"def info\n return \"#{self.name} $#{self.price} (#{self.calorie}kcal)\"\n end",
"def show\n products()\n bills()\n today_bills()\n end",
"def show\n @summary = {}\n # cash flow info\n @summary[\"cash_flow_domestic\"] = domestic_cash_flow_info\n # sell info\n @summary[\"domestic\"] = domestic_sold_info\n @summary[\"offshore\"] = offshore_sold_info\n # by date\n @summary[\"auction\"] = auction_info\n @summary[\"custom\"] = custom_info\n @summary[\"shipment\"] = shipment_info\n # undeal\n @summary[\"undeal_product\"] = undeal_product_info\n @summary[\"undeal_auction\"] = undeal_auction_info\n @summary[\"undeal_custom\"] = undeal_custom_info\n @summary[\"shipment_status\"] = shipment_status_info\n render 'dashboard'\n end",
"def summary\n @items.map { |i| \"* #{i.title}\" }.join(\"\\n\")\n end",
"def show\n @stock_item = StockItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock_item }\n end\n end",
"def show\n add_breadcrumb @article.name\n @suppliers=Article.find(@article.id).suppliers\n end",
"def index\n @stock_tickers = StockTicker.all\n end",
"def show\n @cryptocurrencies = Cryptocurrency.all\n require 'net/http'\n require 'json'\n @url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?start=1&limit=100&CMC_PRO_API_KEY=8e364003-38f2-410d-81af-9166deca3a6f'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @array1 = JSON.parse(@response).to_a\n @array2 = @array1[1].to_a\n @show_crypto = @array2[1].to_a\n end",
"def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end",
"def print_details\n puts \"#{self.reader.name} subscribed to #{self.magazine.title} for $#{self.price}\"\n end",
"def stockname\n \"#{CSV.parse_line(YahooStock.find_by_symbol(symbol).parsed_response)[0]}\"\n end",
"def display_product\n STDOUT.puts \"--\"*50\n STDOUT.puts \"title: \\t\\t#{$title}\"\n STDOUT.puts \"seller: \\t#{$seller}\"\n STDOUT.puts \"price: \\t\\t#{$price}\"\n STDOUT.puts \"stars: \\t\\t#{$stars}\"\n STDOUT.puts \"reviews: \\t#{$reviews}\"\n STDOUT.puts \"image url: \\t#{$image_href}\"\n STDOUT.puts \"product url: \\t#{$url}\"\n end",
"def list_all_markets\n counter = 1\n Market.all.each do |market|\n puts \"#{counter} #{market.marketname}\"\n puts \" #{market.streetaddress}, #{market.borough}\\n\"\n puts \"\\n\"\n counter +=1\n end\n puts \"\\n\"\n puts \"Enter the number next to a market to see more info\"\n puts \"Or type 'menu' to go back to main menu\"\n puts \"\\n\"\n puts \"\\n\"\n yield\n end",
"def show\n @total = 0\n @cart.lineitems.each{|line|\n @total = AddService.call(@total.to_i, line.product.price * line.quantity)\n }\n #Use of logger class to log messages into the log file\n Logger.instance.log(Time.now.to_s + \": Cart viewed by user \\n\")\n end",
"def show\n @total_stock = TotalStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @total_stock }\n end\n end",
"def show\r\n @exchange_rates = get_latest\r\n end",
"def show\n @currencies = CryptocurrenciesService.new.get_top\n end",
"def index\n \t@stocks = Stock.all\n \t#@stock = current_user.stocks\n end",
"def print_items\n @items.each do |item|\n puts item.name + \" (#{item.price} gold)\"\n end\n print \"\\n\"\n end",
"def show\n @current_exchange = @currency_exchange_pair.decorate\n end",
"def to_s\r\n \"Name: #{name} Credits:#{self.credits} ItemsCount:#{self.items.length}\"\r\n end",
"def print_details\n puts \"#{self.reader.name} subscribed to #{self.magazine.title} for $#{self.price}\"\n end",
"def show\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_stock }\n end\n end",
"def stock_on_row(product)\n if(product.stock == 0)\n return 'table-danger'\n elsif((product.stock > 0) && (product.stock < 50))\n return 'table-warning'\n else\n return 'table-success'\n end\n end",
"def show\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_stock }\n end\n end",
"def display_products\n\n puts \"Welcome to our store! We have following products in our store:\"\n @products.each do |product|\n puts \"Reference Number: #{product[:reference_number]}, Product: #{product[:name]}, Price: #{product[:price]}\"\n end\nend",
"def show\n puts \"\n ID: #{id}\n Balance: #{balance}\n Date: #{open_date}\"\n end",
"def get_stocks\n @stocks = Stock.where(user_id: session[:current_user_id]).order(\"ticker_symbol ASC\")\n end",
"def summary_detail\n Classifieds::Listing.format_cols([@title, @mileage, @price], SUMMARY_COL_FORMATS)\n end",
"def show\n @stocklist = Stocklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stocklist }\n end\n end",
"def index\n @runs = @stocks_util.user_runs\n @selected_run = @stocks_util.selected_run\n set_stocks\n @stocks_util.enrich_stock_from_yahoo(@stocks) if @stocks.size != 0\n end",
"def display\n puts \"Title: #{@title}\"\n puts \"Author: #{@author}\"\n puts \"Price: #{@price}\"\n end",
"def show\n cache_recent_item(:client, @client.id, @client.name)\n add_breadcrumb t('models.show', model: Client.model_name.human), nil\n\n @trading_accounts_grid = initialize_grid(TradingAccount.where(client_id: @client.id))\n @products_grid = initialize_grid(Product.where(client_id: @client.id))\n\n end"
] | [
"0.65670115",
"0.6542134",
"0.648184",
"0.63011235",
"0.6294176",
"0.60961866",
"0.60911953",
"0.60625654",
"0.60086185",
"0.6000794",
"0.59954786",
"0.59662706",
"0.59593064",
"0.59510046",
"0.5950865",
"0.59379345",
"0.5937267",
"0.59259033",
"0.5919316",
"0.5911653",
"0.59109855",
"0.59070796",
"0.5906169",
"0.59034723",
"0.5865227",
"0.5859864",
"0.5859004",
"0.5857756",
"0.58499134",
"0.58444965",
"0.5839665",
"0.5838552",
"0.58245766",
"0.581684",
"0.5785573",
"0.57554084",
"0.57554084",
"0.57554084",
"0.57554084",
"0.5754402",
"0.575326",
"0.57452035",
"0.57452035",
"0.57452035",
"0.57452035",
"0.5731727",
"0.5729849",
"0.57241017",
"0.57182133",
"0.5708837",
"0.57075083",
"0.56972826",
"0.5692794",
"0.56891555",
"0.5685801",
"0.56835955",
"0.5670251",
"0.566355",
"0.5642846",
"0.561784",
"0.56148374",
"0.56102747",
"0.5600038",
"0.5594405",
"0.5589128",
"0.5589128",
"0.5583417",
"0.5580759",
"0.55700856",
"0.5568636",
"0.55634207",
"0.555932",
"0.5558212",
"0.5551364",
"0.5547856",
"0.55436194",
"0.5541498",
"0.55398583",
"0.5536814",
"0.553487",
"0.5527262",
"0.55238146",
"0.5520709",
"0.5516532",
"0.5512438",
"0.5507134",
"0.5506254",
"0.5504703",
"0.55036205",
"0.55035406",
"0.5501689",
"0.54985994",
"0.5496041",
"0.54943454",
"0.54913664",
"0.54846025",
"0.54787827",
"0.5478508",
"0.547573",
"0.54737145"
] | 0.57326883 | 45 |
Return a string suitable for a Link header for the given asset types/groups. | def preload_assets_link_header(*args)
_preload_assets_array(args).map{|path, as| "<#{path}>;rel=preload;as=#{as}"}.join(",")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_to_group(group, options={})\n if group.is_a?(Group)\n name = h(group.name)\n name\n else\n h(group.to_s)\n end\n end",
"def link_headers\n yield if block_given?\n return '' unless response.include? 'Link'\n\n response['Link'].split(\",\\n\").map do |line|\n url, *opts = line.split(';').map(&:strip)\n \"<link href=\\\"#{url[1..-2]}\\\" #{opts.join ' '} />\"\n end.join \"\\n\"\n end",
"def type_link(type)\n type ? \"<a href='/types/#{type}'>#{type.upcase}</a>\" : ''\n end",
"def build_group_header\n output << \" \\\"#{data.name}\\\":\"\n end",
"def functional_group_header\n gs_elements = []\n gs_elements << 'GS'\n gs_elements << 'HP'\n gs_elements << payer_id \n gs_elements << '1000000'\n gs_elements << Time.now().strftime(\"%Y%m%d\") \n gs_elements << Time.now().strftime(\"%H%M\")\n gs_elements << (@isa_record.isa_number.to_s.rjust(9, '0') if @isa_record) \n gs_elements << 'X'\n gs_elements << ((!@output_version || @output_version == '4010') ? '004010X091A1' : '005010X221A1')\n gs_elements.join(@element_seperator)\n end",
"def link_for(type)\n if link = self.links.find { |link| link.type == type }\n link.to_s\n end\n end",
"def link_header n\n html = \" \"\n n.times { html += '<th class=\"linkheader\"></th>' }\n html.html_safe\n end",
"def link_name\n if ( current_ability.admin? || current_ability.can?(:read, id) )\n first_title\n else\n 'File'\n end\n end",
"def linkify_header(header, sub_file)\n href = sub_file ? \"../articles/#{@filename}\" : \"articles/#{@filename}\"\n \"<a href=\\\"#{href}\\\">\" + header + '</a>'\n end",
"def format_link(url_pair)\n # image display output\n if url_pair[:format] == :image\n return \"<div class='image'>\\n <div class='image-inner'>\\n <a href='\" + \n url_pair[:post_url] + \n \"' target='_blank'>\\n <img src='\" +\n url_pair[:image_url] +\n \"'>\\n </a>\\n </div>\\n</div>\"\n end\n\n # imgur gifv output\n if url_pair[:format] == :gifv\n return \"<div class='video-container'>\\n <div class='video-inner'>\\n <a href='\" +\n url_pair[:post_url] +\n \"' target='_blank'>\\n <video autoplay='autoplay' type='video/mp4' id='video' loop='loop' muted='muted' preload='auto' src='\" +\n url_pair[:image_url] +\n \"'></video>\\n </a>\\n </div>\\n</div>\"\n end\n end",
"def header(title, level)\r\n @headers ||= []\r\n permalink = title.downcase.gsub(/\\W+/, '-')\r\n\r\n if @headers.include? permalink\r\n permalink += '_1'\r\n permalink = permalink.succ while @headers.include? permalink\r\n end\r\n @headers << permalink\r\n %(\r\n <h#{level}><a name=\"#{permalink}\" class=\"anchor\" href=\"##{permalink}\"><span class=\"anchor-icon\"></span></a>#{title}</h#{level}>\r\n )\r\n end",
"def generate_header(newer_tag_name, newer_tag_link, newer_tag_time, older_tag_name, project_url)\n header = \"\"\n\n # Generate date string:\n time_string = newer_tag_time.strftime(@options[:date_format])\n\n # Generate tag name and link\n release_url = if @options[:release_url]\n format(@options[:release_url], newer_tag_link)\n else\n \"#{project_url}/tree/#{newer_tag_link}\"\n end\n header += if newer_tag_name.equal?(@options[:unreleased_label])\n \"## [#{newer_tag_name}](#{release_url})\\n\\n\"\n else\n \"## [#{newer_tag_name}](#{release_url}) (#{time_string})\\n\\n\"\n end\n\n if @options[:compare_link] && older_tag_name\n # Generate compare link\n header += \"[Full Changelog](#{project_url}/compare/#{older_tag_name}...#{newer_tag_link})\\n\\n\"\n end\n\n header\n end",
"def header article\n \"title, summary, source, date, guid, isPermaLink\"\n end",
"def export_header_str\n\n header_member_strs = [t('activerecord.attributes.shf_application.contact_email'),\n t('activerecord.attributes.user.email'),\n t('activerecord.attributes.shf_application.first_name'),\n t('activerecord.attributes.shf_application.last_name'),\n t('activerecord.attributes.user.membership_number'),\n t('activerecord.attributes.user.date_member_packet_sent'),\n t('activerecord.attributes.shf_application.state'),\n t('admin.export_ansokan_csv.date_state_changed'),\n t('activerecord.models.business_category.other'),\n t('activerecord.models.company.one'),\n t('admin.export_ansokan_csv.member_fee_paid'),\n t('admin.export_ansokan_csv.member_fee_expires'),\n t('admin.export_ansokan_csv.branding_fee_paid'),\n t('admin.export_ansokan_csv.branding_fee_expires'),\n t('activerecord.attributes.address.street'),\n t('activerecord.attributes.address.post_code'),\n t('activerecord.attributes.address.city'),\n t('activerecord.attributes.address.kommun'),\n t('activerecord.attributes.address.region'),\n t('activerecord.attributes.address.country'),\n ]\n\n out_str = ''\n\n out_str << header_member_strs.map { |header_str| \"'#{header_str.strip}'\" }.join(',')\n\n out_str << \"\\n\"\n\n end",
"def print_layout_header_list_items\n [{ code: :tare_reference },\n { code: :case_reference, placeholder: '<%CASE_REFERENCE%>' },\n { code: :version },\n { code: :reason, lookup: true, when: :pre_claim?, is: [false] },\n { code: :claim_desc, when: :reason, is: ['OTHER'] }]\n end",
"def admin_export_link_names_in_order\n [\n [I18n.t('views.nav.export_confirmation_name'), '/export_lists/confirmation_name'],\n # rubocop:disable Layout/LineLength\n [I18n.t('views.nav.export_attend_retreat_title', home_parish: Visitor.home_parish), '/export_lists/retreat', nil, 'Retreat at St. Ma...'],\n [I18n.t('views.nav.export_baptized_at_home_parish_title', home_parish: Visitor.home_parish), '/export_lists/baptism', nil, 'Baptized at St. M...'],\n [I18n.t('views.nav.export_sponsor_covenant_title'), '/export_lists/sponsor', nil, 'Sponsor covenant'],\n [I18n.t('views.nav.export_sponsor_at_home_parish_title', home_parish: Visitor.home_parish), '/export_lists/sponsor', nil, 'Sponsor eligibility'],\n # rubocop:enable Layout/LineLength\n [I18n.t('views.nav.export_candidate_event_status_title'), '/export_lists/events', nil, 'Candidate Events ...'],\n [I18n.t('views.nav.pdf_baptismal_name'), '/export_lists/bap_name', nil, 'DF for matching ...']\n ]\n end",
"def image_link(group, options = {})\n link = options[:link] || group\n image = options[:image] || :icon\n image_options = { :title => h(group.name), :alt => h(group.name) }\n unless options[:image_options].nil?\n image_options.merge!(options[:image_options]) \n end\n link_options = { :title => h(group.name) }\n unless options[:link_options].nil? \n link_options.merge!(options[:link_options])\n end\n content = image_tag(group.send(image), image_options)\n # This is a hack needed for the way the designer handled rastered images\n # (with a 'vcard' class).\n if options[:vcard]\n content = %(#{content}#{content_tag(:span, h(group.name), :class => \"fn\" )})\n end\n link_to(content, link, link_options)\n end",
"def to_s\n \"#<\" + self.class.name + \": \" + href + \">\"\n end",
"def image_link(group, options = {})\n link = options[:link] || group\n image = options[:image] || :icon\n image_options = { :title => h(group.name), :alt => h(group.name) }\n unless options[:image_options].nil?\n image_options.merge!(options[:image_options]) \n end\n link_options = { :title => h(group.name) }\n unless options[:link_options].nil? \n link_options.merge!(options[:link_options])\n end\n content = image_tag(group.send(image), image_options)\n # This is a hack needed for the way the designer handled rastered images\n # (with a 'vcard' class).\n if options[:vcard]\n content = %(#{content}#{content_tag(:span, h(group.name), \n :class => \"fn\" )})\n end\n link_to(content, link, link_options)\n end",
"def asset_file_name_formatted\n if self.asset_clone_id.present?\n x = self.asset_clone\n if x.present?\n case self.asset_type\n when TYPE[:section_audio], TYPE[:media_image], TYPE[:media_video], TYPE[:slideshow_image], TYPE[:infographic], TYPE[:infographic_dataset]\n \"#{x.id}__#{x.asset_file_name}\"\n else\n x.asset_file_name\n end\n end\n else\n case self.asset_type\n when TYPE[:section_audio], TYPE[:media_image], TYPE[:media_video], TYPE[:slideshow_image], TYPE[:infographic], TYPE[:infographic_dataset]\n \"#{self.id}__#{self.asset_file_name}\"\n else\n self.asset_file_name\n end\n end\n end",
"def type_images(types)\n @type_map ||= { \n N::TALIA.Source => 'source',\n N::FOAF.Group => 'group',\n N::FOAF.Person => 'person'\n }\n result = ''\n types.each do |t|\n image = @type_map[t] || 'source'\n name = t.local_name.titleize\n result << link_to(image_tag(\"talia_core/#{image}.png\", :alt => name, :title => name),\n :action => 'index', :filter => t.to_name_s('+')\n )\n end\n result\n end",
"def link_name\n current_ability.can?(:read, id) ? first_title : 'File'\n end",
"def link(link, title, content)\n\t\tif (title)\n\t\t\treturn \"title : [#{content}|#{link}]\"\n\t\telse\n\t\t\treturn \"[#{content}|#{link}]\"\n\t\tend\n\tend",
"def link\n return slug = self.header_content(:slug) ? slug : sanitize_filename(self.name) << \".html\"\n end",
"def format_teams(team_ids)\n links = []\n team_ids.each do |id|\n url, name = team_url_and_name(id)\n links << \"[#{name}](#{url})\"\n end\n if links.length == 1\n \"the #{links[0]} group\"\n elsif links.length == 2\n \"the #{links[0]} or #{links[1]} groups\"\n else\n \"the #{links[0..-1].join(\", \")} or #{links[-1]} groups\"\n end\n end",
"def header(text, level)\n if text =~ /^\\^([a-zA-Z0-9-]+) /\n anchor_prefix = $1\n text = text.sub(\"^#{anchor_prefix} \", \"\")\n end\n anchor = FormatHelpersWrapper.strip_tags(text).parameterize\n anchor = \"#{anchor_prefix}-#{anchor}\" if anchor_prefix\n %(<h%s><span class=\"anchor\" id=\"%s\"></span><a href=\"#%s\">%s</a></h%s>) % [level, anchor, anchor, text, level]\n end",
"def get_linked_full_name_with_logo\n h.link_to( get_logo_for_season_type + ' ' + get_full_name, meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end",
"def map_ua_record_group_codes(item)\n group_keys = item.qvalue.split(':')\n label = group_keys.count > 1 ? subgroup_label(group_keys) : group_label(group_keys)\n [item.value, label].join(' — ').html_safe\n end",
"def display\n\t\tLink.pretty_name(provider)\n\tend",
"def generic_resources_table_headers\n expand(account_details_icon)\n generic_resources_table.headers_text\n end",
"def organization_type_title\n if organization_name\n ' Associated With ' + organization_name\n else\n ''\n end\n end",
"def sections_augmented_link( obj )\n title = \"\"\n title << obj.code unless obj.try( :code ).blank?\n title << \"\\n\" unless title.empty? or obj.try( :description ).blank?\n title << obj.description unless obj.try( :description ).blank?\n\n content_tag(\n :span,\n link_to( h( obj.title ), obj ),\n :title => title\n )\n end",
"def resourceType\n 'Linkage'\n end",
"def link_to(links)\n links.map { |link| \"<a href='#{link[:uri]}'>#{link[:name]}</a>\" }.join(\"<br>\")\nend",
"def group_component_print(group)\n sgc= \"<table>\"\n if(group.components.empty?)\n sgc+= \"<tr><td>No Components Available </td></tr>\"\n else\n for comp in group.components.sort {|x,y| x.name <=> y.name }\n sgc+= \"<tr><td>#{link_to comp.name, comp}</td></tr>\"\n end\n\n sgc+= \"</table>\"\n end\n return sgc\n end",
"def pretty_print_export_header\n text = name\n text += \" (#{unit})\" if unit.present?\n text\n end",
"def license_types_table_headers\n expand(account_details_icon)\n license_types_table.headers_text\n end",
"def link\n @headers[:link]\n end",
"def describe(conj = \"\\n\")\n parts = [ ]\n\n self.attrs.each do |attr|\n if (attr[:title].downcase == 'link')\n if (attr[:value][0] == '/')\n uri = URI.parse(self.source.attrs['url'])\n parts.push(\"#{attr[:title]}: #{uri.scheme}://#{uri.host}#{attr[:value]}\")\n else\n parts.push(\"#{attr[:title]}: #{attr[:value]}\")\n end\n else\n parts.push(\"#{attr[:title]}: #{attr[:value]}\")\n end\n end\n\n return parts.join(conj)\n end",
"def alternative_format_products\n linking(\"AlternativeFormat\")\n end",
"def combine_name_link(names, links)\n # Split up the given names and links into arrays\n allNames = names.split(\", \")\n allLinks = links.split(\", \")\n\n # Form html links (will create mailto:<email> if an @ symbol is used)\n output = \"\"\n for i in 0..allNames.length-1 do\n if (allLinks[i].index('@') != nil)\n output += \"<a href=\\\"mailto:\" + allLinks[i] + \"\\\">\" + allNames[i] + \"</a>, \"\n elsif allLinks[i] == \"nil\"\n output += allNames[i] + \", \"\n else\n output += \"<a href=\\\"\" + allLinks[i] + \"\\\">\" + allNames[i] + \"</a>, \"\n end\n end\n\n output = output[0..-3]\n end",
"def asset_details(asset)\n details = []\n\n if asset.content_type.present?\n details << ScihistDigicoll::Util.humanized_content_type(asset.content_type)\n end\n if asset.size.present?\n details << ScihistDigicoll::Util.simple_bytes_to_human_string(asset.size)\n end\n\n str = details.join(\" — \")\n\n if asset.original_filename != member_label\n str = safe_join([str, \"<br>\".html_safe, asset.original_filename])\n end\n\n str\n end",
"def reference_string_by type\n\t\t\t\t\trstring = []\n\t\t\t\t\ttype.each do |ref|\n\t\t\t\t\t\trstring << ref.value\n\t\t\t\t\tend\n\n\t\t\t\t\trstring.join(\", \")\n\t\t\t\tend",
"def link_html(type, text = '')\n base_link = raw(\"<span class='glyphicon glyphicon-#{type}'></span>\")\n if text.empty?\n base_link\n else\n raw(\"#{base_link} #{text}\")\n end\n end",
"def link_to_asset(body,model,url_opts={},html={})\n result = String.new\n result << '<a href=\"' + url_for_asset(model,url_opts) + '\">'\n result << body\n result << '</a>'\n end",
"def to_s\n return @string if @string\n result = @type + \" \" + to_sWithAliasesIndexes( @join_sources )\n result += @exporter.separator\n result += \"ON \" + @join_on.val.to_s if @join_on\n @string = result\n end",
"def to_s\n \"#{self.name} => #{self.link}\"\n end",
"def get_header_string(headers)\n headers = [headers] unless headers.is_a?(Array)\n\n common_headers = RbConfig::CONFIG['COMMON_HEADERS']\n\n if common_headers.nil? || common_headers.empty?\n if headers.empty?\n headers = ['stdio.h', 'stdlib.h']\n headers += 'windows.h' if File::ALT_SEPARATOR\n end\n else\n headers += common_headers.split\n end\n\n headers = headers.flatten.uniq\n headers.map{ |h| \"#include <#{h}>\" }.join(\"\\n\")\n end",
"def link_name\n title\n end",
"def link_html(type, text = '')\n base_link = raw(\"<span class='glyphicon glyphicon-#{type}'></span>\")\n #base_link = raw(\"\")\n if text.empty?\n base_link\n else\n raw(\"#{base_link} #{text}\")\n end\n end",
"def get_link_type_identifier(type)\n get_type_identifier(type, Occi::Core::Link.kind)\n end",
"def separate_link_type\n link_type_match = LINK_TYPE_SEPARATION.match(@page_name)\n if link_type_match\n @link_text = @page_name = link_type_match[1]\n @link_type = link_type_match[2..3].compact[0].to_sym\n end\n end",
"def header_an\n @record['Header']['An'].to_s\n end",
"def to_string\n h = ''\n h << \"Groups\\n\"\n groups.each do |group|\n h << \" #{group}\\n\"\n end\n \n h << \"\\nHosts:\\n\"\n hosts.each do |host|\n h << \" #{host}\\n\"\n end\n \n h << \"\\nRoles\\n\"\n roles.each do |role|\n h << \" #{role}\\n\"\n end\n\n h << \"\\nTop-level tasks\\n\"\n tasks.each do |task|\n h << \" #{task}\\n\"\n end\n\n h\n end",
"def ua_record_group_display(value = '')\n group_keys = value.split(':')\n label = [group_keys.last, ' — '].join\n label << (group_keys.count > 1 ? subgroup_label(group_keys) : group_label(group_keys))\n label.html_safe\n end",
"def headers(type)\n case type\n when :dates\n dates.map { |d| { :object => d, :type => \"date\" } }\n when :shifts\n shifts.map do |s|\n {\n :object => {\n :title => title(s.id),\n :color => display_color(s.id),\n :phone => s.phone,\n :note => week_note(s.id)\n },\n :type => \"shift\"\n }\n end\n when :physicians\n section.members_by_group.values.flatten.map do |physician|\n {\n :object => {\n :title => physician.short_name,\n :id => physician.id\n },\n :type => \"physician\"\n }\n end\n end\n end",
"def unique_format_name\n title = all_subjects.map(&:format_name).uniq.sort.join(\" & \")\n if title.blank?\n :image.l + \" ##{id || \"?\"}\"\n else\n title + \" (#{id || \"?\"})\"\n end\n end",
"def header_format; self.underline end",
"def as_main_link titre, style = nil\n dtitre = titre.split('')\n first_letter = dtitre.shift\n other_letters = dtitre.join('')\n sty = style.nil? ? \"\" : \" style=\\\"#{style}\\\"\"\n \"<span class='first_letter_main_link'#{sty}>#{first_letter}</span>\" +\n \"<span class='other_letters_main_link'#{sty}>#{other_letters}</span>\"\nend",
"def header_link_for_rel(link, desired)\n link[1][0][1] == desired ? link[0] : nil\n end",
"def email_formatted_urls\n \n # Go through the 3 urls in the record and retrieve the urls for the \n # caller\n urls = []\n 1.upto(3) do |i|\n url = self.send(\"url#{i}\")\n break if url == ''\n urls << url\n end\n \n url_string = ''\n if urls.size > 0\n url_string = 'REFERENCES: '\n url_string += urls.join(\"\\n \")\n url_string += \"\\n--------------------------------------------------------------------------------\"\n end\n \n return url_string\n \n end",
"def display_resource(group)\n \"Group ##{group.to_param}\"\n end",
"def to_s\n\t\t\ts = \"#{headername}\\n\" +\n\t\t\t\t\"{\\n\" +\n\t\t\t\t\"v=#{@version}\\n\" +\n\t\t\t\"hop=#{@hop}\\n\" +\n\t\t\t\"uid=#{@uid}\\n\" +\n\t\t\t\"class=#{@msgclass}\\n\" +\n\t\t\t\"source=#{@src_addr}\\n\"\n\n\t\t\ts << \"target=#{@target_addr}\\n\" if @target_addr\n\n\t\t\tif @headers\n\t\t\t\t@headers.each do |k, v|\n\t\t\t\t\ts << \"#{k}=#{v}\\n\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\ts << \"}\\n\"\n\n\t\t\tif @blocks\n\t\t\t\t@blocks.each do |name, block|\n\t\t\t\t\ts << \"#{name}\\n{\\n\"\n\t\t\t\t\tblock.each do |k, v|\n\t\t\t\t\t\ts << \"#{k}=#{v}\\n\"\n\t\t\t\t\tend\n\t\t\t\t\ts << \"}\\n\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\ts\n\t\tend",
"def get\n @keys.each do |key|\n short_name = key.split('.').last\n @header << (@header.include?(short_name) ? key : short_name)\n end\n @header.join(',') + \"\\n\"\n end",
"def entity_links entities, options={}\n safe_join entities.collect { |entity|\n decorator = entity.decorate\n if options[:external]\n title = content_tag :strong, decorator.title\n title << \" on #{decorator.site.name}\" unless (entity.is_a?(Site)) || (entity.is_a?(PageRef) && entity.site?)\n link_to title, decorator.url, target: :_blank\n else\n homelink decorator # link_to_submit title, linkpath(decorator), :mode => (options[:mode] || :partial)\n end\n }, (options[:joinstr] || ', ').html_safe\n end",
"def link\n Html::Link.new(:href => url) << display_name\n end",
"def display_header\n meta_pad = padding(metadata.keys)\n label = \"#{metadata[:group]} (#{metadata[:language]})\"\n\n header_dashes = '-' * (78 - label.length)\n\n puts \"#{label} #{header_dashes}\"\n end",
"def generic_link(options = {})\n field_data = options[:value]\n contents = field_data.map do |item|\n json = JSON.parse item\n link_to json['text'], json['url']\n end\n content_tag 'span', contents.join('<br>'), nil, false\n end",
"def generic_link(options = {})\n field_data = options[:value]\n contents = field_data.map do |item|\n json = JSON.parse item\n link_to json['text'], json['url']\n end\n content_tag 'span', contents.join('<br>'), nil, false\n end",
"def generateHeader( files )\n output = \"<html><body><h1>CrowdLogs for...:</h1><ul>\"\n files.each do |file|\n output += \"<li><a href='##{file}'>#{file}</a></li>\"\n end\n output += \"</ul>\"\n return output\nend",
"def link_name( truncate: true )\n if ( current_ability.admin? || current_ability.can?(:read, id) )\n title_first( truncate: truncate )\n else\n 'File'\n end\n end",
"def get_linked_name( name_method = :get_short_name )\n if are_results_acquired\n linked_name = h.link_to(\n object.send(name_method),\n meeting_show_full_path(id: object.id),\n { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') }\n )\n elsif has_start_list\n linked_name = h.link_to(\n object.send(name_method),\n meeting_show_start_list_path(id: object.id),\n { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.start_list_tooltip') }\n )\n elsif is_cancelled?\n linked_name = h.content_tag( :s, object.send(name_method) )\n elsif invitation\n linked_name = h.link_to(\n object.send(name_method),\n meeting_show_invitation_path(id: object.id),\n { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.manifest_tooltip') }\n )\n else\n linked_name = object.send(name_method)\n end\n linked_name.html_safe\n end",
"def get_linked_name( name_method = :get_short_name )\n if are_results_acquired\n linked_name = h.link_to(\n object.send(name_method),\n meeting_show_full_path(id: object.id),\n { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') }\n )\n elsif has_start_list\n linked_name = h.link_to(\n object.send(name_method),\n meeting_show_start_list_path(id: object.id),\n { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.start_list_tooltip') }\n )\n elsif is_cancelled?\n linked_name = h.content_tag( :s, object.send(name_method) )\n elsif invitation\n linked_name = h.link_to(\n object.send(name_method),\n meeting_show_invitation_path(id: object.id),\n { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.manifest_tooltip') }\n )\n else\n linked_name = object.send(name_method)\n end\n linked_name.html_safe\n end",
"def to_s\n \"<a href='/object_types/#{id}' class='aquarium-item' id='#{id}'>#{id}</a>\"\n end",
"def group\n @header.group\n end",
"def to_s\n str = @type.to_s.upcase\n if @uri and not @uri.empty?\n str << \"; URI: #{@uri}\"\n end\n str << \"; line #{@line}\"\n if @message and not @message.empty?\n str << \": #{@message}\"\n end\n return str\n end",
"def typus_table_header(model, fields)\n returning(String.new) do |html|\n headers = []\n fields.each do |key, value|\n order_by = model.reflect_on_association(key.to_sym).primary_key_name rescue key\n sort_order = (params[:sort_order] == 'asc') ? 'desc' : 'asc'\n if (model.model_fields.map(&:first).collect { |i| i.to_s }.include?(key) || model.reflect_on_all_associations(:belongs_to).map(&:name).include?(key.to_sym)) && params[:action] == 'index'\n headers << \"<th>#{link_to \"<div class=\\\"#{sort_order}\\\">#{t(key.humanize)}</div>\", { :params => params.merge(:order_by => order_by, :sort_order => sort_order) }}</th>\"\n else\n headers << \"<th>#{t(key.humanize)}</th>\"\n end\n end\n headers << \"<th> </th>\"\n html << <<-HTML\n<tr>\n#{headers.join(\"\\n\")}\n</tr>\n HTML\n end\n end",
"def attribution\n title = name && !name.empty? ? \"<cite>#{name}</cite>\" : \"Photo\"\n licensing_info = \n if license\n \", licensed under <a href='#{@@license_links[license]}'>#{license}</a>\"\n else\n nil\n end\n \"<a href='#{image_address}'>#{title}</a> by \n <a href='#{author_address}'>#{author_name}</a>#{licensing_info}</a>\"\n end",
"def links\n links = Hash.new([])\n order = []\n each_with_rescue(@notes) do |note|\n order << note.row\n links[note.row] += [link_helper(note)]\n end\n\n html = ''\n order.uniq!\n order.each do |row|\n html << \"#{row.is_a?(String) ? row : row.to_s.camelize}: #{links[row].join(\" | \\n\")}<br />\"\n end\n html\n end",
"def student_visit_grp_link(group)\n link_element(xpath: \"//a[contains(@aria-label,'Visit group #{group.title}')]\")\n end",
"def title_headers\r\n @items.collect do |item|\r\n\t \"#{item.title}-#{item.pubDate}\"\r\n\tend\r\n end",
"def append_link( output, text, record )\n return ( output << \" \" << link_to(\n text.html_safe,\n {\n :controller => record.auditable_type.downcase.pluralize,\n :action => 'show',\n :id => record.auditable_id\n }\n )\n ).html_safe()\n end",
"def additional_links\n @additional_links ||= begin\n links = {}\n\n main_link_label = ScihistDigicoll::Util.humanized_content_type(main_file.content_type)\n main_link_label << \" - \" + ScihistDigicoll::Util.simple_bytes_to_human_string(main_file.size)\n\n links[main_link_label] =\n shrine_file_url(shrine_file: main_file, disposition: \"attachment\", filename: item_filename)\n\n if flac_with_m4a?\n # add the original flac link too\n links[\"FLAC - #{ScihistDigicoll::Util.simple_bytes_to_human_string(asset.size)}\"] =\n shrine_file_url(shrine_file: asset.file,\n disposition: \"attachment\",\n filename: DownloadFilenameHelper.filename_for_asset(asset))\n end\n\n links\n end\n end",
"def render_link\n values.map { |v| link(link_field, v) }\n end",
"def link_text\n name\n end",
"def link\n inclusion.strip\n end",
"def sort_link_name(sort_field)\n @args = @args.with_indifferent_access\n class_name = 'fas fa-sort'\n dir = 'up'\n dir = 'down' if sort_direction.to_s == 'DESC'\n class_name = \"fas fa-sort-#{dir}\" if @args[:sort_field] == sort_field\n <<~HTML.html_safe\n <i class=\"#{class_name}\"\n aria-hidden=\"true\"\n style=\"float: right; font-size: 1.2em;\">\n\n <span class=\"screen-reader-text\">\n #{format(_('Sort by %{sort_field}'), sort_field: sort_field.split('.').first)}\n </span>\n </i>\n HTML\n end",
"def format(context)\n\t\treturn \"#{header(context)}#{folders(context)}#{files(context)}\"\n\tend",
"def generate_header_item(item)\n item\n end",
"def asset_links(lab)\n \"#{github_css_link(lab)} · #{github_html_link(lab)}\"\nend",
"def url\n case subject_type\n when USER, 'user'\n user_pretty_url( subject )\n when ALBUM, 'album'\n album_pretty_url( subject )\n when PHOTO, 'photo'\n photo_pretty_url( subject )\n else\n 'http://www.zangzing.com'\n end\n end",
"def header_str\n @columns.collect {|c|\n if @table[c]\n #{}\"%#{@table[c][:size]}s\" % [@table[c][:name]]\n format_data(c, @table[c][:name])\n else\n nil\n end\n }.compact.join(' ')\n end",
"def build_components(group: nil)\n heading_links = if group\n {\n pnsi_link: group_made_available_availability_types_laid_papers_paper_type_path(group_id: group.graph_id, paper_type: 'proposed-negative-statutory-instruments'),\n si_link: group_made_available_availability_types_laid_papers_paper_type_path(group_id: group.graph_id, paper_type: 'statutory-instruments'),\n treaty_link: group_made_available_availability_types_laid_papers_paper_type_path(group_id: group.graph_id, paper_type: 'treaties')\n }\n else\n {\n pnsi_link: work_packages_paper_type_path('proposed-negative-statutory-instruments'),\n si_link: work_packages_paper_type_path('statutory-instruments'),\n treaty_link: work_packages_paper_type_path('treaties')\n }\n end\n\n [\n CardFactory.new(\n heading_text: I18n.t('proposed_negative_statutory_instruments.type').pluralize,\n heading_url: heading_links[:pnsi_link]\n ).build_card,\n CardFactory.new(\n heading_text: I18n.t('statutory_instruments.type').pluralize,\n heading_url: heading_links[:si_link]\n ).build_card,\n CardFactory.new(\n heading_text: I18n.t('treaties.type').pluralize,\n heading_url: heading_links[:treaty_link]\n ).build_card\n ]\n end",
"def generate_value_links_subject(values)\n\n # search value the same as the display value\n # but chained to create a series of searches that is increasingly narrower\n # esample: a - b - c\n # link display search\n # a \"a\"\n # b \"a b\"\n # c \"a b c\"\n\n values.listify.collect do |value|\n# values.listify.select { |x| x.respond_to?(:split)}.collect do |value|\n\n searches = []\n subheads = value.split(\" - \")\n first = subheads.shift\n display = first\n search = first\n title = first\n\n searches << build_subject_url(display, search, title)\n\n unless subheads.empty?\n subheads.each do |subhead|\n display = subhead\n search += ' ' + subhead\n title += ' - ' + subhead\n searches << build_subject_url(display, search, title)\n end\n end\n\n if @add_row_style == :text\n searches.join(' - ')\n else\n searches.join(' > ')\n end\n\n end\n end",
"def to_s\n return \"#{@permissions} #{@owner} #{@group} #{@name}\"\n end",
"def gi_header_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(create_ats_regex_string(\"site-banner\")).a.innerText(\"/GameInformer/\"), __method__)\n end",
"def sorts_with_links\n [\n [search_merge(sort: 'best_match', order: 'desc', page: '1'), 'Relevancy'],\n\n [search_merge(sort: 'date', order: 'asc', page: '1'), 'Published Earliest'],\n [search_merge(sort: 'date', order: 'desc', page: '1'), 'Published Latest'],\n\n [search_merge(sort: 'title', order: 'asc', page: '1'), 'Title A-Z'],\n [search_merge(sort: 'title', order: 'desc', page: '1'), 'Title Z-A']\n ]\n end",
"def source_type(source)\n return \"<div class='source'><img src='https://www.bungie.net/#{source['icon']}' title='#{source['sourceName']}' class='image'><div class='text'><span class='title'>#{source['sourceName']}</span><span class='desc'>#{source['description']}</span></div></div>\".html_safe\n end",
"def to_s\n \"#{@name}, #{@mime_type}\"\n end",
"def make_header(field_string)\r\n return \"<p><b>#{field_string}</b></p>\"\r\n end",
"def headers(spec)\n {\n :charge => charge,\n :parent_ion_mass => spec.parent_ion_mass(charge),\n :title => \"#{spec.sequence.gsub(/\\s+/, \"\")} (#{series.join(', ')})\"\n }\n end"
] | [
"0.57666767",
"0.5554674",
"0.55449826",
"0.5508934",
"0.5475637",
"0.5463846",
"0.5373173",
"0.53267276",
"0.53070956",
"0.5268659",
"0.52500427",
"0.52480745",
"0.5217396",
"0.52102214",
"0.5206908",
"0.5185243",
"0.5180088",
"0.5177367",
"0.5164608",
"0.5155887",
"0.5153308",
"0.51472366",
"0.5110386",
"0.5105977",
"0.51048535",
"0.51008636",
"0.5094939",
"0.506663",
"0.50655895",
"0.50497764",
"0.50308067",
"0.50290716",
"0.50206",
"0.501867",
"0.50131327",
"0.49903503",
"0.49884185",
"0.49824184",
"0.49767712",
"0.49686137",
"0.4948563",
"0.4947602",
"0.49279672",
"0.49248597",
"0.49219096",
"0.49192083",
"0.49154428",
"0.49129552",
"0.49113104",
"0.4908705",
"0.48970875",
"0.48853627",
"0.48812807",
"0.4880115",
"0.48783162",
"0.48731",
"0.48589912",
"0.48568556",
"0.4855779",
"0.48480946",
"0.48412147",
"0.48336357",
"0.48322973",
"0.4827917",
"0.48265305",
"0.48194093",
"0.48050198",
"0.4803601",
"0.4803601",
"0.4801379",
"0.48002073",
"0.47988102",
"0.47988102",
"0.47955152",
"0.4791804",
"0.47842726",
"0.4763863",
"0.47620502",
"0.47569916",
"0.4755405",
"0.4752774",
"0.4752273",
"0.47423303",
"0.47336346",
"0.47311732",
"0.4724474",
"0.47230458",
"0.47215375",
"0.47043115",
"0.47028026",
"0.46970883",
"0.4696317",
"0.46947962",
"0.4692147",
"0.46818534",
"0.46761307",
"0.4673913",
"0.4670109",
"0.46688625",
"0.4664939",
"0.46643284"
] | 0.0 | -1 |
Return an array of paths/as pairs for the given asset types and/or groups. | def _preload_assets_array(assets)
assets.map do |type|
paths = assets_paths(type)
type = type[0] if type.is_a?(Array)
as = TYPE_AS[type]
paths.map{|path| [path, as]}
end.flatten(1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groups_by_asset_type(type)\n arr = []\n groups.each do |group|\n arr << group if !@bundles[group.to_s].assets(type.to_sym).empty?\n end\n return arr\n end",
"def get_assets(type, options = {})\n type = type.to_sym\n\n filtered_assets = []\n\n parents.each do |parent|\n filtered_assets.concat(parent.assets[type]) if parent.assets.include? type\n end if parents\n\n filtered_assets.concat(@assets[type]) if @assets.include?(type)\n\n return [] if filtered_assets.nil? or filtered_assets.empty?\n\n if package_name = options[:package]\n filtered_assets = filter_by_package_name(package_name.to_sym,\n filtered_assets)\n end\n\n if set = options[:set]\n filtered_assets = filter_by_set(set.to_sym, filtered_assets)\n end\n\n # Get asset paths and remove duplicates\n filtered_assets = filtered_assets.map do |asset|\n asset.paths(type)\n end.flatten.uniq\n\n # Remove already rendered assets (paths)\n (filtered_assets - @rendered_assets).tap do |assets|\n @rendered_assets.concat(assets)\n end\n end",
"def filepaths_from *types, &block\n expr = last_option(types)[:matching]\n the_files = types.inject([]) do |files, type|\n method = :\"#{type}_files\"\n files_found = send(method, expr) if respond_to?(method)\n files_found = RailsAssist::Artifact::Files.send(method, expr) if RailsAssist::Artifact::Files.respond_to?(method)\n files + files_found\n end.compact\n yield the_files if block\n the_files\n end",
"def create_assets(groups, paths)\n paths.map do |path|\n file = File.open(dir + path)\n asset = Asset.choose_type(path.split('.').last)\n if path.include?('/')\n path, name = path_and_name(path)\n group = groups[path]\n else\n group = parent_group\n end\n asset.updater = Thread.current[:current_user]\n asset.creator = Thread.current[:current_user]\n asset.update_attributes(:file => file, :name => name, :asset_group_id => group.id)\n asset\n end\n end",
"def input_paths(asset_module, format)\n asset_module.assets(format).map{|asset| asset.absolute_path}\n end",
"def asset_paths\n search_path.children.select { |n| Cnfs::Core.asset_names.include?(base_name(n)) }.sort\n end",
"def find_all_by_asset_types(asset_types, *args)\n with_asset_types(asset_types) { where *args }\n end",
"def asset_type_ids\n assets.scope.uniq.pluck(:asset_type_id)\n end",
"def analyze(asset_category, path_params)\n case asset_category\n when 'vendor'\n path_params.map { |pp| retrieve_vendor_assets(pp) }\n when 'lib'\n path_params.map { |pp| retrieve_lib_assets(pp) }\n when 'app'\n path_params.map { |pp| retrieve_app_asset(pp) }\n end\n end",
"def files_of_type(*types)\n result = []\n return result if types.size == 0\n types.each do |type|\n unless files_by_type[type.to_s].nil?\n files_by_type[type.to_s].each {|file| result << file}\n break\n end\n end\n result\n end",
"def resolve_sharing_params(params)\n param_not_isa = params[:share_not_isa] || {}\n param_isa = params[:share_isa] || {}\n\n if param_not_isa.blank? && param_isa.blank?\n [@asset].compact\n else\n assets = []\n Seek::Util.authorized_types.each do |klass|\n ids = (param_not_isa[klass.name]&.keys || []) | (param_isa[klass.name]&.keys || [])\n assets += klass.where(id: ids).to_a if ids.any?\n end\n assets.compact.uniq\n end\n end",
"def type_images(types)\n @type_map ||= { \n N::TALIA.Source => 'source',\n N::FOAF.Group => 'group',\n N::FOAF.Person => 'person'\n }\n result = ''\n types.each do |t|\n image = @type_map[t] || 'source'\n name = t.local_name.titleize\n result << link_to(image_tag(\"talia_core/#{image}.png\", :alt => name, :title => name),\n :action => 'index', :filter => t.to_name_s('+')\n )\n end\n result\n end",
"def asset_paths\n paths = @parts.values.map(&:asset_path)\n paths << File.dirname(script) if script\n paths << File.dirname(stylesheet) if stylesheet\n paths.compact.uniq\n end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def resources_by_type(ast)\n raise_unless_xpath!(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each do |resource|\n result[resource_type(resource)] << resource\n end\n result\n end",
"def asset_files\n asset_files = []\n Find.find(assets_path).each do |path|\n next if File.directory?(path)\n next if path.include?(stylesheets_path) || path.include?(images_path)\n asset_files << path.sub(assets_path, 'assets')\n end\n asset_files\n end",
"def resolve_sharing_params(params)\n param_not_isa = params[:share_not_isa]\n param_isa = params[:share_isa]\n\n if param_not_isa.blank? && param_isa.blank?\n [@asset].compact\n else\n assets = []\n unless param_not_isa.blank?\n param_not_isa.keys.each do |asset_class|\n param_not_isa[asset_class].keys.each do |id|\n assets << eval(\"#{asset_class}.find_by_id(#{id})\")\n end\n end\n end\n unless param_isa.blank?\n param_isa.keys.each do |asset_class|\n param_isa[asset_class].keys.each do |id|\n assets << eval(\"#{asset_class}.find_by_id(#{id})\")\n end\n end\n end\n assets.compact.uniq\n end\n end",
"def get_assets asset\n return [] if @crawl_results.empty? # No crawling yet? Return empty search\n\n # The asset parameter can only be images, stylesheets or scripts\n unless %w(images stylesheets scripts).include? asset.to_s\n # Display error message in this case.\n SuperCrawler::Render.error \"`asset` parameter can only be `images`, `stylesheets` or `scripts`\"\n return [] # Return empty array\n end\n\n # Good! Return flatten array of unique assets\n return @crawl_results.map{ |cr| cr[:assets][asset.to_sym] }.flatten.uniq\n end",
"def for_array_at_path_enumerate_types_and_paths(array_path:, types_and_paths:)\n array = @params.dig(*array_path)\n\n array.each.with_index.reduce([]) do |acc, (_, index)|\n [\n *acc,\n *self.class.prepend_path_to_paths(\n prepend_path: [*array_path, index],\n types_and_paths: types_and_paths\n )\n ]\n end\n rescue StandardError\n []\n end",
"def generate(type, options={})\n\t\t\toptions = {\n\t\t\t\t:inline => false,\n\t\t\t}.merge(options)\n\t\t\tpacks = []\n\t\t\trender_comb, render_indv = @assets[type].reject{ |a| options[:inline] ^ a.inline? }.partition{ |a| a.combine? }\n\n\t\t\tunless render_comb.empty?\n\t\t\t\tpacks << AssetPack.new(type, render_comb, @options)\n\t\t\tend\n\n\t\t\trender_indv.each do |asset|\n\t\t\t\tpacks << AssetPack.new(type, asset, @options)\n\t\t\tend\n\t\t\treturn packs\n\t\tend",
"def paths(arrs)\n arrs.inject([[]]) do |paths, arr|\n arr.map {|e| paths.map {|path| path + [e]}}.flatten(1)\n end\n end",
"def all(path, type); end",
"def assets\r\n\t\t@graph_by_id.map{ |id,graph_element| asset_for_el(graph_element) }\r\n\tend",
"def get_assets(category = nil)\r\n # Prepare query url.\r\n _path_url = '/gem_assets'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 'category' => category\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\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| Asset.from_hash(element) }\r\n end",
"def matching_links(type)\n link_pattern = config.public_send(\"link_#{type}_pattern\")\n return [] unless link_pattern\n\n metadata\n .select { |key| __send__(\"#{type}?\", key) }\n .map { |key, value| Allure::ResultUtils.public_send(\"#{type}_link\", key.to_s, value, link_pattern) }\n end",
"def paths_to_array\n [{:paths => paths.collect {|p| p.to_array}}]\n end",
"def getTypeUrlFromTypesObject(types)\n return types.map {|x| x['type']['url']}.compact\nend",
"def images\n [assets.find_all { |asset| asset.is_a? MDL::BorealisImage }].flatten\n end",
"def effective_paths(type)\n smart_paths = @smart_paths\n loader = @loader\n effective_paths = smart_paths[type]\n unless effective_paths\n # type not yet processed, does the various directories for the type exist ?\n # Get the relative dirs for the type\n paths_for_type = LoaderPaths.relative_paths_for_type(type, loader)\n # Check which directories exist in the loader's content/index\n effective_paths = smart_paths[type] = paths_for_type.select { |sp| loader.meaningful_to_search?(sp) }\n end\n effective_paths\n end",
"def resolve_paths names\n if context.tag_filters.any?\n # Bats doesn't support tags\n []\n elsif names.any?\n paths = []\n for name in names\n paths.concat Array(resolve_name name)\n end\n paths\n else\n [test_dir]\n end\n end",
"def urls\n @url.map do |el|\n case el\n when %r{^IANA$}\n IANA_URL % [ @media_type, @sub_type ]\n when %r{^RFC(\\d+)$}\n RFC_URL % $1\n when %r{^DRAFT:(.+)$}\n DRAFT_URL % $1\n when %r{^LTSW$}\n LTSW_URL % @media_type\n when %r{^\\{([^=]+)=([^\\}]+)\\}}\n [$1, $2]\n when %r{^\\[([^=]+)=([^\\]]+)\\]}\n [$1, CONTACT_URL % $2]\n when %r{^\\[([^\\]]+)\\]}\n CONTACT_URL % $1\n else\n el\n end\n end\n end",
"def resource_attributes_by_type(ast)\n result = {}\n resources_by_type(ast).each do |type,resources|\n result[type] = resources.map{|resource| resource_attributes(resource)}\n end\n result\n end",
"def resource_attributes_by_type(ast)\n result = {}\n resources_by_type(ast).each do |type,resources|\n result[type] = resources.map{|resource| resource_attributes(resource)}\n end\n result\n end",
"def resource_attributes_by_type(ast)\n result = {}\n resources_by_type(ast).each do |type,resources|\n result[type] = resources.map{|resource| resource_attributes(resource)}\n end\n result\n end",
"def asset_group_type\n MotionAL.asset_group_types.key(@al_asset_group.valueForProperty(ALAssetsGroupPropertyType))\n end",
"def aggregate_subpaths(asset_aggregator)\n [ subpath ]\n end",
"def path_array\n a = []\n each_filename { |ea| a << ea }\n a\n end",
"def assets\n content_mappings.collect{|mapping| mapping.asset }\n end",
"def retrieve_assets_from(manifest)\n # TODO: Rspec Examples for non-Existed Files\n return [] if @parsed_manifests.include?(manifest) || !FileTest.exist?(manifest)\n @parsed_manifests.push(manifest)\n\n required_assets = []\n directive = Directive.new(asset_type)\n\n Pathname.new(manifest).each_line do |line|\n required_assets.concat(analyze(*directive.parse(line))) if directive.legal_directive?(line)\n end\n\n required_assets.flatten\n end",
"def generate_groups(groups, type)\r\n [].tap do |results|\r\n groups.each do |n, obj|\r\n group = {}\r\n group[\"name\"] = obj['name']\r\n group[\"code\"] = n\r\n group[\"risk_category\"] = \"AUTO\"\r\n group[type] = obj[type]\r\n results << group\r\n end\r\n end\r\nend",
"def asset_paths\n @asset_paths ||= [prefix] \n end",
"def filter_class_assets(asset_type)\n self.class.send(\"#{asset_type}_specific\").map { |a| a[:controller] == self.class.to_s ? a[:asset] : nil }.compact\n end",
"def each_asset\n assets.each do |(path, destination)|\n path = path.to_s\n if destination == :root\n yield path, File.join(output_directory.to_s, File.basename(path))\n else\n yield path, File.join(output_directory.to_s, destination.to_str)\n end\n end\n end",
"def path(type)\n registry[type] || []\n end",
"def prepare_assets(assets)\n (assets || {}).each do |name, asset|\n if asset.is_a?(Hash)\n (asset || {}).each do |subname, subasset|\n prepare_asset(assets, subasset, name, subname)\n end\n else\n prepare_asset(assets, asset, name)\n end\n end\n end",
"def asset_filenames\n pogo = format('pokemon_icon_%<number>03d_%<asset_id>02d.png',\n number: number, asset_id: asset_id)\n filenames = [pogo]\n\n if form?\n filenames << format('%<number>d-%<form>s.png',\n number: number, form: form.to_s)\n end\n\n filenames << number.to_s + \".png\"\n filenames\n end",
"def formats\n @formats ||= Dir[File.join(path, \"#{name}.{otf,svg,ttf,woff,woff2,eot}\")].map {|file| File.extname(file)[1..-1] }.sort\n end",
"def matching_sets(path, type); end",
"def aliases(media_type)\n registered_aliases.map { |a| media_type.type(a).to_s }\n end",
"def selectors\n if resource_rule? # Resource specific rules\n i = [{type: 'resource'}]\n i = i.product(api_groups) if api_groups.any?\n i = i.product(resources) if resources.any?\n i = i.product(verbs) if verbs.any?\n else # Non-resource URLs rules\n i = [{type: 'non-resource'}]\n i = i.product(urls) if urls.any?\n i = i.product(verbs) if verbs.any?\n end\n\n i.map do |x|\n x.flatten.reduce(&:merge)\n end\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def paths\n Hash[ (formats + self.class::VERSION_FORMATS.keys).map{ |f| [f, path(f)] } ]\n end",
"def mime_types\n [].tap do |result|\n @parts.each do |part|\n result << part.content_type\n end\n end\n end",
"def each(options = {}, &block)\n raise \"MotionAL::Assets.each does not support :group option. Use MotionAL::Asset.find_all to get other group assets.\" if options[:group]\n\n options[:group] = @group\n\n MotionAL::Asset.find_all(options) do |asset, error|\n block.call(asset, error)\n end\n end",
"def path_assets\n arr_classes = page_classes.split( ' ' )\n\n if arr_classes.length < 2\n\n arr_classes[ 0 ]\n\n else\n\n arr_section = arr_classes[ ( arr_classes.length - 1 ) ].split( '_' )\n asset_path = ''\n\n arr_section.each_with_index do |lista, i|\n if i == ( arr_section.length - 1 )\n asset_path = asset_path + lista\n else\n asset_path = asset_path + lista + '/'\n end\n end\n\n asset_path\n\n end\n end",
"def index\n @asset_types = Asset.grouped_by_category\n @grouping = 'by_category'\n\n respond_to do |format|\n format.html { render :action => 'index'}\n format.xml { @asset_types.to_xml }\n format.js { render :action => 'index'}\n end\n end",
"def logical_paths\n return to_enum(__method__) unless block_given?\n\n seen = Set.new\n\n paths.each do |load_path|\n stat_tree(load_path).each do |filename, stat|\n next unless stat.file?\n\n path = split_subpath(load_path, filename)\n path, mime_type, _, _ = parse_path_extnames(path)\n path = normalize_logical_path(path)\n path += mime_types[mime_type][:extensions].first if mime_type\n\n if !seen.include?(path)\n yield path, filename\n seen << path\n end\n end\n end\n\n nil\n end",
"def files_from_generator_output(output, type = 'create')\n output.to_a.map { |line| line.scan(/#{type}\\s+([^\\s]+)$/).flatten.first }.compact.select { |f| File.exist?(f) and !File.directory?(f) }\nend",
"def known_assets\n assets = Rails.application.config.assets.digests.to_a.flatten.map do |asset|\n [asset, \"#{asset}.gz\"]\n end.flatten\n assets + %w(manifest.yml sources_manifest.yml)\n end",
"def all_by_name_and_type(name, type)\n where(name: name, array_type: type).order_by(&:array_index).to_a\n end",
"def appendGlobs(arr, patterns); patterns.each { |p| arr << Dir.glob(p) }; arr.flatten end",
"def logical_paths\n return to_enum(__method__) unless block_given?\n\n seen = Set.new\n\n self.paths.each do |load_path|\n stat_tree(load_path).each do |filename, stat|\n next unless stat.file?\n\n path = split_subpath(load_path, filename)\n path, mime_type, _ = parse_path_extnames(path)\n path = normalize_logical_path(path)\n path += mime_types[mime_type][:extensions].first if mime_type\n\n if !seen.include?(path)\n yield path, filename\n seen << path\n end\n end\n end\n\n nil\n end",
"def path_arr()\n return @paths\n end",
"def expand_files map, config\n files = Array.new\n if config.has_key? map\n config[map].each do |v|\n m = /^\\/.*/.match v #starts with /, otherwise it's a group name\n if m\n files << m.to_s\n else\n files + (expand_files m.to_s, config)\n end\n end\n end\n return files\nend",
"def structure_pairs(name) \n structure(name).map do |rel|\n sym = nil\n ret = case rel\n when Symbol\n sym = rel\n send(sym)\n when Relationship\n sym = rel.sym\n link_or_embedded_resource_for_rel(rel)\n end #case rel\n [sym, ret]\n end\n end",
"def included_asset_groups\n @included_scan_targets[:asset_groups]\n end",
"def get_asset_groups_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AssetGroupApi.get_asset_groups ...'\n end\n # resource path\n local_var_path = '/api/3/asset_groups'\n\n # query parameters\n query_params = {}\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'PageOfAssetGroup')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AssetGroupApi#get_asset_groups\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def files(bundle = true)\n (@app and bundle) ? ::Asset.bundle[@type] : [@path]\n end",
"def resolve_all(path, options = {}, &block)\n return to_enum(__method__, path, options) unless block_given?\n path = path.to_s\n\n # TODO: Review performance\n name, extname, _ = parse_path_extnames(path)\n format_content_type = mime_types[extname]\n content_type = options[:content_type] || format_content_type\n\n if format_content_type && format_content_type != content_type\n return\n end\n\n if absolute_path?(path)\n resolve_absolute_path(path, name, extname, content_type, &block)\n else\n resolve_all_logical_paths(name, extname, content_type, &block)\n end\n\n nil\n end",
"def getAnts(groupName)\n\n result = `/home/obs/ruby/bin/fxconf.rb sals`\n\n list = [];\n\n # Get the antennas in the \"groupName\" group\n result.each do |line| \n line = line.chomp.strip; \n if(line.include?(groupName) == true) \n parts = line.chomp.split(/\\s+/);\n parts[1..-1].each do |a|\n list << Ant.new(a);\n end\n end\n end \n return list; \nend",
"def collect_paths(*paths)\n raw = [] # all paths and globs\n plus = Set.new # all paths to expand and add\n minus = Set.new # all paths to remove from plus set\n\n # assemble all globs and simple paths, reforming our glob notation to ruby globs\n paths.each do |paths_container|\n case (paths_container)\n when String then raw << (FilePathUtils::reform_glob(paths_container))\n when Array then paths_container.each {|path| raw << (FilePathUtils::reform_glob(path))}\n else raise \"Don't know how to handle #{paths_container.class}\"\n end\n end\n\n # iterate through each path and glob\n raw.each do |path|\n\n dirs = [] # container for only (expanded) paths\n\n # if a glob, expand it and slurp up all non-file paths\n if path.include?('*')\n # grab base directory only if globs are snug up to final path separator\n if (path =~ /\\/\\*+$/)\n dirs << FilePathUtils.extract_path(path)\n end\n\n # grab expanded sub-directory globs\n expanded = @file_wrapper.directory_listing( FilePathUtils.extract_path_no_aggregation_operators(path) )\n expanded.each do |entry|\n dirs << entry if @file_wrapper.directory?(entry)\n end\n\n # else just grab simple path\n # note: we could just run this through glob expansion but such an\n # approach doesn't handle a path not yet on disk)\n else\n dirs << FilePathUtils.extract_path_no_aggregation_operators(path)\n end\n\n # add dirs to the appropriate set based on path aggregation modifier if present\n FilePathUtils.add_path?(path) ? plus.merge(dirs) : minus.merge(dirs)\n end\n\n return (plus - minus).to_a.uniq\n end",
"def find_files(block)\n files = []\n block.scan(URL_PATTERN).each do |attribute, path|\n if !URI.parse(path).absolute?\n resource = create_resource_file(attribute, path)\n files << resource if resource\n end\n end\n files\n end",
"def resolve_paths names\n if names.any?\n paths = []\n for name in names\n paths.concat Array(resolve_name name)\n end\n paths\n else\n Array(resolve_as_directory test_dir_name)\n end\n end",
"def assets_for_post(assets)\n html, files, images = %(), %(), %()\n unless assets.empty?\n assets.each do |asset|\n if asset.same_type?('jpg') || asset.same_type?('png') || asset.same_type?('gif') || asset.same_type?('jpeg') \n images << build_list_assets_by_type_to_post(asset)\n elsif asset.same_type?('rar') || asset.same_type?('zip') || asset.same_type?('pdf') || asset.same_type?('txt')\n files << build_list_assets_by_type_to_post(asset, asset.type)\n end\n end \n end\n html << content_tag(:h3, \"Galeria de imagens\")\n html << content_tag(:ul, images.html_safe, :class => 'thumbnails gallery') unless images.empty?\n html << \"<hr />\".html_safe\n html << content_tag(:h3, \"Arquivos relacionados\")\n html << content_tag(:ul, files.html_safe, :class => 'thumbnails') unless files.empty?\n html.html_safe\n end",
"def paths\n @paths ||= [\n data_path,\n output_path,\n converted_path,\n converted_fail_path,\n unpacked_path,\n unpacked_fail_path,\n recreated_path,\n ]\n end",
"def glob_data_paths(pattern,&block)\n return enum_for(:glob_data_paths,pattern).to_a unless block_given?\n\n DataPaths.paths.each do |path|\n Dir.glob(File.join(path,pattern),&block)\n end\n end",
"def assets\n uniq = {}\n sets = manifests.map(&:assets)\n sets.each do |assets|\n assets.each do |rel_path, abs_path|\n uniq[rel_path] = abs_path unless uniq.key?(rel_path)\n end\n end\n uniq\n end",
"def assets\n @assets ||= []\n end",
"def asset_type\n return self.class.to_s.gsub(/^.*::/,'').gsub(/AssetSet/,'').gsub(/([^^])([A-Z])/,'$1_$2').downcase.to_sym\n end",
"def list_anat_files(options = {}) \n subs = all_subjects\n filt_subs = looked_for(options[:subjects])\n filt_sess = looked_for(options[:sessions])\n filt_types = looked_for(options[:t_types] || [ \"T1\", \"T2\" ]) \n scans_list = all_scans(subs, filt_subs, filt_sess, filt_types) \n results = []\n scans_list.each do |scan_dir|\n resources_path = \"#{scan_dir}/Resources\"\n scanlist_type = list_files(\"#{resources_path}\", :directory).map { |e| Pathname.new(e.name).basename.to_s }\n scanlist_type.each do |scan_type|\n scanlist = list_files(\"#{resources_path}/#{scan_type}/Files\", :regular).map { |e| Pathname.new(e.name).basename.to_s }\n if (! options[:ext].blank?) && options[:ext].is_a?(Regexp)\n scanlist = scanlist.select { |scan| scan.match(options[:ext]) }\n end\n scanlist.each { |scan| results << \"#{resources_path}/#{scan_type}/Files/#{scan}\" }\n end \n end\n results\n end",
"def get_locations(type)\n case type\n when 'default'\n cb_file = File.join(@opts[:path], '.kitchen.yml')\n source_file = template_location(type)\n else\n cb_file = File.join(@opts[:path], '.kitchen.local.yml')\n source_file = template_location(type)\n end\n\n [cb_file, source_file]\n end",
"def get_file_groups globs\n \t\t pos = 1\n \t\t file_groups = { groups: [] }\n \t\t \n globs.each do |glob|\n # e.g { group1: { path: '*.*', files: [file1, file2]} }\n group_name = \"group#{pos}\"\n files_raw = Dir.glob(glob)\n\t\t\t\tfiles = files_raw.map do |f|\n\t \tURI.escape f\n end\n file_group_object = { name: group_name, path: glob, files: files , files_raw: files_raw}\n file_groups[group_name.to_sym] = file_group_object\n file_groups[:groups].push file_group_object\n pos += 1 \n end\n file_groups\n \t\tend",
"def geom_types\n case resource_decorator.model\n when ScannedMap\n if resource_decorator.mosaic_file_count.positive?\n [\"Image\", \"Raster\"]\n else\n [\"Image\"]\n end\n when RasterResource\n [\"Raster\"]\n when VectorResource\n [vector_geom_type]\n end\n end",
"def items_for_type(type)\n all_ids = []\n valid_ids = []\n AllItems.get.each do |item_code, values|\n _item_name, item_type, item_valid = values\n next unless item_type == type\n all_ids << item_code\n valid_ids << item_code if item_valid\n end\n\n [all_ids, valid_ids]\n end",
"def retrieve_action_assets\n action_path = PathInfo.new(\"#{app_path.to_s}/#{@controller}\")\n single_action_path = PathInfo.new(\"#{action_path}/#{@action}.#{asset_extension}\")\n indexed_action_path = PathInfo.new(\"#{action_path}/#{@action}\")\n manifest = nil\n\n manifest = single_action_path if FileTest.exist?(single_action_path)\n\n action_index = \"#{indexed_action_path}/index.#{asset_extension}\"\n manifest = PathInfo.new(action_index) if FileTest.exist?(action_index)\n\n @assets.concat(retrieve_assets_from(manifest)) unless manifest.nil?\n\n if FileTest.exist?(indexed_action_path)\n auto_required_assets = Dir[\"#{action_path}/#{@action}/**/*.#{asset_extension}\"]\n\n @assets.concat(auto_required_assets.map{ |ass| PathInfo.new(ass).rel })\n else\n @assets << manifest.rel unless manifest.nil?\n end\n end",
"def possible_paths(opts)\n # file_names is implemented in each store.\n file_names(opts).map { |file_name| possible_paths_file(opts, file_name) }.flatten\n end",
"def list type\n Dir.chdir(\"#{Rails.root}/#{type.to_s}\")\n @files[type] = Dir.glob(\"**/*.#{@paths[type]}\")\n end",
"def artifacts(*specs, &block)\n specs.flatten.inject([]) do |set, spec|\n case spec\n when ArtifactNamespace\n set |= spec.artifacts\n when Symbol, Hash\n set |= [artifact(spec)]\n when /([^:]+:){2,4}/ # A spec as opposed to a file name.\n set |= [artifact(spec)]\n when String # Must always expand path.\n set |= [File.expand_path(spec)]\n when Project\n set |= artifacts(spec.packages)\n when Rake::Task\n set |= [spec]\n when Struct\n set |= artifacts(spec.values)\n else\n if spec.respond_to? :to_spec\n set |= artifacts(spec.to_spec)\n else\n fail \"Invalid artifact specification in #{specs.inspect}\"\n end\n end\n end\n end",
"def glob_for(type) Merb.load_paths[type][1] end",
"def get_asset(release_info, filepattern, contenttype)\n filepattern_regexp = Regexp.new(\n filepattern,\n Regexp::IGNORECASE,\n )\n\n contenttype_regexp = Regexp.new(\n contenttype,\n Regexp::IGNORECASE,\n )\n Puppet.debug('Checking assets')\n release_info['assets'].each do |release_asset|\n Puppet.debug(\n Kernel.format(\n 'Checking asset %{name} for RegExp %{regexp}',\n name: release_asset['name'],\n regexp: filepattern_regexp.to_s,\n ),\n )\n Puppet.debug(\n Kernel.format(\n 'Checking content type %{content_type} for RegExp %{regexp}',\n content_type: release_asset['content_type'],\n regexp: contenttype_regexp.to_s,\n ),\n )\n next unless filepattern_regexp.match(\n release_asset['name'],\n ) && contenttype_regexp.match(release_asset['content_type'])\n\n Puppet.debug(\n Kernel.format(\n 'Both are matching. Returning URL %{url}',\n url: release_asset['browser_download_url'],\n ),\n )\n\n return release_asset['browser_download_url'] if release_asset.key?('browser_download_url')\n end\n\n ''\nend",
"def externals(type)\n @externals ||= []\n\n type = type.to_sym\n parent_externals = if superclass.respond_to?(:externals)\n superclass.externals(type)\n else\n []\n end\n\n my_externals = @externals.select do |external|\n external.type == type\n end\n\n (parent_externals + my_externals).uniq\n end",
"def get_assets(organization_id_list, fiscal_year, asset_type_id=nil, asset_subtype_id=nil )\n TransitAsset.operational.joins(:fta_asset_category, :fta_asset_class)\n .joins('INNER JOIN asset_subtypes ON asset_subtypes.id = transam_assets.asset_subtype_id')\n .joins('INNER JOIN organizations ON organizations.id = transam_assets.organization_id')\n .joins('LEFT JOIN fta_vehicle_types ON transit_assets.fta_type_id = fta_vehicle_types.id AND transit_assets.fta_type_type=\"FtaVehicleType\"')\n .joins('LEFT JOIN fta_equipment_types ON transit_assets.fta_type_id = fta_equipment_types.id AND transit_assets.fta_type_type=\"FtaEquipmentType\"')\n .joins('LEFT JOIN fta_support_vehicle_types ON transit_assets.fta_type_id = fta_support_vehicle_types.id AND transit_assets.fta_type_type=\"FtaSupportVehicleType\"')\n .joins('LEFT JOIN fta_facility_types ON transit_assets.fta_type_id = fta_facility_types.id AND transit_assets.fta_type_type=\"FtaFacilityType\"')\n .joins('LEFT JOIN fta_track_types ON transit_assets.fta_type_id = fta_track_types.id AND transit_assets.fta_type_type=\"FtaTrackType\"')\n .joins('LEFT JOIN fta_guideway_types ON transit_assets.fta_type_id = fta_guideway_types.id AND transit_assets.fta_type_type=\"FtaGuidewayType\"')\n .joins('LEFT JOIN fta_power_signal_types ON transit_assets.fta_type_id = fta_power_signal_types.id AND transit_assets.fta_type_type=\"FtaPowerSignalType\"').where(organization_id: organization_id_list)\n end",
"def paths_for(controller=:_all,action=:_all)\n return files_for(:paths,controller,action)\n end",
"def asset_resolver_strategies; end",
"def asset_resolver_strategies; end",
"def math_images_paths(modality = nil)\n math_images.to_a(modality).uniq_by{ |v| v.basename }\n end",
"def image_types\n [\"image/jpeg\", \"image/png\", \"image/jpg\", \"image/gif\", \"image/tif\"]\n end",
"def image_types\n [\"image/jpeg\", \"image/png\", \"image/jpg\", \"image/gif\", \"image/tif\"]\n end",
"def expound_paths(*entries)\n paths = []\n\n entries.each do |entry|\n entry = entry.strip\n\n next if entry.empty?\n next if entry.start_with?('#')\n\n if File.directory?(entry)\n if library_path?(entry)\n paths << entry\n else\n if File.directory?(File.join(entry, 'gems'))\n subpaths = Dir.glob(File.join(entry, 'gems/*/'))\n else\n subpaths = Dir.glob(File.join(entry, '*/'))\n end\n subpaths.each do |subpath|\n paths << subpath if library_path?(subpath)\n end\n end\n elsif File.file?(entry)\n paths.concat(expound_paths(*File.readlines(entry)))\n else\n glob_paths = Dir.glob(entry)\n if glob_paths.first != entry\n paths.concat(expound_paths(*glob_paths))\n end\n end\n end\n\n paths\n end"
] | [
"0.6720017",
"0.66494125",
"0.6104565",
"0.610242",
"0.5847597",
"0.57444996",
"0.5533651",
"0.5492172",
"0.5486772",
"0.54427785",
"0.5433832",
"0.5421612",
"0.540857",
"0.54022443",
"0.54022443",
"0.53719497",
"0.52690303",
"0.52605104",
"0.5236442",
"0.5216548",
"0.51927185",
"0.5185438",
"0.50987035",
"0.50883186",
"0.50850147",
"0.5051437",
"0.5010339",
"0.5006201",
"0.50023884",
"0.49976864",
"0.49931616",
"0.49891904",
"0.49856302",
"0.49856302",
"0.49856302",
"0.49612072",
"0.49465075",
"0.49447295",
"0.49394286",
"0.49197114",
"0.49159485",
"0.4908505",
"0.4904571",
"0.49035078",
"0.4875909",
"0.4871241",
"0.4868637",
"0.4856527",
"0.48562688",
"0.4849964",
"0.4844151",
"0.48402208",
"0.48396155",
"0.48356166",
"0.48243934",
"0.4817871",
"0.48023778",
"0.47842875",
"0.47824246",
"0.47803938",
"0.47759056",
"0.47746348",
"0.47704536",
"0.47576973",
"0.47525072",
"0.47514492",
"0.47371",
"0.472083",
"0.47129458",
"0.4706333",
"0.4688438",
"0.46816722",
"0.46782142",
"0.4675679",
"0.46753255",
"0.46634617",
"0.4649701",
"0.4647438",
"0.46453255",
"0.4644723",
"0.46368048",
"0.46353891",
"0.46329996",
"0.46256012",
"0.46239758",
"0.46206832",
"0.46186915",
"0.46136707",
"0.46049455",
"0.45842293",
"0.45793644",
"0.45722568",
"0.45711613",
"0.45698217",
"0.45576245",
"0.45576245",
"0.4553059",
"0.45448533",
"0.45448533",
"0.45437798"
] | 0.607574 | 4 |
before_filter :check, :only=>[:create] crudify :'refinery/ships/ship', :xhr_paging => true before_filter :all_collections, :only=>[:new, :edit] | def index
if client_signed_in?
@ships = Refinery::Ships::Ship.includes(:translations, :page_status).where(:client_id=>current_client.id).order('updated_at DESC')
@all = @ships
@moderate = @ships.select{|ship| ship.page_status.id == 1}
@published = @ships.select{|ship| ship.page_status.id == 2}
if (params[:status]=='1' or params[:status]=='2')
params[:status]=='1' ? @ships = @moderate : @ships = @published
end
else
redirect_to(root_path)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:company_id] == nil\n render status: 422, json: {errors: ['company_id is required']}\n else\n @shipments = filter(params)\n @shipments = sort_accordingly_to_params(params, @shipments)\n @shipments = make_pagination(params, @shipments)\n render 'index'\n end\n end",
"def before_filter; end",
"def index\n @filter = SupplierRequestFilter.new(filter_params)\n @supplier_requests = @filter.call(@supplier, current_user).page(params[:page])\n end",
"def new_action_before\n @status = true\n @suppliers = Supplier.all\n end",
"def index\n # @ships = Ship.paginate(:page => params[:page], :per_page => 5)\n #sorts the ship list by empire and name (remember #sort_by sorts \n #from left to right so you can have multiple criteria)\n ships = Ship.all\n @ships = ships.sort_by { |v| [v[:empire_image], v[:cost]] }\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ships }\n end\n end",
"def prepare_show\n @page = params[:page] || 1\n types = CollectionItem.types\n @collection_item_scopes = [[I18n.t(:selected_items), :selected_items], [I18n.t(:all_items), :all_items]]\n @collection_item_scopes << [I18n.t(\"all_#{types[@filter.to_sym][:i18n_key]}\"), @filter] if @filter\n @recently_visited_collections = Collection.find_all_by_id(recently_visited_collections(@collection.id)) if @collection\n end",
"def fee_collection_view\n @batchs = Batch.active\n end",
"def show\n init_collection\n render 'edit'\n end",
"def index\n @reservation_requests = ReservationRequest.all.order(created_at: :desc)\n #@reservation_requests = Kaminari.paginate_array(@reservation_requests).page(params[:page]).per(5)\n @filterrific = initialize_filterrific(\n ReservationRequest,\n params[:filterrific],\n persistence_id: false\n ) or return\n\n @reservation_requests = @filterrific.find.page(params[:page]).paginate(:per_page => 5, :page => params[:page])\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n # No authorize! call here to filter viewable items in the list.\n # We're assuming if you can view the index, you can see all published and\n # unpublished collections.\n\n\n # NOTE WELL: To use ransack, all attributes we want ransack to search or sort\n # on NEED TO be listed in Colletion.ransackable_attributes and/or Collection.ransackable_associations\n @q = Collection.ransack(params[:q]).tap do |ransack|\n ransack.sorts = 'title asc' if ransack.sorts.empty?\n end\n\n scope = @q.result\n if params[:title_or_id].present?\n scope = scope.where(id: params[:title_or_id]\n ).or(\n Collection.where(friendlier_id: params[:title_or_id])\n ).or(\n Collection.where(\"title ilike ?\", \"%\" + Collection.sanitize_sql_like(params[:title_or_id]) + \"%\")\n )\n end\n\n if params[:department].present?\n scope = scope.where(\"json_attributes ->> 'department' = :department\", department: params[:department])\n @department = params[:department]\n end\n\n @collections = scope.page(params[:page]).per(100)\n end",
"def index\n @should_apply_purity_settings = true\n minimum_wallpapers = 4\n\n if @user.present?\n # Viewing user's collections. They are ordered.\n @collections = @user.collections.ordered\n\n @should_apply_purity_settings = false if myself?\n minimum_wallpapers = 0\n else\n @collections = Collection.latest\n end\n\n if @should_apply_purity_settings\n @collections = @collections.not_empty_for_purities(current_purities, minimum_wallpapers)\n end\n\n # Common\n @collections = @collections.includes(user: :profile)\n .accessible_by(current_ability, :read)\n .page(params[:page]).per(20)\n\n if request.xhr?\n render partial: 'list', layout: false, locals: { collections: @collections, should_apply_purity_settings: @should_apply_purity_settings }\n end\n end",
"def index\n @ships = Ship.all\n end",
"def index\n @ships = Ship.all\n end",
"def index\n if current_user && current_user.admin?\n @sponsorships = Sponsorship.paginate(:page=>params[:page],:per_page=>10).recent\n else\n #flash[:notice] = \"No such page exists\"\n redirect_to new_sponsorship_path\n end \n end",
"def collection\n @collection = Collection.find(params[:collection_id])\n\n \n\n @cab_configs = CabConfig.where(collection_id: @collection.id)\n render 'index'\n \n\n\n end",
"def index\n #@shipments = Shipment.all\n @shipments = Shipment.accessible_by(current_ability)\n end",
"def run_filters\n set_user\n authorize\n end",
"def index\n @shipings = Shiping.all\n end",
"def index\n session[:ppage] = (params[:per_page].to_i rescue 25) if (params[:per_page] && (not params[:per_page.blank?] ) )\n @per_page = session[:ppage].to_s\n params[:ppage] = session[:ppage]\n\n if (params[:status].present? && CollectionPoint.collection_points_status.include?(params[:status].to_sym) )\n @active = params[:status].to_sym\n @collection_points = CollectionPoint.where(status: params[:status]).order(:name)\n else\n @collection_points = CollectionPoint.order(:name)\n @active = \"all\"\n end\n @collection_points = @collection_points.page(params[:page]).per(session[:ppage])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collection_points }\n end\n end",
"def index\n @resources = Catalogs::Level.search(params[:search]).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 11, page: params[:page])\n authorize @resources\n end",
"def fee_collection_edit\n @finance_fee_collection = FinanceFeeCollection.find params[:id]\n @batch=Batch.find(params[:batch_id])\n end",
"def index\n\n manage_filter_state\n @contracting_request_document_types = ContractingRequestDocumentType.paginate(:page => params[:page], :per_page => per_page || 10).order(sort_column + ' ' + sort_direction)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contracting_request_document_types }\n format.js\n end\n end",
"def show\n @stores = Store.admin_grid(params).order(sort_column + \" \" + sort_direction).\n paginate(:page => pagination_page, :per_page => pagination_rows)\n if params[:update_products].present? \n @products = Product.order(sort_column + \" \" + sort_direction)\n @update_products = true\n end \n end",
"def index\n @filterrific = initialize_filterrific(\n CircPolicyMatrix,\n params[:filterrific],\n persistence_id: 'shared_key',\n select_options: {\n with_cpg_id: CircPolicyGroup.options_for_select,\n with_pg_id: PatronGroup.options_for_select,\n with_it_id: ItemType.options_for_select\n },\n ) or return\n #@circ_policy_matrices = CircPolicyMatrix.order(:circ_group_id).page params[:page]\n @circ_policy_matrices = @filterrific.find.page(params[:page])\n\n\n respond_to do |format|\n format.html\n format.js\n end \n\n end",
"def index\n @resources = Catalogs::Location.search(params[:search]).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 11, page: params[:page])\n authorize @resources\n end",
"def get_clerkships_by_care_setting\n\t @clinics = Clinic.find_all_by_care_setting(params[:id])\n \n respond_to do |format|\n format.html { redirect_to encounters_path }\n format.js {render :layout => false}\n end\n end",
"def index\n authorize! :show, params[:controller]\n @grid = initialize_grid(SysUser, per_page: 4) #wice grid\n end",
"def index\n #@shipmment_items = ShipmmentItem.all\n @shipmment_items = ShipmmentItem.accessible_by(current_ability)\n\n end",
"def index\n @add_shippings = AddShipping.all\n end",
"def get_collection(collection)\n filter_params = params[:filter] ? params[:filter].permit(self.class::DEFAULT_FIELDS) : {}\n if params[:filter].present? && filter_params.empty?\n render 'shared/http_status', locals: { code: '422', message:\n 'Invalid or malformed parameter values' }, status: :unprocessable_entity\n false\n else\n collection.order('id').where(filter_params)\n end\n end",
"def index\n authorize STool\n @filterrific = initialize_filterrific(\n STool,\n params[:filterrific],\n select_options: {\n states: [[t(:new), :new], [t(:good), :good] , [t(:normal),:normal], [t(:bad),:bad], [t(:need_repair),:need_repair]],\n with_storage_place: STool.options_for_select_storage_place,\n with_locations: Facility.options_for_select,\n with_trashed: [true, false]\n }\n ) or return\n\n @selected_per_page = get_session_per_page(STool.per_page)\n\n @s_tools = @filterrific.find.page(params[:page]).per_page(@selected_per_page)\n\n respond_to do |format|\n format.html\n format.js\n end\n\n rescue ActiveRecord::RecordNotFound => e\n puts \"Had to reset filterrific params: #{ e.message }\"\n redirect_to(reset_filterrific_url(format: :html)) and return\n end",
"def index\n index_filter\n end",
"def filter\n setup_instance_variables\n render 'index'\n end",
"def index\n my_authorize_action_within_clubs!(:list, Club, @current_partner.clubs.collect(&:id))\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: ClubsDatatable.new(view_context,@current_partner,nil,nil,@current_agent) }\n end\n end",
"def index\n @paniers = Panier.all.order('name')\n if params[:filter].present? \n \n if Panier.find_by_name(params[:filter]).present?\n @panier = Panier.find_by_name(params[:filter])\n @produits = @panier.produits.order('name')\n @name = @panier.name\n else\n @produits = Produit.all.order('name')\n @name = \"tout\"\n end\n\n else\n @produits = Produit.order('name').paginate(:page => params[:page], :per_page => 10)\n\n end\n respond_to do |format|\n format.js{}\n format.html{}\n end\n end",
"def show\n @custom_collection = get_collection\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @custom_collection }\n end\n end",
"def create\n render_json_auto @survey.add_filter(params[:filter]) and return\n end",
"def show\n ## Creating the todo object \n @todo = Todo.find(params[:id])\n \n respond_to do |format|\n format.html { get_collections and render :action => :index }\n format.json { render json: @todo }\n format.js {}\n end\n end",
"def index\n #@collections = Collection.all\n\tshow_collections\n end",
"def index\n # Page to show all records\n # Get shipments, order results, and paginate\n @shipments = Shipment.search(params[:search], params[:column]).order(sort_column(Shipment, 'broker_id') + ' ' + sort_direction).page(params[:page]).per(10)\n \n get_params()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shipments }\n end\n end",
"def show \n @collection = Collection.find(params[:id])\n\n #@documents = Document.where(:collection_id => @collection.id).paginate(:per_page => 5, :page => params[:page])\n @documents_all = Document.where(:collection_id => @collection.id)\n\n @documents = []\n @documents_all.each do |doc|\n if doc_is_viewable(doc, current_user)\n @documents << doc\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collection }\n end\n end",
"def create\n @supplier = Supplier.new(params[:supplier])\n @reorder_url = reorder_suppliers_url\n respond_to do |format|\n if @supplier.save\n flash[:notice] = 'Supplier was successfully created.'\n format.html { \n redirect_to suppliers_url\n }\n format.xml { \n render :xml => @supplier, :status => :created, :location => @supplier\n }\n format.js {\n @suppliers = Supplier.paginate(:page => params[:page])\n }\n else\n flash[:notice] = \"Creating supplier failed due to errors.\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n format.js { render :action => 'new', :layout => false }\n end\n end\n end",
"def index\n @internships = Internship.all\n\n # Very inefficient when users table has thousands of rows.\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @internships }\n format.json {\n\n if params[:filters] != nil\n @internships = Internship.joins(:locations, :fields, :languages, :academic_focuses).select(\"internships.id\").group(\"internships.id\")\n \n @internships = @internships.where(\"internships.for_credit = ?\", true) if params[:for_credit] == 'true'\n @internships = @internships.where(\"internships.for_credit = ?\", false) if params[:for_credit] == 'false'\n \n @internships = @internships.where(\"internships.is_part_time = ?\", true) if params[:part_time] == 'true'\n @internships = @internships.where(\"internships.is_part_time = ?\", false) if params[:part_time] == 'false'\n\n @internships = @internships.where(\"internships.is_full_time = ?\", true) if params[:full_time] == 'true'\n @internships = @internships.where(\"internships.is_full_time = ?\", false) if params[:full_time] == 'false'\n\n @internships = @internships.where(\"internships.requires_us_citizenship = ?\", true) if params[:us_citizenship] == 'true'\n @internships = @internships.where(\"internships.requires_us_citizenship = ?\", false) if params[:us_citizenship] == 'false'\n\n @internships = @internships.where(\"internships.is_paid = ?\", true) if params[:paid] == 'true'\n @internships = @internships.where(\"internships.is_paid = ?\", false) if params[:paid] == 'false'\n\n @internships = @internships.where(\"languages.id IN (?)\", params[:languages].split(',') << Language.find_by_name('unspecified')) if params[:languages] != 'null'\n @internships = @internships.where(\"fields.id IN (?)\", params[:fields].split(',') << Field.find_by_name('unspecified')) if params[:fields] != 'null'\n @internships = @internships.where(\"fields.industry_id IN (?)\", params[:industries].split(',') << Industry.find_by_name('unspecified')) if params[:industries] != 'null'\n @internships = @internships.where(\"internships.provider_id IN (?)\", params[:providers].split(',') << Provider.find_by_name('unspecified')) if params[:providers] != 'null'\n @internships = @internships.where(\"locations.id IN (?)\", params[:locations].split(',')) if params[:locations] != 'null'\n @internships = @internships.where(\"academic_focuses.id IN (?)\", params[:academic_focuses].split(',') << AcademicFocus.find_by_name('unspecified')) if params[:academic_focuses] != 'null'\n end\n \n #Format Response\n internships = Hash.new\n @internships.each do |internship|\n internship = Internship.find(internship.id)\n internship.locations.each do |location|\n internships[location.country.un_code] = Array.new if internships[location.country.un_code] == nil\n internships[location.country.un_code] << {\n 'id' => internship.id,\n 'name' => internship.name,\n 'provider_name' => internship.provider.name,\n 'city' => location.city, \n 'state' => location.state.name, \n 'country' => location.country.name, \n }\n end \n end\n \n #send response\n render :json => internships\n \n }\n end\n end",
"def index\n create_cart\n #@items = Item.all.paginate(:page => params[:page]).per_page(10)\n @filterrific = initialize_filterrific(Item, params[:filterrific],\n select_options: { for_category: Category.alphabetical.all.map(&:name),\n by_age: ['0-2', '3-10', '11-21'],\n by_gender: ['Neutral', 'Boy', 'Girl'] },\n persistence_id: false\n ) or return\n @items = @filterrific.find.paginate(:page=>params[:page]).per_page(5)\n end",
"def index\n @cartships = Cartship.all\n end",
"def collection_action(action)\n define_method(action) do\n if params[:ids].present?\n self.resources ||= resource_scope.where(id: params[:ids])\n end\n\n if effective_resource.scope?(action)\n self.resources ||= resource_scope.public_send(action)\n end\n\n self.resources ||= resource_scope.all\n\n EffectiveResources.authorize!(self, action, resource_klass)\n\n @page_title ||= \"#{action.to_s.titleize} #{resource_plural_name.titleize}\"\n\n collection_post_action(action) unless request.get?\n end\n end",
"def index\n @products = Product.all.page(params[:page]).per(10)\n authorize Product\n end",
"def index\n @closing_cashes = ClosingCash.all\n @filterrific = initialize_filterrific(\n ClosingCash,\n params[:filterrific],select_options: {\n sorted_by_cash: Cash.options_for_sorted_by_cash\n },\n persistence_id: false\n ) or return\n\n @closing_cashes = @filterrific.find.page(params[:page]).paginate(:per_page => 5, :page => params[:page])\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def supplier_collection\n show_only_supplier_products = try_spree_current_user &&\n !try_spree_current_user.admin? &&\n try_spree_current_user.supplier?\n if show_only_supplier_products\n @collection = \n @collection.where(supplier_id: try_spree_current_user.supplier_id)\n end\n end",
"def filters\n end",
"def index\n @filter = params[:filter] || \"id\"\n filter = (@filter != \"id\")? @filter.to_s + \" ASC\": @filter.to_s + \" DESC\"\n @freecycles = Freecycle.paginate :page => params[:page], :order => filter\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @freecycles }\n end\n end",
"def index\n @company = Company.find(params[:company_id])\n @company1 = Company.find_by_user_id(current_user.id)\n if @company.id != @company1.id && current_user.email != \"admin@transwiz.com\"\n @shipments = @company1.shipments\n else\n @shipments = @company.shipments\n end\n end",
"def authorize_collection! action, collection\n collection.map do |model|\n authorize! action, model\n end\n end",
"def index\n @collections = get_collections(@state);\n respond_to do |format| \n respond_do(format, @collections)\n end \n end",
"def show\n @organizational_unit = resource\n\n# @compliance = EmployeeComplianceStatusCubicle.query do\n# select :employee_id, :employee_name, :requirement_status, :all_measures\n# by :mandatory\n# where :requirement_id=>BSON::ObjectId(id)\n# order_by :compliant, :employee_name\n# end\n# puts resource.class.name.underscore + \"_id[\" + params[:id] + \"]\"\n\n if request.xhr?\n render :partial=>\"/admin/organizational_units/show\"\n else\n index\n end\n end",
"def index\n @user = User.find(params[:user_id])\n\n @clippings = Clipping.includes(:tags).where(:user_id => @user.id).order(\"clippings.created_at DESC\")\n\n @clippings = @clippings.where('tags.name = ?', params[:tag_name]) if params[:tag_name]\n\n @clippings = @clippings.page(params[:page])\n\n @tags = Clipping.includes(:taggings).where(:user_id => @user.id).tag_counts(:limit => 20)\n\n @clippings_data = @clippings.collect {|c| [c.id, c.image_url, c.description, c.url ] }\n\n @rss_title = \"#{configatron.community_name}: #{@user.login}'s clippings\"\n @rss_url = user_clippings_path(@user,:format => :rss)\n\n respond_to do |format|\n format.html # index.rhtml\n format.js { render :inline => @clippings_data.to_json }\n # format.widget { render :template => 'clippings/widget', :layout => false }\n format.rss {\n render_rss_feed_for(@clippings,\n { :feed => {:title => @rss_title, :link => url_for(:controller => 'clippings', :action => 'index', :user_id => @user) },\n :item => {:title => :title_for_rss,\n :description => Proc.new {|clip| description_for_rss(clip)},\n :link => :url,\n :pub_date => :created_at} })\n\n }\n end\n end",
"def index\n if current_cadet == nil\n redirect_to '/cadet-login'\n else\n @cadet = current_cadet\n shipments = getShipmentsFromCadet();\n \n # shipments.each do |shipment|\n # puts shipment\n # end\n shipments.each do |s|\n puts \"status = \"+ s.status.to_s\n end\n @pendingShipments =shipments.select {|s| s.status == Shipment.PENDING}\n @sentShipments = shipments.select {|s| s.status == Shipment.SENT}\n \n end\n end",
"def index\n @cost_setups = CostSetup.all.paginate(page: params[:page], per_page: 15)\n authorize User\n end",
"def requestable\n index\n end",
"def ajax_filters\n @_ajax_table_filters ||= []\n end",
"def index\n @request_commercials = RequestCommercial.all\n end",
"def index\n @shipments = Shipment.all\n end",
"def index\n @shipments = Shipment.all\n end",
"def index\n breadcrumb_for_collections(@collection)\n semantic_breadcrumb @collection.name\n @documents = @collection.documents\n @documents = @documents.where(\"did = ?\", params[:did]) if params[:did].present?\n @documents = @documents.where(\"done = ?\", params[:done] == \"true\") if params[:done].present?\n @documents = @documents.where(\"curatable = ?\", params[:curatable] == \"true\") if params[:curatable].present?\n \n if params[:term].present?\n @documents = @documents.where(\"did like ? or title like ?\", \"%#{params[:term]}%\", \"%#{params[:term]}%\")\n end\n\n if sort_column == \"default\"\n @documents = @documents.order(\"batch_id DESC, batch_no ASC, id DESC\")\n else \n @documents = @documents.order(sort_column + \" \" + sort_direction)\n end\n @documents = @documents.order(\"batch_id DESC, batch_no ASC, id DESC\")\n unless request.format.json?\n # @documents = @documents.order(\"batch_id DESC, batch_no ASC, id DESC\").page(params[:page])\n @documents = @documents.page(params[:page])\n end\n end",
"def index\n Rails.logger.debug(\"collection_id: @collection.id\")\n @categories = @collection.categories.all\n\n # if !@collection\n # @categories = []\n # else\n # @categories = @collection.categories.all\n #\n # #Category.where(shopify_collection_id: session[:shopify_collection_id])\n # end\n\n @collections = Collection.all\n\n\n # Trying Nav\n #@custom_collections = ShopifyAPI::CustomCollection.find(:all, params: { limit: 10 },shopify_collection_id: session[:shopify_collection_id])\n #@smart_collections = ShopifyAPI::SmartCollection.find(:all, params: { limit: 10 }, shopify_collection_id: session[:shopify_collection_id])\n\n end",
"def index\n @lwidth = '20%'\n @rwidth = '0'\n @height = '800' \n # data = Contact.filter.all #(:public => true)\n if request.params['value']\n @value = request.params['value']\n else\n @value = nil\n end\n data = Contact.filter(:public => true, :deleted_at => nil).filter(Sequel.ilike(:full_name, \"%#{@value}%\"))\n @contacts = paginate(data, :limit => 5)\n @items = Action.recent_items\n end",
"def paginate; false; end",
"def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deities }\n format.js {}\n end\n end",
"def index\n @items = Item.includes(:category).with_attached_cover.with_filter(params[:sort])\n @items = @items.search(params[:query]) if params[:query].present?\n @items = @items.page(params[:page]).per(24)\n\n authorize @items\n end",
"def index\n authorize Project\n @projects = Project.filter(params.slice(:organization_id, :status)).includes([:commodity, :organization, :commodity_source, :unit_of_measure]) \n end",
"def index\n @admin_commercials = Commercial.order(created_at: :desc).page params[:page]\n end",
"def show\n @supplier = Supplier.find(params[:id])\n @products = @supplier.products.paginate(:page => params[:page])\n \n \n\n @reorder_url = reorder_suppliers_url\n flash[:notice] = \"Supplier has (#{@products.size}) products.\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @supplier }\n end\n end",
"def index\n @special_collection_requests = SpecialCollectionRequest.all\n end",
"def index\n @status_shippings = StatusShipping.all\n end",
"def show\n @before_intership = BeforeIntership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @before_intership }\n end\n end",
"def create\n @cargo = current_scope.new(params[:cargo])\n\n respond_to do |format|\n if @cargo.save\n format.html { redirect_to admin_cargo_outs_path, notice: '发货完成' }\n format.json { render json: @cargo, status: :created, location: @cargo }\n else\n @shippings = current_user.huozhan.ship_outs.with_status(\"received\").with_to_huozhan(params[:to]).includes(:to_huozhan)\n format.html { render action: \"new\" }\n format.json { render json: @cargo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n authorize controller_class\n render json: policy_class::Scope.new(current_user, controller_class).editable.order(prepared_params[:sort]),\n include: prepared_params[:include], fields: prepared_params[:fields]\n end",
"def arrange\n @collections = Collection.find(params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @collections }\n format.amf { render :amf => @collections }\n end\n end",
"def publish\n type = params[:type]\n collection_id = params[:id]\n\n if type==\"collect\"\n drowCollect(params)\n else\n #drowSet(params[:items], params[:info])\n drowSet(params)\n end\n \n respond_to do |format|\n #format.json { render json: @collection.to_json }\n format.json { render :json => { status: true, location: \"/collections/#{@collection.id}\", msg: \"콜렉션을 등록하였습니다.\" }.to_json }\n end\n end",
"def index\n @relatorio_gerals = RelatorioGeral.all.page(params[:page]).per(15)\n authorize @relatorio_gerals\n end",
"def add_filter\n @filter = true \n end",
"def shop_index\n\t\tauthorize ShopProfile\n\t\trespond_to do |format|\n format.html\n format.json {render json: ShopProfileDatatable.new(view_context)}\n end\n\tend",
"def collection\n # needed for the list view\n @parent_object = parent_object if parent?\n \n feature_id=nil\n if params[:feature_id]\n feature_id = params[:feature_id]\n elsif params[:id]\n feature_id = object.feature_id\n end\n search_results = FeatureName.search(params[:filter])\n search_results = search_results.where(:feature_id => feature_id) if feature_id\n @collection = search_results.page(params[:page])\n end",
"def index\n @shipments = Shipment.all\n render json: @shipments\n end",
"def show\n @collections = @content_provider.collections(true, @state) \n respond_to do |format| \n respond_do(format, @content_provider)\n end \n end",
"def index\n @pagetitle = \"Suppliers\"\n \n @companies = Company.find(:all, :conditions => {:user_id => getUserId()}, :order => \"name\")\n @path = 'suppliers'\n end",
"def index\n # if plugins modify default scope, show everything if user is logged in\n collection = governor_logged_in? ? model_class.unscoped : model_class\n set_resources(if model_class.respond_to?(:paginate)\n collection.paginate :page => params[:page], :order => 'created_at DESC'\n else\n collection.all :order => 'created_at DESC'\n end)\n respond_with resources\n end",
"def show\n authorize! :read, @collection\n end",
"def index\n @ship_groups = ShipGroup.all\n end",
"def index\n\n #events_scope = Event.event_curator_users_filter(params[:curator_filter])\n #events_scope = events_scope.event_curator_users_filter(params[:event_curator_users_filter])\n #events_scope = events_scope.event_curator_users_filter if params[:event_curator_users_filter] == \"1\"\n events_scope = Event.title_search(params[:filter])\n\n if (params[:curator_filter] != nil) && (params[:curator_filter] != \"\")\n events_scope = events_scope.event_curator_users_filter(params[:curator_filter])\n end\n\n if (params[:state_filter] != nil) && (params[:state_filter] != \"\")\n events_scope = events_scope.state_filter(params[:state_filter])\n end\n\n if (params[:date_filter] != nil) && (params[:date_filter] != \"\")\n events_scope = events_scope.date_search(Date.parse(\"01.\" + params[:date_filter]))\n end\n smart_listing_create :events,events_scope, partial: \"events/list\",page_sizes: [20,50,100],\n default_sort: {date_start: \"desc\"}\n end",
"def index\n\n fetcher = lambda { |sort_field, direction, page, per|\n records = Invitation.joins(:partner).where(:public_id => @user_id)\n [records.count, records.order(sort_field + ' ' + direction).page(page).per(per)]\n }\n\n cooker = lambda { |raws|\n raws.map do |raw|\n {\n 'id' => raw.id,\n 'headline' => raw.headline,\n 'list' => raw.list,\n 'partner' => raw.partner.name,\n 'posted' => raw.posted,\n 'html' => raw.html\n }\n end\n } \n\n callbacks = {\n :delete => {:controller => 'invitations' }\n }\n\n columns = [ \n {field:'headline', displayName: 'Headline', order: 'headline'},\n {field:'list', displayName: 'List', order: 'list'},\n {field:'partner', displayName: 'Partner', order: 'partners.name'},\n {field:'posted', displayName:'Posted', order: 'posted'}\n ]\n\n angular_grid_simple_helper 'shared/angular_grid_partial', 'Your Invitations', \\\n fetcher, cooker, columns, callbacks\n end",
"def index\n @labor_cost_lines = LaborCostLine.scoped\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @labor_cost_lines }\n end\n end",
"def before_action \n end",
"def index\n @item_type = params[:type] = \"C\"\n \n params[:id] = nil\n \n # 찜한 상품, 콜렉션\n @collections = Collection.itemList(params)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n \n end",
"def index\n @activist_fronts = ActivistFront.all\n authorize ActivistFront\n end",
"def index\n @relatorio_pedagogicos = RelatorioPedagogico.all.page(params[:page]).per(15)\n authorize @relatorio_pedagogicos\n end",
"def index\n @storage=current_storage\n if !@storage.need_pick\n @shelves=@shelves.where(\"shelf_type!='pick' or shelf_type is null\")\n end\n @shelves_grid = initialize_grid(@shelves,\n :order => 'shelves.id',\n :order_direction => 'desc',\n :include => :area)\n end",
"def index\n #if can? :manage, :all\n # @receipts = Receipt.includes(:inventory, :from_store, :batch).all.order('updated_at DESC')\n #else\n # @receipts = Receipt.includes(:inventory, :from_store, :batch).where(:to_store_id => current_store.id).all.order('updated_at DESC')\n #end\n\n if can? :manage, :all\n @orders = Order.includes(:receipts).where(:status => [\"SERVICE_COMPLETE\", \"DELIVERY_COMPLETE\"]).order(\"id DESC\")\n else\n @to_store = current_store\n @orders = Order.includes(:receipts).where(:status => [\"SERVICE_COMPLETE\", \"DELIVERY_COMPLETE\"]).order('id DESC')\n end\n @filter = Receipt.new(:confirm_receipt => \" ALL \")\n @stores = Store.all\n @pharm_items = PharmItem.all\n end",
"def index\n# filter = \"\"\n session[:referer] = request.env[\"PATH_INFO\"] + \"?\" + request.env[\"QUERY_STRING\"]\n @task = if params[:cl_id].nil?\n Task.search(params[:search])\n elsif params[:search]\n Task.where([\"cl_id=? AND name LIKE ?\",params[:cl_id],\"%#{params[:search]}%\"]).order(\"zapros_gid desc,point_group desc,idtask asc\").paginate(:per_page => 30, :page => params[:page])\n else\n Task.where([\"cl_id=?\",params[:cl_id]]).order(\"zapros_gid desc,point_group desc,idtask asc\").paginate(:per_page => 30, :page => params[:page])\n end\n @client = Client.find(params[:cl_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def on_pre_request( request ); end"
] | [
"0.594476",
"0.59187573",
"0.58799136",
"0.5827994",
"0.5777794",
"0.5753862",
"0.5714483",
"0.5603547",
"0.55215657",
"0.55150557",
"0.55035037",
"0.54972976",
"0.54972976",
"0.5497178",
"0.5485776",
"0.5481498",
"0.54684716",
"0.54476863",
"0.5432035",
"0.54228103",
"0.54131395",
"0.5401896",
"0.53974074",
"0.5395875",
"0.5393081",
"0.53834206",
"0.53717846",
"0.53708154",
"0.53625304",
"0.53505284",
"0.53450084",
"0.5334295",
"0.53299177",
"0.532592",
"0.5321015",
"0.53163236",
"0.5315502",
"0.5314519",
"0.53138995",
"0.5311444",
"0.52982384",
"0.5298093",
"0.52966285",
"0.5295236",
"0.52838486",
"0.5282459",
"0.52785814",
"0.52757895",
"0.52713037",
"0.5269581",
"0.52685297",
"0.526591",
"0.52639014",
"0.52585953",
"0.5249518",
"0.52442354",
"0.5243469",
"0.5241735",
"0.52386624",
"0.52378625",
"0.52340716",
"0.5232964",
"0.5232964",
"0.5229642",
"0.5226875",
"0.5224734",
"0.52240777",
"0.5223792",
"0.52219987",
"0.52192694",
"0.52161074",
"0.52141416",
"0.52137476",
"0.52126884",
"0.5207911",
"0.5207783",
"0.5207102",
"0.5200193",
"0.5196473",
"0.519621",
"0.5194334",
"0.5188796",
"0.5188554",
"0.518615",
"0.51849604",
"0.51823515",
"0.51792246",
"0.51760375",
"0.5172202",
"0.51704556",
"0.5166971",
"0.51665497",
"0.516574",
"0.5162682",
"0.51572734",
"0.5156856",
"0.51542497",
"0.51488787",
"0.5147527",
"0.51472026"
] | 0.6284054 | 0 |
TODO: Should this method be here? The responsability of initialize preferences shouldn't be of other module? | def test_should_init_mail_settings
assert Preference.init_mail_settings
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_static_preferences!\n @preference_store = default_preferences\n end",
"def load_all\n parse_json(get(PREFERENCE_URL))['prefs'].each do |p|\n @@greader_preferences[p['id']] = p['value']\n end\n end",
"def set_preferences\n unless current_user.preference\n pref = Preference.create(user_id: current_user.id,theme: \"default-right\",bgcolor: \"white\",rows: 20, wallpaper: false)\n else\n pref = Preference.where(user_id: current_user.id).first\n end\n session[:theme] = pref.theme\n session[:bgcolor] = pref.bgcolor\n session[:rows] = pref.rows\n session[:wallpaper] = pref.wallpaper\n end",
"def pref\n raw_config = File.open(\"#{Rails.root}/config/prefs.yml\")\n config = YAML.load(raw_config)\n #$prefs=config.symbolize_keys[:pref]\n config\n end",
"def setup_notification_preferences\n n = NotificationPreference.create!(user_id: id)\n self.notification_preference_id = n.id\n end",
"def preferences_field\n :preferences\n end",
"def set_user_preferences\n @user_preferences = UserPreferences.find_or_create_by!(:user => current_user)\n end",
"def preferences_holder\n nil\n end",
"def read_config\n @config = {}\n begin\n @config = Psych.load_file('config/prefs.yml')\n puts 'preferences loaded'\n rescue => e\n puts e\n puts e.backtrace\n puts 'An error occured while loading the preference file'\n puts 'User will be asked what to do'\n recreate_default_config\n read_config\n end\nend",
"def set_preference\n @preference = @user.preferences.find(params[:id])\n end",
"def preferences_with_defaults\n DEFAULT_PREFS.merge(read_attribute(:preferences) || {})\n end",
"def set_right_preferences_path\n Mongoid::Preferences.configure do |config|\n # model preferences path to dummy model\n config.model_preferences_path = File.join(File.dirname(__FILE__), \"models_preferences\")\n end\nend",
"def test_should_have_preferences\n u = users(:basic_user)\n assert_nil u.settings['arbitrary']\n u.settings['arbitrary'] = 'the arbitrary setting'\n u.reload\n assert_equal 'the arbitrary setting', u.settings['arbitrary']\n end",
"def set_preference\n preference = Preference.find(params[:id])\n end",
"def load_settings\n @leaderboard_settings = component.settings\n end",
"def load_settings\n @leaderboard_settings = component.settings\n end",
"def set_pref\n @pref = Pref.find(params[:id])\n end",
"def set_preferences( opts={} )\n options.merge!( opts )\n end",
"def set_preference\n @preference = Preference.find(params[:id])\n end",
"def prefs\n prefs_raw = _prefs_raw unless @prefs_fetched\n return nil if prefs_raw.nil?\n\n @prefs_cache = parse_pref_string(prefs_raw)\n @prefs_cache.clone\n end",
"def set_config\n @me = current_user\n @profile = Profile.find_by user_id: current_user.id\n @preference = Preference.find_by user_id: current_user.id\n end",
"def remember_preference settings\n self.preference = Preference.find_or_create_by user_id: self\n self.preference.update settings\n end",
"def ask_pref(preference, prompt)\n prefs[preference] = ask_wizard(prompt)\nend",
"def use_legacy_db_preferences!\n @preference_store = ScopedStore.new(self.class.name.underscore)\n end",
"def user_pref(pref, for_user=nil)\n user = for_user || @current_user || User.current_user\n user.preferences[pref] if user\n end",
"def initialize\n\t\tpath = Pathname.new(File.dirname(__FILE__) + \"/../Preferences.yml\")\n\t\tdata = YAML.load_file(path)\n\t\t@menuAssets = MenuAssets.getInstance()\n\t\t@language = data[\"language\"]\n\t\t@resolution = data[\"resolution\"]\n\t\t@color = data[\"color\"]\n\t\t@clueHighlightColor = data[\"clueHighlightColor\"]\n\t\t@helpColor = data[\"helpColor\"]\n\tend",
"def pref(name, fallback = nil)\n @@prefs ||= {}\n name = name.to_s\n @@prefs[name] ||= Preference.where(key: name).first.try(:value) || fallback\n end",
"def has_pref?(preference)\n !prefs[preference].to_s.empty?\nend",
"def set_user_preference\n @user_preference = UserPreference.find(params[:id])\n end",
"def preference(key)\n pref = preferences.where(key: key).first_or_initialize\n pref.value = Droom.user_default(key) unless pref.persisted?\n pref\n end",
"def set_wrong_preferences_path\n Mongoid::Preferences.configure do |config|\n # model preferences path to dummy model\n config.model_preferences_path = 'wrong/path/to/preferences/file'\n end\nend",
"def add_preference(name, value); end",
"def add_preference(name, value); end",
"def initialize_user_settings_defaults\n self.disabled_sports = []\n self.locale = 'en'\n self.device_ids = []\n end",
"def initialize(alpha_preferences, beta_preferences, opts = {})\n @orig_alpha_preferences = alpha_preferences\n @orig_beta_preferences = beta_preferences\n\n @alpha_preferences, @beta_preferences =\n PreferenceTable.initialize_pair(alpha_preferences, beta_preferences)\n\n set_logger(opts)\n end",
"def load_settings\n @settings ||= Course::LeaderboardSettings.new(current_course.settings(:leaderboard))\n end",
"def pref(key)\n if pref = preferences.find_by(key: key)\n pref.value\n else\n Droom.user_default(key)\n end\n end",
"def preferences=(prefs)\n unless prefs.kind_of? Preferences\n raise InvalidPreference, \"Preference settings must be an instance of SmartView::Preferences\"\n end\n @preferences = prefs\n end",
"def get_preferences(key)\n defaults = Pref.default_settings[key.to_sym] || Pref.default_settings[key.to_s]\n\n if self.pref.present?\n existing = self.pref.settings[key.to_s].deep_symbolize_keys\n \n # Check for new preferences \n defaults.keys.each do |grp| \n defaults[grp].keys.each do |pref, v|\n # If the group isn't present in the saved values add all of it's preferences\n existing[grp] = defaults[grp] if existing[grp].nil?\n # If the preference isn't present in the saved values add the default\n existing[grp][pref] = defaults[grp][pref] if existing[grp][pref].nil?\n end\n end\n existing\n else\n defaults\n end\n end",
"def load_config\n @preferences = \"/Library/Preferences/com.apple.RemoteManagement.plist\"\n config = NSMutableDictionary.dictionaryWithContentsOfFile(@preferences)\n end",
"def init_settings\n merge_in_user_settings(copy_hash(DEFAULT_SETTINGS))\n end",
"def set_preference\n begin\n @preference = Preference.find(params[:id])\n rescue\n flash[:danger] = \"You don't have permission for this action.\"\n redirect_to preferences_path\n end\n end",
"def update_prefs\n current_user.preferences = params[:preferences]\n render plain: \"1\"\n end",
"def get_pref(key)\n data = @prefs_fetched ? @prefs_cache : prefs\n data[key]\n end",
"def test_preferences\n c = cli(['-m'])\n assert(c.map?)\n refute(c.print?)\n refute(c.save?)\n end",
"def set_hacknu_preference\n @hacknu_preference = HacknuPreference.find(params[:id])\n end",
"def add_preference(name, value)\n @options[:prefs][name] = value\n end",
"def install_prefs!\n return false unless File.exists?(prefs_bak)\n\n puts \" preferences: #{prefs_dest.inspect}\"\n FileUtils.cp(prefs_bak, prefs_dest)\n true\n end",
"def get_preferences\n json = perform(:get, 'preferences/notification', nil, token_headers).body\n frequency = MessagingPreference::FREQUENCY_GET_MAP[json[:data][:notify_me]]\n MessagingPreference.new(email_address: json[:data][:email_address],\n frequency: frequency)\n end",
"def initialize\n @settings = Hash.new\n end",
"def get_preferences(key)\n defaults = Pref.default_settings[key.to_sym] || Pref.default_settings[key.to_s]\n defaults = defaults.with_indifferent_access if defaults.present?\n\n if pref.present?\n existing = pref.settings[key.to_s].deep_symbolize_keys\n existing = existing.with_indifferent_access if existing.present?\n\n # Check for new preferences\n defaults.each_key do |grp|\n defaults[grp].each_key do |pref|\n # If the group isn't present in the saved values add all of it's preferences\n existing[grp] = defaults[grp] if existing[grp].nil?\n # If the preference isn't present in the saved values add the default\n existing[grp][pref] = defaults[grp][pref] if existing[grp][pref].nil?\n end\n end\n existing\n else\n defaults\n end\n end",
"def configure_spree_preferences\n config = Rails.application.config.spree.preferences\n yield(config) if block_given?\n end",
"def stub_spree_preferences(preferences)\n preferences.each do |name, value|\n if Spree::Config.method(:[]).owner >= Spree::Config.class\n allow(Spree::Config).to receive(:[]).and_call_original\n end\n allow(Spree::Config).to receive(:[]).with(name) { value }\n allow(Spree::Config).to receive(name) { value }\n end\n end",
"def install_prefs\n return false if File.exists?(prefs_dest)\n install_prefs!\n end",
"def current_preferences(update_params = nil)\n update_params ||= params[:preferences]\n prefs = if logged_in?\n current_user.preferences\n else\n session[:preferences] ||= User.preference_definitions.inject({}) do |memo, pair|\n name, pref = pair\n memo[name] = pref.default_value\n memo\n end\n end\n \n update_params = update_params.to_h.reject{|k,v| v.blank?} if update_params\n if update_params.is_a?(Hash) && !update_params.empty?\n # prefs.update(update_params)\n if logged_in?\n update_params.each do |k,v|\n new_value = if v == \"true\"\n true\n elsif v == \"false\"\n false\n elsif v.to_i > 0\n v.to_i\n else\n v\n end\n current_user.write_preference(k, new_value) unless new_value.blank?\n end\n else\n prefs.update(update_params)\n end\n end\n \n if logged_in?\n current_user.save if current_user.preferences_changed?\n current_user.preferences\n else\n session[:preferences] = prefs\n end\n end",
"def setting; end",
"def _sumac_singleton_expose_preferences\n @_sumac_singleton_expose_preferences ||= ExposePreferences.new\n end",
"def set_cleaners_preference\n @cleaners_preference = Cleaners::Preference.find(params[:id])\n end",
"def of_presence!\n requested_user_preferences.each do |requested|\n validate_pref_code!(requested)\n validate_user_pref_key!(requested)\n\n requested.dig('user_preferences').each do |user_preference|\n validate_user_pref!(user_preference)\n validate_user_pref_code!(user_preference)\n end\n end\n\n requested_user_preferences\n end",
"def load_favourite(name)\n @settings = {}\n if File.exists?(File.expand_path(\"~/.wormholes\"))\n sites = Psych.load(File.read(File.expand_path(\"~/.wormholes\")))\n if !sites[name].nil?\n @settings = sites[name]\n end\n end\nend",
"def initialize settings\n self.settings = settings\n end",
"def pref?\n type? 'PREF'\n end",
"def create\n @preference = Preference.new(preference_params)\n if Preference.where(user_id: current_user.id).count == 0\n respond_to do |format|\n if @preference.save\n format.html { redirect_to @preference, notice: 'Preference was successfully created.' }\n format.json { render :show, status: :created, location: @preference }\n else\n format.html { render :new }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:danger] = \"You have already setup your preference.\"\n redirect_to preferences_path\n end\n end",
"def preferences_hash\n self.preferences ||= []\n Hash[\n (0..padded_size-1).collect do |i|\n [(i+1).to_s, self.preferences[i].to_s]\n end\n ]\n end",
"def store(prefs)\n prefs.each do |key, value|\n self[key] = value\n end if prefs.respond_to?(:each)\n end",
"def preferences\n @user = current_user\n @mode = \"general\"\n\n respond_to do |format|\n format.html\n end\n end",
"def init_quick_defaults\n @quick_defaults=Hash.new\n @quick_defaults['enabled']=false\n @quick_defaults['launch']='ONETIME'\n @quick_defaults['launch_now']=true\n @quick_defaults['description']='Created with nessus_rest'\n end",
"def preference_for setting\n\n if preferences = self.preference\n pref = preferences.attributes[setting.to_s]\n return pref unless pref.empty?\n end\n\n Preference.default_for setting\n end",
"def get_preference(prefs_section, pref)\n driver.getPref(prefs_section, pref)\n end",
"def reset\n set(default_preferences)\n end",
"def create_defaults!\n Preference.reset_column_information\n conf = File.join( File.expand_path('../../', __FILE__), 'config', 'defaults.yml' )\n YAML.load( File.open(conf) ).each do |pref|\n Preference.where(key: pref['key'])\n .first_or_create(pref)\n end\n end",
"def prefs_params\n params.require(:preference).permit(:facebook,:twitter,:telephone,:telephone2,:email,:key,:value,:paypal)\n end",
"def settings; end",
"def settings; end",
"def show\n if @preference.nil?\n redirect_to no_user_preferences_path(@user)\n end\n end",
"def prefs_to_hash prefs\n h = {}\n prefs.each do |pref|\n h[pref['id']] = pref['value']\n end\n h\n end",
"def settings\n @settings ||= {}\n end",
"def system_preferences\n #TODO remove true from the following line after presentation. Dont want the invitation only session to get bogged up during pres\n if true or session[:system_preferences].blank?\n active_preferences = HashWithIndifferentAccess.new()\n system_preferences = SystemPreference.all(:conditions => ['active = ?', true])\n system_preferences.each do |preference|\n if (preference.start_date.blank? or preference.start_date <= Date.now) and (preference.end_date.blank? or preference.end_date >= Date.now)\n if preference.constraints.blank? or eval(preference.constraints)\n active_preferences[preference.preference_key] = preference.preference_value\n end\n end\n end\n session[:system_preferences] = active_preferences\n return active_preferences\n else\n return session[:system_preferences]\n end\n end",
"def app_library_preferences_dir\n base_dir = app_library_dir\n if base_dir.nil?\n nil\n else\n File.join(base_dir, 'Preferences')\n end\n end",
"def load_appl_settings\n Configuration::Application::SETTINGS\n end",
"def defined_preferences\n super - [:server]\n end",
"def set_pref(key, value)\n preferences.where(key: key).first_or_create.set(value)\n end",
"def test_should_verify_if_is_true\n a_preference = preferences(:store_use_inventory_control)\n assert a_preference.is_true?\n\n a_preference = preferences(:store_require_login)\n assert !a_preference.is_true?\n end",
"def init_usersettings\n UserSetting.create(:user => self)\n end",
"def load_settings\n @settings = Setting.all(:order => 'id')\n @settings.each do |setting|\n # set instance variables\n instance_variable_set(\"@#{setting.slug}\", setting.instance_value)\n end\n end",
"def index\n @cleaners_preferences = Cleaners::Preference.all\n end",
"def init_default_settings!\n self.class.default_settings.dup.each do |var, vals|\n setting_objects.detect { |s| s.var == var.to_s } || setting_objects.create(var: var.to_s, value: vals, target: self)\n end\n end",
"def table_preferences table_code=nil\n if table_code\n prefs = eval(table_prefs || \"{}\").try(:[], table_code.to_sym)\n if prefs.nil? \n return DEFAULT_TABLE_PREFERENCES[table_code.to_sym]\n else\n # We have preferences, make sure that every type of preference is filled out\n if prefs[:sort].nil?\n prefs[:sort] = DEFAULT_TABLE_PREFERENCES[table_code.to_sym].try(:[], :sort)\n elsif prefs[:columns].nil? \n prefs[:columns] = DEFAULT_TABLE_PREFERENCES[table_code.to_sym].try(:[], :columns)\n end\n return prefs \n end\n else\n table_prefs\n end\n end",
"def settings\n\t\tcheck_if_myself\n\t\t@user = current_user\n\tend",
"def load_settings(other_settings)\n other_settings.each do |setting|\n new_setting = define_setting(setting.key, setting.default, setting.description, setting.options)\n new_setting.value = setting.value if setting.value_set?\n end\n end",
"def check_settings\n init_settings if settings.nil?\n end",
"def check_settings\n init_settings if settings.nil?\n end",
"def default_email_preferences\n EmailPreference.default_set_for_user(self) if email_preferences.blank?\n end",
"def create_preference \n if session[\"last_context\"] == \"pl\"\n preference = Preference.create( league_id: \"426\" )\n preference.name = user.name\n session[\"preference\"] = preference\n elsif session[\"last_context\"] == \"bl\"\n preference = Preference.create( league_id: \"430\" )\n preference.name = user.name\n session[\"preference\"] = preference\n elsif session[\"last_context\"] == \"il\"\n preference = Preference.create( league_id: \"438\" )\n preference.name = user.name\n session[\"preference\"] = preference\n elsif session[\"last_context\"] == \"sl\"\n preference = Preference.create( league_id: \"436\" )\n preference.name = user.name\n session[\"preference\"] = preference\n else \n error_league \n end \nend",
"def get_default_preference(prefs_section, pref)\n driver.getDefaultPref(prefs_section, pref)\n end",
"def get_prefs(user_id:)\n path = '/users/{userId}/prefs'\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::Preferences\n )\n end",
"def user_init; end",
"def preference(value)\n fresh.tap do |criteria|\n criteria.preference_value = value\n end\n end",
"def index\n @user_preferences = UserPreference.all\n end",
"def settings\n {}\n end"
] | [
"0.68646574",
"0.6762229",
"0.67269933",
"0.67051286",
"0.6561225",
"0.6489059",
"0.64557296",
"0.64415497",
"0.64272344",
"0.6423151",
"0.64202106",
"0.6395984",
"0.6195999",
"0.6173371",
"0.6166012",
"0.6166012",
"0.61643034",
"0.6160293",
"0.61566055",
"0.61537826",
"0.6135049",
"0.6134282",
"0.6116375",
"0.6097424",
"0.60935247",
"0.6086433",
"0.6063233",
"0.6007581",
"0.6005952",
"0.59795624",
"0.59143245",
"0.5912518",
"0.5912518",
"0.5905564",
"0.5895413",
"0.58783776",
"0.5872117",
"0.58612216",
"0.58101773",
"0.57996106",
"0.579074",
"0.57890415",
"0.57643735",
"0.57566077",
"0.57533294",
"0.57235414",
"0.5708012",
"0.5675566",
"0.56639963",
"0.5637703",
"0.56302595",
"0.56290084",
"0.562476",
"0.56224614",
"0.5601633",
"0.5587977",
"0.5564217",
"0.5548089",
"0.55447114",
"0.55380356",
"0.55157495",
"0.55149704",
"0.55108035",
"0.54799765",
"0.54650617",
"0.54559386",
"0.5447454",
"0.5442276",
"0.54298705",
"0.54220384",
"0.5413594",
"0.5411399",
"0.5409802",
"0.5409802",
"0.5389996",
"0.53870577",
"0.53858155",
"0.5377414",
"0.53727853",
"0.53627604",
"0.5360591",
"0.53564775",
"0.5355001",
"0.5346867",
"0.53454167",
"0.5338027",
"0.53355944",
"0.5332",
"0.5329631",
"0.5326567",
"0.5326122",
"0.5326122",
"0.5314143",
"0.53125995",
"0.53117293",
"0.53021973",
"0.5296085",
"0.52815163",
"0.52804476",
"0.5277214"
] | 0.54639274 | 65 |
TODO: Should this method be here? The responsability of saving preferences isn't of the controller? A preference should just represent one instance of preferences? | def test_should_save_settings
prefs = {
"store_name" => "Substruct",
"store_handling_fee" => "0.00",
"store_use_inventory_control"=>"1"
}
assert Preference.save_settings(prefs)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remember_preference settings\n self.preference = Preference.find_or_create_by user_id: self\n self.preference.update settings\n end",
"def preferences_field\n :preferences\n end",
"def store(prefs)\n prefs.each do |key, value|\n self[key] = value\n end if prefs.respond_to?(:each)\n end",
"def set_preference\n @preference = @user.preferences.find(params[:id])\n end",
"def set_preferences\n unless current_user.preference\n pref = Preference.create(user_id: current_user.id,theme: \"default-right\",bgcolor: \"white\",rows: 20, wallpaper: false)\n else\n pref = Preference.where(user_id: current_user.id).first\n end\n session[:theme] = pref.theme\n session[:bgcolor] = pref.bgcolor\n session[:rows] = pref.rows\n session[:wallpaper] = pref.wallpaper\n end",
"def update_prefs\n current_user.preferences = params[:preferences]\n render plain: \"1\"\n end",
"def preferences=(prefs)\n unless prefs.kind_of? Preferences\n raise InvalidPreference, \"Preference settings must be an instance of SmartView::Preferences\"\n end\n @preferences = prefs\n end",
"def save_preferences\n template = Template.find(params[:id])\n authorize Template\n\n args = preference_params\n args[:customize_output_types] = params[:customize_output_types_sel] != '0'\n args[:customize_licenses] = params[:customize_licenses_sel] != '0'\n\n # Template.transaction do\n # Get the current template or a new version if applicable\n @template = get_modifiable(template)\n @template.update(template_output_types: [], licenses: [], repositories: [], metadata_standards: [])\n\n if preference_params[:customize_repositories] != '0'\n # Create custom repositories if applicable and add them to selected repos\n args[:repositories_attributes] = create_custom_repositories(\n existing: args[:repositories_attributes], custom: custom_repo_params\n )\n end\n if preference_params[:customize_metadata_standards] != '0'\n # Create custom metadata standards if applicable and add them to selected standards\n args[:metadata_standards_attributes] = create_custom_standards(\n existing: args[:metadata_standards_attributes], custom: custom_standard_params\n )\n end\n\n if @template.update(args)\n flash.now[:notice] = \"#{success_message(@template, _('saved'))} Don't forget to publish your changes.\"\n else\n flash.now[:alert] = failure_message(@template, _('save'))\n end\n\n render 'preferences', locals: {\n partial_path: 'edit',\n template: @template,\n output_types: ResearchOutput.output_types,\n preferred_licenses: License.preferred.map { |license| [license.identifier, license.id] },\n licenses: License.selectable.map { |license| [license.identifier, license.id] },\n referrer: referrer\n }\n end",
"def set_preference\n preference = Preference.find(params[:id])\n end",
"def create\n @preference = Preference.new(params[:preference])\n\n respond_to do |format|\n if @preference.save\n format.html { redirect_to preferences_path, notice: 'Preference was successfully created.' }\n format.json { render json: preferences_path, status: :created, location: @preference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def prefs_params\n params.require(:preference).permit(:facebook,:twitter,:telephone,:telephone2,:email,:key,:value,:paypal)\n end",
"def set_preference\n @preference = Preference.find(params[:id])\n end",
"def preference_params\n params.require(:preference).permit(:main_style, :jacket_id, :shoe_id, :pant_id, :hat_id)\n end",
"def create\n @preference = Preference.new(params[:preference])\n @preference.user_id = current_account.id\n list\n respond_to do |format|\n if @preference.save\n format.html { redirect_to(@preference, :notice => 'Preference was successfully created.') }\n format.xml { render :xml => @preference, :status => :created, :location => @preference }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @preference.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @preference = Preference.new(preference_params)\n if Preference.where(user_id: current_user.id).count == 0\n respond_to do |format|\n if @preference.save\n format.html { redirect_to @preference, notice: 'Preference was successfully created.' }\n format.json { render :show, status: :created, location: @preference }\n else\n format.html { render :new }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:danger] = \"You have already setup your preference.\"\n redirect_to preferences_path\n end\n end",
"def set_pref\n @pref = Pref.find(params[:id])\n end",
"def preference(key)\n pref = preferences.where(key: key).first_or_initialize\n pref.value = Droom.user_default(key) unless pref.persisted?\n pref\n end",
"def create\n @preference = Preference.new(params[:preference])\n\n respond_to do |format|\n if @preference.save\n format.html { redirect_to @preference, notice: 'Preference was successfully created.' }\n format.json { render json: @preference, status: :created, location: @preference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def preferences_with_defaults\n DEFAULT_PREFS.merge(read_attribute(:preferences) || {})\n end",
"def preference_params\n params.require(:preference).permit(:status, :user_id, :country_id)\n end",
"def preferences\n @page_title = 'Schedule View Preferences'\n @instructors = Group.users_in_group('instructor')\n @aircraft_types = AircraftType.find(:all)\n @offices = Office.find :all\n @instructors.sort!{|a,b| a.first_names<=>b.first_names}\n @aircraft_types.sort!{|a,b| a.type_name<=>b.type_name}\n \n if request.method == :post\n session[:schedule][:preferences] = params[:preferences]\n flash[:notice] = 'Preferences Saved.'\n end\n \n session[:schedule][:preferences] ||= {}\n session[:schedule][:preferences][:types] ||= {}\n session[:schedule][:preferences][:instructors] ||= {}\n \n end",
"def pref\n raw_config = File.open(\"#{Rails.root}/config/prefs.yml\")\n config = YAML.load(raw_config)\n #$prefs=config.symbolize_keys[:pref]\n config\n end",
"def preference_form\n @preferences = Preference.find_by users_id: current_user.id\n if @preferences == nil\n @preferences = Preference.new(:wallpaper => params[:wallpaper], :fontSize => params[:fontSize], :font => params[:font], :profilePicture => params[:profilePicture], :privacy => params[:privacy], :fontColor => params[:fontColor], :users_id => current_user[:id])\n else\n\n @preferences.privacy = params[:privacy];\n\n end\n\n if @preferences.save\n\n Logger.new(\"#{Rails.root}/log/cache_read.log\").error(Rails.root + \"app/assets/stylesheets/application.css\")\n # File.open(Rails.root + \"app/assets/stylesheets/application.css\",'w') do |cssFile|\n # cssFile.puts \"body { \" + params[:wallpaper] + \"}\"\n # end\n flash[:success] = \"Successfully updated your preferences.\"\n else\n flash[:error] = \"Could not update your preferences, please try again.\"\n end\n redirect_to \"/static_pages/home\"\n end",
"def create\n @preference = Preference.new(params[:preference])\n\n respond_to do |format|\n if @preference.save\n format.html { redirect_to @preference, :notice => 'Preference was successfully created.' }\n format.json { render :json => @preference, :status => :created, :location => @preference }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @preference.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @preference = @user.preferences.new(preference_params)\n\n respond_to do |format|\n if @preference.save\n format.html { redirect_to user_preference_path(@user, @preference), notice: 'Preference was successfully created.' }\n format.json { render :show, status: :created, location: @preference }\n else\n format.html { redirect_to new_user_preference_path(@user), alert: @preference.errors[:schedule][0] }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_preference = UserPreference.new(params[:user_preference])\n @user_preference.user_id = current_user.id\n\n respond_to do |format|\n if @user_preference.save\n format.html { redirect_to user_preferences_url, notice: 'User preference was successfully created.' }\n format.json { render json: @user_preference, status: :created, location: @user_preference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_preferences(key)\n defaults = Pref.default_settings[key.to_sym] || Pref.default_settings[key.to_s]\n\n if self.pref.present?\n existing = self.pref.settings[key.to_s].deep_symbolize_keys\n \n # Check for new preferences \n defaults.keys.each do |grp| \n defaults[grp].keys.each do |pref, v|\n # If the group isn't present in the saved values add all of it's preferences\n existing[grp] = defaults[grp] if existing[grp].nil?\n # If the preference isn't present in the saved values add the default\n existing[grp][pref] = defaults[grp][pref] if existing[grp][pref].nil?\n end\n end\n existing\n else\n defaults\n end\n end",
"def update_email_preferences\n prefs = preference_params\n authorize User\n pref = current_user.pref\n # does user not have prefs?\n if pref.blank?\n pref = Pref.new\n pref.settings = {}\n pref.user = current_user\n end\n pref.settings['email'] = booleanize_hash(prefs['prefs'])\n pref.save\n\n # Include active tab in redirect path\n redirect_to \"#{edit_user_registration_path}#notification-preferences\",\n notice: success_message(pref, _('saved'))\n end",
"def add_preference(name, value); end",
"def add_preference(name, value); end",
"def set_pref(key, value)\n preferences.where(key: key).first_or_create.set(value)\n end",
"def update\n\n respond_to do |format|\n @preference = @user.preferences.update(preference_params)[0]\n if @preference.valid?\n format.html { redirect_to user_preference_path(@user, @preference), notice: 'Preference was successfully updated.' }\n format.json { render :show, status: :ok, location: @preference }\n else\n format.html { redirect_to edit_user_preference_path(@user, @preference), alert: @preference.errors[:schedule][0] }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @user_preferences = UserPreference.all\n end",
"def current_preferences(update_params = nil)\n update_params ||= params[:preferences]\n prefs = if logged_in?\n current_user.preferences\n else\n session[:preferences] ||= User.preference_definitions.inject({}) do |memo, pair|\n name, pref = pair\n memo[name] = pref.default_value\n memo\n end\n end\n \n update_params = update_params.to_h.reject{|k,v| v.blank?} if update_params\n if update_params.is_a?(Hash) && !update_params.empty?\n # prefs.update(update_params)\n if logged_in?\n update_params.each do |k,v|\n new_value = if v == \"true\"\n true\n elsif v == \"false\"\n false\n elsif v.to_i > 0\n v.to_i\n else\n v\n end\n current_user.write_preference(k, new_value) unless new_value.blank?\n end\n else\n prefs.update(update_params)\n end\n end\n \n if logged_in?\n current_user.save if current_user.preferences_changed?\n current_user.preferences\n else\n session[:preferences] = prefs\n end\n end",
"def preference_params\n params.require(:preference).permit(:altbtcaddy, :message, :user_id)\n end",
"def get_preferences(key)\n defaults = Pref.default_settings[key.to_sym] || Pref.default_settings[key.to_s]\n defaults = defaults.with_indifferent_access if defaults.present?\n\n if pref.present?\n existing = pref.settings[key.to_s].deep_symbolize_keys\n existing = existing.with_indifferent_access if existing.present?\n\n # Check for new preferences\n defaults.each_key do |grp|\n defaults[grp].each_key do |pref|\n # If the group isn't present in the saved values add all of it's preferences\n existing[grp] = defaults[grp] if existing[grp].nil?\n # If the preference isn't present in the saved values add the default\n existing[grp][pref] = defaults[grp][pref] if existing[grp][pref].nil?\n end\n end\n existing\n else\n defaults\n end\n end",
"def preferences\n @user = current_user\n @mode = \"general\"\n\n respond_to do |format|\n format.html\n end\n end",
"def set_user_preferences\n @user_preferences = UserPreferences.find_or_create_by!(:user => current_user)\n end",
"def preference_params\n params.require(:preference).permit(:user_id, :preferences_excluded_ingredients, :diet_ids =>[])\n end",
"def set_preference\n begin\n @preference = Preference.find(params[:id])\n rescue\n flash[:danger] = \"You don't have permission for this action.\"\n redirect_to preferences_path\n end\n end",
"def pref(key)\n if pref = preferences.find_by(key: key)\n pref.value\n else\n Droom.user_default(key)\n end\n end",
"def create\n @user_preference = UserPreference.new(user_preference_params)\n\n respond_to do |format|\n if @user_preference.save\n format.html { redirect_to @user_preference, notice: 'User preference was successfully created.' }\n format.json { render :show, status: :created, location: @user_preference }\n else\n format.html { render :new }\n format.json { render json: @user_preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def preferences_holder\n nil\n end",
"def update\n respond_to do |format|\n if @preference.update(preference_params)\n format.html { redirect_to @preference, notice: 'Preference was successfully updated.' }\n format.json { render :show, status: :ok, location: @preference }\n else\n format.html { render :edit }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save!\n unless save\n errors = @model.errors.on(:preferences)\n errors = errors.join(\"\\n\") if errors.respond_to?(:join)\n raise PreferencesInvalid.new(\"Validation failed: \" + errors.to_s)\n end\n true\n end",
"def update\n @preference = Preference.find(params[:id])\n \n respond_to do |format|\n if @preference.update_attributes(params[:preference])\n flash[:notice] = 'Preference was successfully updated.'\n format.html { redirect_to(admin_preference_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @preference.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @pref = Pref.new(pref_params)\n\n respond_to do |format|\n if @pref.save\n format.html { redirect_to @pref, notice: 'Pref was successfully created.' }\n format.json { render :show, status: :created, location: @pref }\n else\n format.html { render :new }\n format.json { render json: @pref.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup_notification_preferences\n n = NotificationPreference.create!(user_id: id)\n self.notification_preference_id = n.id\n end",
"def set(preferences={})\n config = self.instance\n preferences.each do |key, value|\n config.set_preference(key, value)\n end\n config.save\n Rails.cache.delete(\"configuration_#{config.id}\".to_sym)\n end",
"def update\n respond_to do |format|\n if @pref.update(pref_params)\n format.html { redirect_to @pref, notice: 'Pref was successfully updated.' }\n format.json { render :show, status: :ok, location: @pref }\n else\n format.html { render :edit }\n format.json { render json: @pref.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cleaners_preference = Cleaners::Preference.new(cleaners_preference_params)\n\n respond_to do |format|\n if @cleaners_preference.save\n format.html { redirect_to @cleaners_preference, notice: 'Preference was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cleaners_preference }\n else\n format.html { render action: 'new' }\n format.json { render json: @cleaners_preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cleaners_preference_params\n params.require(:cleaners_preference).permit(:preferred_time, :preferred_area, :pet_preference, :other_preference).merge(cleaner_id: current_cleaner.id)\n end",
"def create\n @user_preference = UserPreference.new(params[:user_preference])\n \n respond_to do |format|\n if @user_preference.save\n format.html { redirect_to @user_preference, notice: 'User preference was successfully created.' }\n format.json { render json: @user_preference, status: :created, location: @user_preference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_user_preference\n @user_preference = UserPreference.find(params[:id])\n end",
"def update\n @preference = Preference.find(params[:id])\n\n respond_to do |format|\n if @preference.update_attributes(params[:preference])\n format.html { redirect_to @preference, :notice => 'Preference was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @preference.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def preference_value(preferences)\n preferences.param(key)\n end",
"def preference_params\n params.require(:options)\n params.require(:obs)\n params.require(:aux1)\n params.require(:user_id)\n params.permit(:options, :obs, :aux1, :user_id)\n end",
"def preference(value)\n fresh.tap do |criteria|\n criteria.preference_value = value\n end\n end",
"def create\n @user_preference = UserPreference.new(params[:user_preference])\n\n respond_to do |format|\n if @user_preference.save\n format.html { redirect_to @user_preference, notice: 'User preference was successfully created.' }\n format.json { render json: @user_preference, status: :created, location: @user_preference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_preference(name, value)\n @options[:prefs][name] = value\n end",
"def load_all\n parse_json(get(PREFERENCE_URL))['prefs'].each do |p|\n @@greader_preferences[p['id']] = p['value']\n end\n end",
"def update\n @preference = Preference.find(params[:id])\n list\n respond_to do |format|\n if @preference.update_attributes(params[:preference])\n format.html { redirect_to(@preference, :notice => 'Preference was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @preference.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def user_pref(pref, for_user=nil)\n user = for_user || @current_user || User.current_user\n user.preferences[pref] if user\n end",
"def update_preferences\n # Find preference in the DB based on the \"id\" parameter from the current user's request\n @preference = Preference.find(params[:id])\n\n respond_to do |format|\n # Update the current user's preferences in the DB\n # Case 1: Update Successful\n if @preference.update_attributes(params[:preference])\n # Redirect the current user back to the previous page and display success message\n format.html { redirect_to :back, notice: 'Preferences successfully updated.' }\n format.json { head :no_content }\n # Case 2: Update Failed\n else\n # Redirect the current user back to the previous page and display failure message\n format.html { render_to :back, notice: 'Failed to update preferences.' }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n if @preference.nil?\n redirect_to no_user_preferences_path(@user)\n end\n end",
"def prefs_to_hash prefs\n h = {}\n prefs.each do |pref|\n h[pref['id']] = pref['value']\n end\n h\n end",
"def update\n @preference = Preference.find(params[:id])\n\n respond_to do |format|\n if @preference.update_attributes(params[:preference])\n format.html { redirect_to @preference, notice: 'Preference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @preference = Preference.find(params[:id])\n\n respond_to do |format|\n if @preference.update_attributes(params[:preference])\n format.html { redirect_to @preference, notice: 'Preference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def preferences_hash\n self.preferences ||= []\n Hash[\n (0..padded_size-1).collect do |i|\n [(i+1).to_s, self.preferences[i].to_s]\n end\n ]\n end",
"def save_autoshare_prefs(network, params)\n events = params.select {|k,v| v == '1'}.keys\n rv = preferences.save_autoshare_opt_ins(network, events)\n if rv\n @preferences = rv\n true\n else\n false\n end\n end",
"def index\n @prefs = Pref.all\n end",
"def use_static_preferences!\n @preference_store = default_preferences\n end",
"def index\n @cleaners_preferences = Cleaners::Preference.all\n end",
"def update\n resource = client.post_preferences(params.permit(:email_address, :frequency))\n render json: resource,\n serializer: MessagingPreferenceSerializer\n end",
"def create_preference \n if session[\"last_context\"] == \"pl\"\n preference = Preference.create( league_id: \"426\" )\n preference.name = user.name\n session[\"preference\"] = preference\n elsif session[\"last_context\"] == \"bl\"\n preference = Preference.create( league_id: \"430\" )\n preference.name = user.name\n session[\"preference\"] = preference\n elsif session[\"last_context\"] == \"il\"\n preference = Preference.create( league_id: \"438\" )\n preference.name = user.name\n session[\"preference\"] = preference\n elsif session[\"last_context\"] == \"sl\"\n preference = Preference.create( league_id: \"436\" )\n preference.name = user.name\n session[\"preference\"] = preference\n else \n error_league \n end \nend",
"def preferences\n @template = Template.find(params[:id])\n authorize Template\n\n editable = @template.latest? && @template.id.present? && @template.org_id = current_user.org.id\n page = editable ? 'preferences' : 'preferences_show'\n\n render page, locals: {\n partial_path: 'edit',\n template: @template,\n output_types: ResearchOutput.output_types,\n preferred_licenses: License.preferred.map { |license| [license.identifier, license.id] },\n licenses: License.selectable.map { |license| [license.identifier, license.id] },\n referrer: referrer\n }\n end",
"def set_right_preferences_path\n Mongoid::Preferences.configure do |config|\n # model preferences path to dummy model\n config.model_preferences_path = File.join(File.dirname(__FILE__), \"models_preferences\")\n end\nend",
"def save_preferences\n @user = current_user\n @mode = params[:mode]\n\n user_values = user_params\n\n # Check user's password\n if (!current_user.valid_password?(user_params[:current_password]))\n @user.errors[:current_password]=true\n render :action => :preferences\n return\n end\n\n # Delete the current password from the data received\n user_values.delete(:current_password)\n\n respond_to do |format|\n format.html{\n # Try to update the attributes\n if (@user.update_attributes(user_values))\n flash[:notice] = t(\"users.notice.preferences_updated\") if (@mode == \"general\")\n flash[:notice] = t(\"users.notice.password_updated\") if (@mode == \"password\")\n\n redirect_to root_path()\n else\n # If an error raises, show the form again\n render :action => :preferences\n end\n\n return\n }\n end\n end",
"def get_pref(key)\n data = @prefs_fetched ? @prefs_cache : prefs\n data[key]\n end",
"def create\n @book_preference = OptedOut.new(book_preference_params)\n @book_preference.user_id = current_user.id\n @book_preference.book_id = @book.id\n\n if !@book_preference.save!\n flash[:error] = \"Could not create book preferences!\"\n else\n flash[:notice] = 'Book preferences were successfully created!'\n end\n redirect_to(@book)\n end",
"def email_notification_preferences=(prefs_attributes)\n prefs = self.email_notification_preferences # init the object if it wasn't there\n prefs_attributes.each{|key, val| prefs.send(\"#{key}=\", val==\"true\")}\n write_attribute(:email_notification_preferences, prefs)\n end",
"def update\n if @book_preference.update(book_preference_params)\n flash[:notice] = 'Book preferences were successfully updated.'\n else\n flash[:error] = 'Unable to update preferences. Please try after some time!'\n end\n redirect_to(@book)\n end",
"def update\n @user_preference = UserPreference.find(params[:id])\n\n respond_to do |format|\n if @user_preference.update_attributes(params[:user_preference])\n format.html { redirect_to @user_preference, notice: 'User preference was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pref(name, fallback = nil)\n @@prefs ||= {}\n name = name.to_s\n @@prefs[name] ||= Preference.where(key: name).first.try(:value) || fallback\n end",
"def update\n respond_to do |format|\n if @user_preference.update(user_preference_params)\n format.html { redirect_to @user_preference, notice: 'User preference was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_preference }\n else\n format.html { render :edit }\n format.json { render json: @user_preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_hacknu_preference\n @hacknu_preference = HacknuPreference.find(params[:id])\n end",
"def pref_params\n params.require(:pref).permit(:name)\n end",
"def preference_params\n params.require(:preference).permit(healthlabel_ids: [], dietlabel_ids: [])\n end",
"def next_preference!\n self.preference_position += 1\n preferences.fetch preference_position\n end",
"def prefs\n prefs_raw = _prefs_raw unless @prefs_fetched\n return nil if prefs_raw.nil?\n\n @prefs_cache = parse_pref_string(prefs_raw)\n @prefs_cache.clone\n end",
"def use_legacy_db_preferences!\n @preference_store = ScopedStore.new(self.class.name.underscore)\n end",
"def index\n @preference_category = PreferenceCategory.find_by_name('general'.humanize)\n @preferences = @preference_category.preferences.positioned.all\n respond_to do |format|\n format.html { render 'show' }\n format.xml { render :xml => @preferences }\n end\n end",
"def change_preference_list\n\t\tcheck_if_myself\n\t\tuser = current_user\n\t\tnew_preference_list = user_pref_list_params[:preference_list]\n\t\tif new_preference_list != user.preference_list\n\t\t\tuser.update_attributes(user_pref_list_params)\n\t\t\tuser.save\n\t\t\tRecomputeMeetingParticipationsJob.perform_later (0..6).to_a, user\n\t\tend\n\t\tredirect_to settings_page_path\n\tend",
"def preference(method, data = {})\n call_endpoint(Endpoint::Preference, method, data)\n end",
"def preference_for setting\n\n if preferences = self.preference\n pref = preferences.attributes[setting.to_s]\n return pref unless pref.empty?\n end\n\n Preference.default_for setting\n end",
"def create\n @user_pref = UserPref.new(params[:user_pref])\n\n respond_to do |format|\n if @user_pref.save\n format.html { redirect_to(@user_pref, :notice => 'User pref was successfully created.') }\n format.xml { render :xml => @user_pref, :status => :created, :location => @user_pref }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_pref.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @preference_category = PreferenceCategory.find_by_name(params[:id].titleize)\n @preferences = @preference_category.preferences.positioned.all\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @preference }\n end\n end",
"def test_should_have_preferences\n u = users(:basic_user)\n assert_nil u.settings['arbitrary']\n u.settings['arbitrary'] = 'the arbitrary setting'\n u.reload\n assert_equal 'the arbitrary setting', u.settings['arbitrary']\n end",
"def create\n @preference_criterium = PreferenceCriterium.new(params[:preference_criterium])\n\n respond_to do |format|\n if @preference_criterium.save\n format.html { redirect_to @preference_criterium, notice: 'Preference criterium was successfully created.' }\n format.json { render json: @preference_criterium, status: :created, location: @preference_criterium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @preference_criterium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_preference = UserPreference.find(params[:id])\n\n respond_to do |format|\n if @user_preference.update_attributes(params[:user_preference])\n format.html { redirect_to(@user_preference, :notice => 'UserPreference was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_preference.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.71047384",
"0.6982862",
"0.69240975",
"0.68625",
"0.67936575",
"0.67744124",
"0.6701743",
"0.6616281",
"0.6584082",
"0.6558399",
"0.6545109",
"0.6542056",
"0.65122724",
"0.6495747",
"0.6444124",
"0.6442849",
"0.64281374",
"0.63773936",
"0.6375911",
"0.63714576",
"0.6358978",
"0.6356238",
"0.6353688",
"0.6350424",
"0.6331248",
"0.6317783",
"0.63106215",
"0.6285455",
"0.62721145",
"0.62721145",
"0.6250398",
"0.6203332",
"0.6200741",
"0.618845",
"0.61870617",
"0.6185086",
"0.6168737",
"0.6153068",
"0.61488086",
"0.614876",
"0.61385167",
"0.6131778",
"0.61300033",
"0.61286956",
"0.61254704",
"0.61190236",
"0.61043525",
"0.61037165",
"0.61008644",
"0.6094115",
"0.6092395",
"0.60895437",
"0.60866797",
"0.60865515",
"0.6079045",
"0.6075476",
"0.6065805",
"0.6055802",
"0.6054527",
"0.60407346",
"0.60335124",
"0.6023198",
"0.60182136",
"0.60158163",
"0.60101485",
"0.6005797",
"0.59972537",
"0.59972537",
"0.59868044",
"0.59804666",
"0.5972859",
"0.5968432",
"0.5957132",
"0.59531426",
"0.5945233",
"0.5941377",
"0.593681",
"0.59278584",
"0.59270287",
"0.59142333",
"0.5880819",
"0.5875713",
"0.58594435",
"0.57926136",
"0.5788025",
"0.5781931",
"0.57501066",
"0.57499033",
"0.5743993",
"0.5741899",
"0.5739561",
"0.57359356",
"0.57251084",
"0.5723233",
"0.5723186",
"0.571626",
"0.57068914",
"0.570677",
"0.5704828",
"0.5704671"
] | 0.57040185 | 100 |
Here we verify if a preference is true. | def test_should_verify_if_is_true
a_preference = preferences(:store_use_inventory_control)
assert a_preference.is_true?
a_preference = preferences(:store_require_login)
assert !a_preference.is_true?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_pref?(preference)\n !prefs[preference].to_s.empty?\nend",
"def pref?\n type? 'PREF'\n end",
"def prescriptively_ok?\n acceptance & PRESCRIPTIVE == PRESCRIPTIVE\n end",
"def has_dietary_preferences?\n return self.dietary_preference.present?\n end",
"def display_checked?(_preferences, _value)\n false\n end",
"def descriptively_ok?\n acceptance & DESCRIPTIVE == DESCRIPTIVE\n end",
"def passed?\n voting? && has_met_requirement?\n end",
"def sports?\n userPreference.sports?\n end",
"def present?(preferences, value = nil)\n precondition = values ? only_some_present?(values, preferences) : true\n precondition && preferences.present?(key, value)\n end",
"def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end",
"def undetermined?\n undetermined == 'true'\n end",
"def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end",
"def check_prefecture\n if prefecture == \"--未選択--\"\n errors.add(:prefecture, \"選択して下さい\")\n end\n end",
"def peer_auditor_checked?\n !(self.auditor_result == 'None' || self.auditor_result == 'Comment')\n end",
"def verify_vote_proposal_options\n return true unless vote_proposal_options\n if status == \"preview\"\n correct_options = vote_proposal.vote_proposal_options.map(&:name)\n correct_options << \"Accept\"\n correct_options << \"Decline\"\n else\n correct_options = vote_proposal.vote_proposal_options.map(&:name)\n end\n\n vote_proposal_options.all? do |option|\n correct_options.index(option.name)\n end \n end",
"def check_if_all_donors_ready\n self.donor_preferences.each do |donor_preference|\n return false if !donor_preference.is_ready\n end\n return true\n end",
"def show_prf?\n bathing_water['latestProfile.pollutionRiskForecasting'].val == 'true'\n end",
"def true?(param)\n params[param] == 'on'\n end",
"def valid?\n validate\n @model.errors.on(:preferences).blank?\n end",
"def changed_to_manual_check?\n @participant_eligibility.manual_check_status? && ((@previous_status != \"manual_check\") || @new_eligibility_record)\n end",
"def tell_the_truth(options={})\n if options[:profession] == :lawyer\n 'it could be believed that this is almost certainly not false'\n else\n true\n end\nend",
"def enabling_autoshare?\n params[:user][:autoshare_prefs].any? do |p|\n params[:user][:autoshare_prefs][p] == \"1\"\n end\n end",
"def notify_boolean(value)\n value.present? ? 'yes' : 'no'\n end",
"def is_propvalue?(); @type == GRT_PROPVALUE; end",
"def ask_vault_pass?\n !!@meta['ask_vault_pass']\n end",
"def technically_paid?\n unconfirmed_value_paid >= value_needed\n end",
"def pro?\n !!self.pro\n end",
"def confirming?\n self.status == 'confirming'\n end",
"def tell_the_truth(options={})\n if options[:profession] == :lawyer\n \"it could be believed that this was almost certaily not false.\"\n else\n true\n end\nend",
"def smokes?\n userPreference.smokes?\n end",
"def ok_enabled?\r\n return true\r\n end",
"def is_correct?\n\t\tself.correctness\n\tend",
"def pvp_define?\n !pvp.blank?\n end",
"def is_true_value?(value)\n /true|yes|on|y|n|s|si|cierto/ === value \n end",
"def confirmed?\n confirmation == 'yes'\n end",
"def prefers?( other )\n preferences.include? other\n end",
"def test_bool_returns_true\n assert_equal(false, Config.bool?('VAULT_BOOLEAN_VAR'))\n set_env 'VAULT_BOOLEAN_VAR', 'true'\n assert_equal(true, Config.bool?('VAULT_BOOLEAN_VAR'))\n\n Config.default(:foo, true)\n assert_equal(true, Config.bool?(:foo))\n end",
"def self_auditor_checked?\n self.designer_result != 'None'\n end",
"def assertive?\n true\n end",
"def owner_preference?\n owner_uniq_favorite_vote&.value&.>= Vote.owner_id_min_confidence\n end",
"def bool_property(name)\n val = property(name)\n (val && val == 'true')\n end",
"def isSet?\r\n assert_exists\r\n return @o.checked\r\n end",
"def show_wait_for_trip_confirmation_form?\n self.persisted? && !self.wtg_to_clear_pickup? && !self.wtg_for_driver_dispatch?\n end",
"def confirmed?\n confirmation == 'yes'\n end",
"def param_check_bool(param, value)\n if value != 'true' && value != 'false'\n write_output 'Error'.red + \" : argument must be 'true' or 'false' when setting param #{param[:string]}\\n\"\n return false\n end\n param_exec_value_change(param, value)\n end",
"def par?\n cuantos_pares >= 1\n end",
"def has_check?\n @metadata.has_key?(:has_check) && @metadata[:has_check]\n end",
"def has_check?\n @metadata.has_key?(:has_check) && @metadata[:has_check]\n end",
"def accepted?\n verdict && verdict.accepted?\n end",
"def has_correct_options?\n options.corrects.any?\n end",
"def confirmed?\n state == 'confirmed'\n end",
"def awarded_by_review_committee?\n application_review_decision_type.nil? ? false : application_review_decision_type.yes_option\n end",
"def can_make_decision?\n self.awaiting_decisions? || self.awaiting_replies? || self.all_rejected?\n end",
"def is_confirmed?\n if self.confirmed == true\n return true\n else\n return false\n end\n end",
"def true_value?(val)\n EnvHelpers::Utils.true_value?(val)\n end",
"def tell_the_truth(options={})\n if options[:profession] == :lawyer\n 'i cant'\n else\n true\n end\nend",
"def check!\n true\n end",
"def only_some_present?(values, preferences)\n presence = values.map { |value| preferences.present?(key, value) }\n presence.include?(true) && presence.include?(false)\n end",
"def ok_enabled?\n true\n end",
"def can_assume_and_change?\n if can_assume?\n\n # Cache wall first\n @can_assume_and_change ||= false\n return @can_assume_and_change if @can_assume_and_change.present?\n\n # Returns TRUE if the setting contains \"assume\"\n #\n # Lookup the available Setting constants for all the\n # various key mappings.\n if setting(assume_key).value =~ /_ask_and_assume/\n log \"can assume(<strong>#{assume_key}</strong>) and <strong>change</strong>\"\n @can_assume_and_change = true\n return true\n end\n\n end\n end",
"def pending?\n !hashed_password && !reviewer?\n end",
"def always_true\n true\n end",
"def present?( true_value = nil, false_value = nil )\n true_value = FormulaCapture.capture(true_value )\n false_value = FormulaCapture.capture(false_value) \n result_type = true_value ? FormulaCapture.merge_types(true_value.get_type, false_value.get_type) : FormulaCapture.resolve_type(:boolean)\n\n result_type.placeholder(Productions::PresentCheck.new(self, true_value, false_value))\n end",
"def fixed?\n @fixed == 'yes'\n end",
"def default?(preference)\n self.send(preference.to_sym) == self.class.new.send(preference.to_sym)\n end",
"def confirmed?\n memoized_info[:confirmed]\n end",
"def awarded_by_interview_committee?\n application_interview_decision_type.nil? ? false : application_interview_decision_type.yes_option\n end",
"def confirmable?\n status.to_sym.in? [:done]\n end",
"def puede_reproducir?\r\n return (@reproducir_puede && @pez_vivo)\r\n end",
"def accurate?(bools)\n self.answers.map(&:correct) == bools\n end",
"def test_bool\r\n a = true\r\n assert a\r\n end",
"def preferred?\n self.preferred\n end",
"def config_boolean_true?(boolean_field)\n data[boolean_field].to_i == 1\n end",
"def should_run?\n return if paper.manually_similarity_checked\n case setting_value\n when 'off'\n false\n when 'at_first_full_submission'\n submitted_after_first_full_submission?\n when 'after_any_first_revise_decision'\n submitted_after_any_first_revise_decision?\n when 'after_minor_revise_decision'\n submitted_after_minor_revise_decision?\n when 'after_major_revise_decision'\n submitted_after_major_revise_decision?\n end\n end",
"def consigned?\n false\n end",
"def truth?\n truth\n end",
"def confirmed?\n self.status >= 0\n end",
"def good?(value)\n value\n end",
"def superShiny?\n return self.pokemon && self.pokemon.superShiny?\n end",
"def truthy(verdad)\n\tif verdad == 't'\n\t\tverdad = true\n\telsif verdad == \"true\"\n\t\tverdad = true\n\telse\n\t\tverdad = false\n\tend\nend",
"def checkbox?\n (user.premium? && ( record.user_id == user.id )) || user.admin?\n end",
"def true?\n if @block && !@fact\n begin\n return !!@block.call\n rescue StandardError => e\n log.debug \"Confine raised #{e.class} #{e}\"\n return false\n end\n end\n\n unless (fact = Facter[@fact])\n log.debug format('No fact for %<fact>s', fact: @fact)\n return false\n end\n value = convert(fact.value)\n\n return false if value.nil?\n\n if @block\n begin\n return !!@block.call(value)\n rescue StandardError => e\n log.debug \"Confine raised #{e.class} #{e}\"\n return false\n end\n end\n\n @values.any? { |v| convert(v) === value }\n end",
"def disputed?\n !bounty_claim_responses.where(value: false).empty?\n end",
"def true?\n !false?\n end",
"def account_confirmed?\n confirmed?\n end",
"def verify_boolean_param(param)\n if @options.include?(param) && ![true, false].include?(@options[param])\n raise WhmArgumentError.new(\"Boolean parameter must be \\\"true\\\" or \\\"false\\\": #{param}\")\n end\n end",
"def confirmation_required?\n yaml['confirmation_required']\n end",
"def correct?\n @correct || false\n end",
"def confirmed?\n [:confirmed, :in_progress, :done].include?(self.status)\n end",
"def mandate_recently_given?\n @mandate_given && (@mandate_given.is_a?(TrueClass) || @mandate_given.to_s =~ /^(yes|1|true)$/i) ? true : false\n end",
"def can_set_appt?\n has_pixan? && !is_completed?\n end",
"def correct?\n @correct ||= (answer == correct_answer)\n end",
"def satisfied?(flavors)\n result = false\n preferences.each_slice(2) do |pref|\n result = (flavors[pref.first - 1] == pref.last)\n break if result\n end\n result\n end",
"def check_boolean\n\t\tif self.active.nil?\n\t\t\tself.active = \"false\"\n\t\tend\n\t\tif self.on_bookshelf.nil?\n\t\t\tself.on_bookshelf = \"false\"\n\t\tend\n\tend",
"def true?\n if @block and not @fact then\n begin\n return !! @block.call\n rescue StandardError => error\n Facter.debug \"Confine raised #{error.class} #{error}\"\n return false\n end\n end\n\n unless fact = Facter[@fact]\n Facter.debug \"No fact for %s\" % @fact\n return false\n end\n value = convert(fact.value)\n\n return false if value.nil?\n\n if @block then\n begin\n return !! @block.call(value)\n rescue StandardError => error\n Facter.debug \"Confine raised #{error.class} #{error}\"\n return false\n end\n end\n\n return @values.any? do |v| convert(v) === value end\n end",
"def test?\n value_for('test') == 'true'\n end",
"def will_answer?\n return true\n end",
"def all_options_main?\n no_preference_options.none? && not_counted_options.none?\n end",
"def expected?\n false\n end",
"def complete_property_checkups?\n nil\n end"
] | [
"0.7398408",
"0.7188429",
"0.694314",
"0.6846657",
"0.6842776",
"0.64817506",
"0.6453544",
"0.6366312",
"0.63659054",
"0.62658584",
"0.6238055",
"0.61952966",
"0.6189725",
"0.6163909",
"0.6163411",
"0.61403745",
"0.61381257",
"0.6134576",
"0.61083555",
"0.6105409",
"0.610343",
"0.6093523",
"0.60616326",
"0.60466933",
"0.6042567",
"0.6041633",
"0.6026356",
"0.60251623",
"0.60236454",
"0.6020881",
"0.6018472",
"0.60181934",
"0.6001765",
"0.59957343",
"0.5987768",
"0.5981517",
"0.5977553",
"0.5975909",
"0.59703404",
"0.5968472",
"0.5957896",
"0.5956723",
"0.59497696",
"0.5940574",
"0.593912",
"0.5937826",
"0.59333897",
"0.59333897",
"0.5932282",
"0.5925064",
"0.5923128",
"0.592219",
"0.5921195",
"0.5917542",
"0.59134257",
"0.59105194",
"0.5904042",
"0.5903332",
"0.589723",
"0.58850616",
"0.5869053",
"0.58617914",
"0.58545357",
"0.5842127",
"0.58382463",
"0.58336776",
"0.5832399",
"0.5830224",
"0.58191925",
"0.5816719",
"0.581499",
"0.5811627",
"0.5809115",
"0.5808599",
"0.5808032",
"0.58036375",
"0.5801727",
"0.5801633",
"0.5800699",
"0.57992035",
"0.5795023",
"0.5793869",
"0.5793512",
"0.57913446",
"0.5786637",
"0.5784464",
"0.57795733",
"0.5778981",
"0.57784986",
"0.577742",
"0.57720387",
"0.5771465",
"0.5769745",
"0.57675433",
"0.57633895",
"0.57622033",
"0.5757592",
"0.5756041",
"0.5754897",
"0.57529384"
] | 0.7983518 | 0 |
if RAILS_ENV == 'production' define_index do indexes :name indexes description indexes sections.name indexes sections.text indexes street indexes city indexes url indexes location_type.name indexes comments.title indexes comments.text indexes user.username end end | def address_empty?
if !self.street.blank? or !self.city.blank? or !self.state.blank? or !self.postal_code.blank?
return false
else
return true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_index_existence\n index_every_directory(:remove_first) unless index_exists? or RAILS_ENV==\"production\"\n end",
"def ensure_index_existence\n index_every_directory(:remove_first) unless index_exists? or RAILS_ENV==\"production\"\n end",
"def indexes\n raise 'not implemented'\n end",
"def definition(table_name)\n\n if unique?\n \" add_index :#{table_name}, #{index_columns}, :unique => true\"\n else\n \" add_index :#{table_name}, #{index_columns}\"\n end\n end",
"def add_indexes\n if hereditary? && !index_options[{ _type: 1 }]\n index({ _type: 1 }, { unique: false, background: true })\n end\n true\n end",
"def index\n raise Discourse::InvalidAccess.new if Rails.env.production?\n end",
"def require_index(name); end",
"def require_index(name); end",
"def construct_index\n end",
"def index\n if institution_host?\n scoped_index\n else\n global_index\n end\n end",
"def index_information\n @db.index_information(@name)\n end",
"def index_definition_sql(table_name, index)\n\t raise Error, \"Partial indexes are not supported for this database\" if index[:where]\n\n\t # Basic index creation DDL.\n\t sql = [\"CREATE\"]\n\t case index[:type]\n\t when :bitmap\n\t\t raise Error, \"Bitmap indexes cannot be unique\" if index[:unique]\n\t sql << 'BITMAP'\n\t when NilClass, :normal\n\t sql << 'UNIQUE' if index[:unique]\n\t else\n\t raise Error, \"Index type #{index[:type].inspect} is not supported for this database\"\n\t end\n\t index_name = index[:name] || default_index_name(table_name, index[:columns])\n\t qualified_table_name = quote_schema_table table_name\n\t sql << \"INDEX #{quote_identifier(index_name)} ON #{qualified_table_name}\"\n\t \n\t # Index columns and join indexes.\n index_join, index_columns = *index.values_at(:join,:columns)\n\t sql << literal(index_columns)\n if index_join\n\t\t raise Error, \"Join clauses are only supported for bitmap indexes\" if index[:type]!=:bitmap\n\t\t sql << \"FROM #{qualified_table_name},\"\n\t\t sql << index_columns.map{|k| quote_identifier schema_and_table(k).first }.uniq.join(', ')\n\t\t \n\t\t # TODO: Document this short-hand syntax: {:columns=>[:ref_table__ref_column], :join=>[:fk_column]}\n if Array===index_join and index_join.length==index_columns.length and index_join.all?{|k| Symbol===k}\n index_join = Hash[ index_join.map{|k| :\"#{table_name}__#{k}\" }.zip(index_columns) ]\n end\n\n\t sql << \"WHERE #{filter_expr(index_join)}\"\n\t end\n\t \n\t # Index attributes and options.\n\t sql << 'LOCAL' if index[:partitioned]\n\t sql << flag_option_sql(index, :parallel)\n\t sql << flag_option_sql(index, :logging)\n\t sql << \"TABLESPACE #{quote_identifier(index[:tablespace])}\" if index[:tablespace]\n\t sql << flag_option_sql(index, :visible, 'INVISIBLE')\n\t sql << compress_option_sql(index)\n\t sql << index[:options] if String === index[:options]\n\t sql << 'UNUSABLE' if FalseClass === index[:valid]\n\t sql.compact.join ' '\n\t end",
"def croucher_index_confidentiality\n \"private\"\n end",
"def force_create_index\n\t\t\tif @entity.authenticate?\n\t\t\t\tputs Stock.create_index! force: true \n\t\t\tend\n\t\tend",
"def create_search_index\n Tire.index self.index_name\n end",
"def index_information\n @db.index_information(@name)\n end",
"def index(name, type = :find)\n @defined_indexes ||= {}\n @defined_indexes[name.to_sym] = type\n end",
"def index?\n INDEXES.include? self.name\n end",
"def create_index_with(type, index_name)\n db = Neo4j.started_db\n index_config = lucene_config(type)\n if config.entity_type == :node\n db.lucene.for_nodes(index_name, index_config)\n else\n db.lucene.for_relationships(index_name, index_config)\n end\n end",
"def indexed\n meta(index: true)\n end",
"def build_indexes\n Schema::Physical::Indexes.new\n end",
"def generate_indexes\n @posts = DB[:posts].all\n index_layout = File.read \"#{root}/_layouts/index.html\"\n @output = Liquid::Template.parse(index_layout).render('site'=>self)\n path = \"#{root}/_site/index.html\"\n File.open(path, 'w'){ |f| f.write(@output) }\n end",
"def index_keywords!\n all.each { |d| d.index_keywords! ? MongoidSearch::Log.green(\".\") : MongoidSearch::Log.red(\"F\") }\n end",
"def index_definition_sql(table_name, index)\n index_name = index[:name] || default_index_name(table_name, index[:columns])\n if index[:type]\n raise Error, \"Index types are not supported for this database\"\n elsif index[:where]\n raise Error, \"Partial indexes are not supported for this database\"\n else\n \"CREATE #{'UNIQUE ' if index[:unique]}INDEX #{index_name} ON #{quote_identifier(table_name)} #{literal(index[:columns])}\"\n end\n end",
"def index_definition_sql(table_name, index)\n index_name = index[:name] || default_index_name(table_name, index[:columns])\n if index[:type]\n raise Error, \"Index types are not supported for this database\"\n elsif index[:where]\n raise Error, \"Partial indexes are not supported for this database\"\n else\n \"CREATE #{'UNIQUE ' if index[:unique]}INDEX #{quote_identifier(index_name)} ON #{quote_identifier(table_name)} #{literal(index[:columns])}\"\n end\n end",
"def set_index_comment(index_name, comment)\n\n end",
"def index\n set_index_posts\n end",
"def create_search_index\n #Notice the assoction on article.user.id\n TaggyMcFaggy.create_index :attribute_namespace => :article_text,\n :document_id => id,\n :words => text_content,\n :association => user.id\n \n end",
"def index\n @companies = Company.rank.where(\"tweet_count > 0\").page(params[:page]).per(30)\n @main_indices = MainIndex.all\n end",
"def index_type(env)\n @index_type\n end",
"def create_index(table_name, index_spec)\n @iadmin ||= IndexedTableAdmin.new(@configuration)\n @iadmin.addIndex(table_name.to_java_bytes, index_spec)\nend",
"def index_type\n name\n end",
"def index_on( field, opts={} )\n opts = Gnash.new( opts )\n design_document(true).add!( opts.merge!(:name => field) )\n unless indexes.include?( field )\n indexes << field.to_sym \n indexes << field.to_s \n end \n self \n end",
"def index_template\n :index\n end",
"def index_template\n :index\n end",
"def index_name(event)\n\n index_name, num_docs, write_alias, read_alias = index_status()\n @logger.error(\"status\", :index_name => index_name, :num_docs => num_docs, :write_alias => write_alias, :read_alias => read_alias)\n\n if num_docs == 0\n\n @logger.error(\"index does not exist, create one\", :index_name => index_name)\n\n create_index(index_name)\n\n create_index_aliases(index_name, write_alias, read_alias)\n\n elsif num_docs < @messages_per_slice\n\n @logger.error(\"less than, use the current index\", :index_name => index_name)\n\n else\n\n @logger.error(\"greater than or equal to, create new index and aliases\")\n\n slice = index_name.split('_')[0].to_i\n @logger.error(\"slice\", :slice => slice)\n\n new_index_name = to_index_name(slice += 1, @application, @domain)\n @logger.error(\"index_name\", :new_index_name => new_index_name)\n\n create_index(new_index_name)\n\n update_index_aliases(index_name, new_index_name, write_alias, read_alias)\n end\n\n write_alias\n\n end",
"def setting_index\n end",
"def index\n # @process_lts = ProcessLt.where([get_query_string])\n index_admin\n end",
"def index_definition_sql(table_name, index)\n index_name = index[:name] || default_index_name(table_name, index[:columns])\n if index[:type]\n raise Error, \"Index types are not supported for this database\"\n elsif index[:where]\n raise Error, \"Partial indexes are not supported for this database\"\n else\n \"CREATE #{'UNIQUE ' if index[:unique]}INDEX #{quote_identifier(index_name)} ON #{quote_identifier(table_name)} #{literal(index[:columns])}\"\n end\n end",
"def index\n set_index\n end",
"def indexes(table_name, name = nil)\n result = query(\"exec sp_helpindex '#{table_name}'\", name)\n \n indexes = []\n result.each do |row|\n if row[1].match('primary key') == nil\n indexes << IndexDefinition.new(table_name, row[0], row[1].match('unique') != nil, row[2].split(',').each {|x| x.strip!})\n end\n end\n \n indexes\n end",
"def index_disabled\n @index_disabled ||= false\n end",
"def check_index_name\n return if index_name\n @logger.display('index_name_missing')\n exit 1\n end",
"def index_name\n get_key('ALGOLIA_INDEX_NAME', 'index_name')\n end",
"def create_index\n self[:create_index]\n end",
"def build_index \n Mebla.log(\"Building #{self.slingshot_index_name}\", :debug)\n # Create the index\n result = @slingshot_index.create :mappings => @mappings \n \n Mebla.log(\"Created #{self.slingshot_index_name}: #{result.to_s}\")\n \n # Check if the index exists\n index_exists?\n end",
"def index\r\n build_index unless @index\r\n @index\r\n end",
"def index_definition_sql(table_name, index)\n index_name = index[:name] || default_index_name(table_name, index[:columns])\n raise Error, \"Index types are not supported for this database\" if index[:type]\n raise Error, \"Partial indexes are not supported for this database\" if index[:where] && !supports_partial_indexes?\n \"CREATE #{'UNIQUE ' if index[:unique]}INDEX #{quote_identifier(index_name)} ON #{quote_schema_table(table_name)} #{literal(index[:columns])}#{\" WHERE #{filter_expr(index[:where])}\" if index[:where]}\"\n end",
"def build_xapian_index()\n models = [Request, Response]\n if ! $existing_db\n ActsAsXapian::WriteableIndex.rebuild_index(models, verbose=false)\n $existing_db = true\n end\n end",
"def indexes(table_name, name = nil)\n result = query(<<-SQL, 'SCHEMA')\n SELECT distinct i.relname, d.indisunique, d.indkey, pg_get_indexdef(d.indexrelid), t.oid\n FROM pg_class t\n INNER JOIN pg_index d ON t.oid = d.indrelid\n INNER JOIN pg_class i ON d.indexrelid = i.oid\n WHERE i.relkind = 'i'\n AND d.indisprimary = 'f'\n AND t.relname = '#{table_name}'\n AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname = ANY (current_schemas(false)) )\n ORDER BY i.relname\n SQL\n\n result.map do |row|\n index_name = row[0]\n unique = row[1] == 't'\n indkey = row[2].split(\" \")\n inddef = row[3]\n oid = row[4]\n\n columns = query(<<-SQL, \"SCHEMA\")\n SELECT a.attnum, a.attname, t.typname\n FROM pg_attribute a, pg_type t\n WHERE a.attrelid = #{oid}\n AND a.attnum IN (#{indkey.join(\",\")})\n AND a.atttypid = t.oid\n SQL\n columns = columns.inject({}){ |h, r| h[r[0].to_s] = [r[1], r[2]]; h }\n column_names = columns.values_at(*indkey).compact.map{ |a| a[0] }\n\n unless column_names.empty?\n # add info on sort order for columns (only desc order is explicitly specified, asc is the default)\n desc_order_columns = inddef.scan(/(\\w+) DESC/).flatten\n orders = desc_order_columns.any? ? Hash[desc_order_columns.map {|order_column| [order_column, :desc]}] : {}\n where = inddef.scan(/WHERE (.+)$/).flatten[0]\n # using = inddef.scan(/USING (.+?) /).flatten[0].to_sym\n\n spatial = inddef =~ /using\\s+gist/i &&\n columns.size == 1 &&\n %w[geometry geography].include?(columns.values.first[1])\n\n # IndexDefinition.new(table_name, index_name, unique, column_names, [], orders, where, nil, using)\n ::RGeo::ActiveRecord::SpatialIndexDefinition.new(table_name, index_name, unique, column_names, [], orders, where, !!spatial)\n end\n end.compact\n end",
"def index_field_names\n Blacklight.config[:index_fields][:field_names]\n end",
"def add_index(table_name,column_name,options = {})\n index_name = options[:name] || index_name(table_name,:column => Array(column_name))\n \n if options[:spatial]\n execute \"CREATE SPATIAL INDEX #{index_name} ON #{table_name} (#{Array(column_name).join(\", \")})\"\n else\n super\n end\n end",
"def build_index!\n puts \"build_index!\"\n @indexes = {}\n \n @indexes = @resource_class.build_indexes(@resources)\n @indexes[:_default] ||= @default_order\n end",
"def index_name=(name)\n @index_name = name\n end",
"def index_name=(name)\n @index_name = name\n end",
"def makeIndex()\n\t\tputs \"Indexing TlpDB...\" unless @options[:quiet]\n\n\t\tlineno = 1\n\t\tfor line in @dbFile do\n\t\t\tif line =~ /^name (.*)/ then\n\t\t\t\t@index[$1] = lineno\n\t\t\tend\n\t\t\tlineno = lineno.next\n\t\tend\n\n\t\tputs \"Done. #{@index.size} packages\" unless @options[:quiet]\n\tend",
"def create_indexes\n indexes = %w{ Page(page_id) Trait(eol_pk) Trait(resource_pk) Term(uri) Term(name)\n Resource(resource_id) MetaData(eol_pk)}\n indexes.each do |index|\n begin\n query(\"CREATE INDEX ON :#{index};\")\n rescue Neography::NeographyError => e\n if e.to_s =~ /already created/\n puts \"Already have an index on #{index}, skipping.\"\n else\n raise e\n end\n end\n end\n end",
"def create_main_index(version = 1)\n self.create_index(version)\n self.set_alias(version)\n end",
"def index(name)\n query\n @options[:index_name] = name.to_s\n self\n end",
"def setup_index\n @index_driver.setup_index\n end",
"def ensure_indices\n @dao.collection.ensure_index(\n [['identity.email', Mongo::ASCENDING]],\n index_options([:background, :unique])\n )\n @dao.collection.ensure_index([['customer_id', Mongo::ASCENDING]], index_options)\n @dao.collection.ensure_index([['slug', Mongo::ASCENDING]], index_options)\n @indexed = true\n end",
"def create_index\n # Only create the index if it doesn't exist\n raise Mebla::Errors::MeblaIndexException.new(\"#{@slingshot_index_name} already exists !! use #rebuild_index to rebuild the index.\") if index_exists?\n \n Mebla.log(\"Creating index\")\n \n # Create the index\n build_index\n end",
"def index\n init(false,false)\n \n end",
"def indexes\n @indexes ||= []\n end",
"def generate_text_sql\n ThinkingSphinx.context.indexed_models.each do |model|\n model = model.constantize\n model.define_indexes\n model.sphinx_indexes.each do |idx|\n idx.sources.each do |src|\n puts \"#{model.to_s} SQL => \"\n puts src.to_sql\n end\n end\n end\nend",
"def manifestation_index_field_names\n Blacklight.config[:manifestation_index_fields][:field_names]\n end",
"def on(name)\n indexes_on(name).map.(&method(:index_from_database))\n end",
"def indexes(table_name, name = nil) #:nodoc:\r\n sql = \"SELECT name, INDEX_OPTIONS & 1 AS [unique], index_expression FROM SYSTEM.INDEXES WHERE parent = '#{table_name}'\"\r\n select(sql, name).map do |row|\r\n index = IndexDefinition.new(table_name, row['name'])\r\n index.unique = row['unique'] == 1\r\n index.columns = row['index_expression']\r\n index\r\n end\r\n end",
"def indexes(table_name, name = nil) #:nodoc:\n schemas = schema_search_path.split(/,/).map { |p| quote(p) }.join(',')\n result = query(<<-SQL, name)\nSELECT i.relname, d.indisunique, a.attname\nFROM pg_class t, pg_class i, pg_index d, pg_attribute a, pg_namespace n\nWHERE i.relkind = 'i'\nAND d.indexrelid = i.oid\nAND d.indisprimary = 'f'\nAND t.oid = d.indrelid\nAND t.relname = '#{table_name}'\nAND a.attrelid = t.oid\nAND n.nspname in (#{schemas})\nAND n.oid = t.relnamespace\nAND ( d.indkey[0]=a.attnum OR d.indkey[1]=a.attnum\nOR d.indkey[2]=a.attnum OR d.indkey[3]=a.attnum\nOR d.indkey[4]=a.attnum OR d.indkey[5]=a.attnum\nOR d.indkey[6]=a.attnum OR d.indkey[7]=a.attnum\nOR d.indkey[8]=a.attnum OR d.indkey[9]=a.attnum )\nORDER BY i.relname\nSQL\n \n current_index = nil\n indexes = []\n \n result.each do |row|\n if current_index != row[0]\n indexes << IndexDefinition.new(table_name, row[0], row[1] == \"t\", [])\n current_index = row[0]\n end\n \n indexes.last.columns << row[2]\n end\n \n indexes\n end",
"def to_create_index_sql\n queries = []\n unless indexes.blank?\n indexes.each do |column|\n sql = \"CREATE INDEX #{to_s.downcase}_#{column}_index ON \"\n sql << \"#{to_sql} (#{column.to_sql})\"\n queries << sql.compress_lines\n end\n end\n queries\n end",
"def indexes(table_name, name = nil)#:nodoc:\n indexes = []\n current_index = nil\n (execute(\"SHOW KEYS FROM #{table_name}\", name) || []).each do |row|\n if current_index != row[2]\n next if row[2] == \"PRIMARY\" # skip the primary key\n current_index = row[2]\n indexes << ActiveRecord::ConnectionAdapters::IndexDefinition.new(row[0], row[2], row[1] == \"0\", [], row[10] == \"SPATIAL\")\n end\n indexes.last.columns << row[4]\n end\n indexes\n end",
"def setup_db_index\n self.copy_tables.each do |t|\n no_sql_connection.create_pre_mongified_id_index(t.name)\n end\n end",
"def create_index o_class, name:, on: :automatic, type: :unique\n logger.progname = 'RestCreate#CreateIndex'\n begin\n c = classname o_class\n execute transaction: false do\n \t command = if on == :automatic\n \t\t \"CREATE INDEX #{c}.#{name} #{type.to_s.upcase}\"\n \t\telsif on.is_a? Array\n \t\t \"CREATE INDEX #{name} ON #{classname(o_class)}(#{on.join(', ')}) #{type.to_s.upcase}\"\n \t\telse\n \t\t nil\n \t\tend\n \t [{type: \"cmd\", language: 'sql', command: command}]\n end\n logger.info{\"Index on #{c} based on #{name} created.\"}\n rescue RestClient::InternalServerError => e\n response = JSON.parse(e.response)['errors'].pop\n \t error_message = response['content'].split(':').last\n logger.error{\"Index not created.\"}\n logger.error{\"Error-code #{response['code']} --> #{response['content'].split(':').last }\"}\n nil\n end\n end",
"def indexes_per_table\n 65_535\n end",
"def index\n @config_vars = ENVIRONMENT_VARIABLES_TO_PRINT\n @corpus_size = RLetters::Solr::CorpusStats.new.size\n @ping = RLetters::Solr::Connection.ping\n @solr_info = RLetters::Solr::Connection.info\n end",
"def indexes\n @indexes ||= connection.indexes(table_name, \"#{name} Indexes\")\n end",
"def index\n\t\t\n\tend",
"def index\n\t\t\n\tend",
"def index\n\t\t\n\tend",
"def index\n\t\t\n\tend",
"def index\n\t\t\n\tend",
"def check_index_finder\n # Leave it alone\n end",
"def do_local_indexing(solr_doc); end",
"def index\n @title = \"Tenjin\"\n @inst_var_one = \"INST_VAR_ONE\"\n @inst_var_two = \"INST_VAR_TWO\"\n return \"#{self.class}: INDEX RETURN STRING\"\n end",
"def default_index_name(table_name, columns)\n\t\t schema, table = schema_and_table(table_name)\n\t\t ds = DB[:all_indexes].where(:table_name=>table,:dropped=>'NO')\n\t\t ds = ds.where :owner=>schema unless schema.nil?\n\t\t \"#{table[0,25]}_ix%2.2d\" % [ds.count + 1]\n\t\t end",
"def index_name_length\n 31\n end",
"def indexes\n Indexes.new(database, name)\n end",
"def index ; @index ; end",
"def indexes(_table_name, _name = nil)\n []\n end",
"def change\n \tenable_extension 'btree_gin'\n \tadd_index :users,[:first_name, :last_name, :email], using: :gin, algorithm: :concurrently\n end",
"def has_index?\n INDEX_REGEXP =~ rootname_minus_role\n end",
"def add_to_index(vendor_prod_id, name, severity)\n year = NvdFileSystem::year_from_name(name)\n\n path=\"#{@nvdfs.root_path}/index\"\n Dir.mkdir path unless Dir.exist? path\n path += \"/#{year}\"\n Dir.mkdir path unless Dir.exist? path\n path += \"/#{vendor_prod_id}\"\n\n\n idx = NvdfsSimpleIndex.load path\n idx.add(severity, name)\n idx.save\n\n end",
"def index\n @title=t(\"admin.base.index.title\")\n end",
"def index_offering_for_elasticsearch\n return lambda do |offer|\n var = offer[:name].gsub(/(\\s+)/, '_')\n return {\"index\": {\"_id\": \"#{var}\"}}\n end\nend",
"def create_search_index\n Tire.index Person.index_name do\n create(\n settings: {\n analysis: {\n filter: {\n name_ngrams: {\n 'side' => 'front',\n 'max_gram' => 10,\n 'min_gram' => 1,\n 'type' => 'edgeNGram'\n }\n },\n analyzer: {\n full_name: {\n 'filter' => %w(standard lowercase asciifolding),\n 'type' => 'custom',\n 'tokenizer' => 'standard'\n },\n partial_name: {\n 'filter' => %w(standard lowercase asciifolding name_ngrams),\n 'type' => 'custom',\n 'tokenizer' => 'standard'\n },\n keyword: {\n 'filter' => %w(lowercase),\n 'tokenizer' => 'keyword'\n }\n }\n },\n store: {\n type: Rails.env.test? ? :memory : :niofs\n }\n },\n mappings: {\n person: {\n properties: {\n first_name: {\n fields: {\n partial: {\n search_analyzer: 'full_name',\n index_analyzer: 'partial_name',\n type: 'string'\n },\n first_name: {\n type: 'string',\n analyzer: 'full_name'\n }\n },\n type: 'multi_field'\n },\n last_name: {\n fields: {\n partial: {\n search_analyzer: 'full_name',\n index_analyzer: 'partial_name',\n type: 'string'\n },\n last_name: {\n type: 'string',\n analyzer: 'full_name'\n }\n },\n type: 'multi_field'\n },\n initials: {\n type: 'string',\n analyzer: 'simple'\n },\n profession: {\n type: 'string',\n analyzer: 'keyword'\n },\n email: {\n type: 'string',\n analyzer: 'simple'\n },\n login: {\n type: 'string',\n analyzer: 'simple'\n },\n year_entrance: {\n type: 'date',\n format: 'YYYY'\n },\n year_out: {\n type: 'date',\n format: 'YYYY'\n }\n }\n }\n }\n )\n end\n end",
"def index\t\t\n\tend",
"def index\n @@index ||= Ferret::Index::Index.new(default_index_params)\n end",
"def index\n @@index ||= Ferret::Index::Index.new(default_index_params)\n end",
"def add_index_field(*) super end",
"def index_algorithms\n {}\n end",
"def index_algorithms\n {}\n end"
] | [
"0.64384854",
"0.64384854",
"0.62137336",
"0.61372256",
"0.60987246",
"0.60636115",
"0.60047305",
"0.60047305",
"0.5986503",
"0.5949258",
"0.59465885",
"0.59400415",
"0.59310704",
"0.59061843",
"0.590034",
"0.58992034",
"0.5898599",
"0.5882596",
"0.58533615",
"0.5828817",
"0.58242124",
"0.57680595",
"0.57584566",
"0.5755282",
"0.5752362",
"0.5740693",
"0.57403415",
"0.57398146",
"0.57316047",
"0.57259023",
"0.56951255",
"0.56824285",
"0.5676816",
"0.56758976",
"0.56758976",
"0.5672092",
"0.56718606",
"0.56718516",
"0.5661395",
"0.56418204",
"0.5639365",
"0.5625845",
"0.56042403",
"0.55923283",
"0.5588997",
"0.55862874",
"0.55862206",
"0.5579253",
"0.5576114",
"0.55710644",
"0.55539596",
"0.5552398",
"0.55268943",
"0.55166507",
"0.55166507",
"0.5511491",
"0.55060154",
"0.5501968",
"0.5489642",
"0.5482888",
"0.5473758",
"0.546646",
"0.54640824",
"0.5460541",
"0.5459579",
"0.54574066",
"0.5455326",
"0.54523164",
"0.54493725",
"0.5449087",
"0.5443528",
"0.5426107",
"0.54247594",
"0.54245216",
"0.5421381",
"0.5419042",
"0.5414773",
"0.5414773",
"0.5414773",
"0.5414773",
"0.5414773",
"0.5404932",
"0.5403546",
"0.5391788",
"0.5391122",
"0.53834957",
"0.53779155",
"0.5370965",
"0.5354331",
"0.53536415",
"0.5347585",
"0.5346271",
"0.53449696",
"0.53379923",
"0.53340244",
"0.5330243",
"0.53283316",
"0.53283316",
"0.532631",
"0.5323419",
"0.5323419"
] | 0.0 | -1 |
GET /orders/1 GET /orders/1.json | def show
@order = Order.where(id: params[:id], user: current_user).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def index\n @orders = Order.all\n render json: @orders, status: 200\n end",
"def index\n @orders = Order.order(\"id\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n if @orders.count >= 1\n json_response(@orders)\n else\n json_response({ Message: Message.no_data }, :not_found)\n end\n end",
"def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend",
"def show\n order = Order.find(params[:id])\n render json: order\n end",
"def show\n @order = Order.find(params[:id])\n\n render json: @order\n end",
"def index\n\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def index\n @orders = Order.all\n respond_to do |format|\n format.html\n format.json { render :json => @orders }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n render json: @order, status: :ok\n\n end",
"def show\n @v1_order = V1::Order.find(params[:id])\n\n if @v1_order.nil?\n render json: @v1_order, message: 'Resource not found', status: 404\n else\n render json: @v1_order, message: 'OK', status: 200\n end\n end",
"def index\n #@orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end",
"def show\n render json: @order\n end",
"def show\n render json: @order\n end",
"def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend",
"def show\n \n @order = Order.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n \n end \n end",
"def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end",
"def index\n\t\t@orders = Order.all\n\t\trespond_with @orders\n\tend",
"def show\n @order1 = Order1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order1 }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end",
"def orders\n authenticated_post(\"orders\").body\n end",
"def index\n @orders = Order.order(\"id DESC\").page(params[:page])\n\n if params[:user_id]\n @orders = @orders.where(:user_id => params[:user_id])\n end\n\n if Rails.configuration.orders_status.select{|k, v| v[:real]}.keys.include? params[:status]\n @orders = @orders.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=>@order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n @title = \"Order #{@order.id}\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def recent_orders()\n\t\twith_auth nil do |options|\n\t\t\tself.class.get(\"/api/v1/orders\", options)\n \tend\n\tend",
"def show\n #@order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n if @order\n respond_to do |format|\n format.html { @order }\n format.json { render json: @order.to_json(include: [:status, :package, :discount]) }\n end\n else\n redirect_to orders_path, notice: \"Order ID not found for that client.\"\n end\n end",
"def index\n @orders = @group.orders\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @power_orders = PowerOrder.all\n render json: @power_orders\n end",
"def index\n @admin_orders = Order.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_orders }\n end\n end",
"def order(id, orderid = '')\n get(\"/accounts/#{id}/orders\")['orders']\n end",
"def retrieve_order(order_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/orders/{order_id}',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def index # see model > order.rb\n # if current_user\n @orders = current_user.orders\n render \"index.json.jb\"\n # else\n # render json: [], status: :unauthorized\n # end\n end",
"def index\n @orders = Order.paginate page: params[:page], order: 'created_at desc', \n per_page: 10\n \n respond_to do |format|\n format.html\n format.json { render json: @orders } \n end\n end",
"def index\n @line_items = @order.line_items\n\n render json: @line_items\n end",
"def index\n @orders = order.all\n end",
"def searchByOrder\n \torderId = params['id']\n\t order = Order.where(id: orderId)\n\t render json: order, status: 200\n\tend",
"def get_order(order_id)\n res = request('get', \"https://#{orders_path}/#{order_id}\")\n parse_response res\n end",
"def show\n @order = Order.find(request[:order_id])\n @order_item = @order.order_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_item }\n end\n end",
"def index\n @orders = Order.all\n render json: { status: 'SUCCESS', message: 'Loaded posts', data: @orders }\n end",
"def fetch\n @order = Order.where(owner_id: current_user.branch.nodes.pluck(:id)).order('orders.quantity').last\n\n render json: {id: @order.id, quantity: @order.quantity,\n date: @order.created_at.strftime('%d/%m/%Y'),\n time: @order.created_at.strftime('%p %I:%M'),\n destination: \"#{t('fridge')} - #{@order.owner_id}\"\n }, status: :ok\n end",
"def get(order_id)\n get_request(t_url(:order, order_id))\n end",
"def get_order\n @order = Order.find(params[:id])\n end",
"def get_order\n @order = Order.find(params[:id])\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end",
"def index\n @orders = Order.all\n end"
] | [
"0.7554187",
"0.7488565",
"0.7475228",
"0.73777765",
"0.73714006",
"0.7341344",
"0.73384553",
"0.73168725",
"0.73018956",
"0.7291244",
"0.7291244",
"0.7291244",
"0.7291244",
"0.72911215",
"0.7281374",
"0.7266143",
"0.72498786",
"0.7228276",
"0.7213504",
"0.71842283",
"0.7126197",
"0.7126197",
"0.70958656",
"0.70884424",
"0.7045333",
"0.7017131",
"0.701173",
"0.7005317",
"0.7005317",
"0.7005317",
"0.7005317",
"0.7005317",
"0.7005317",
"0.7005317",
"0.7005317",
"0.7005317",
"0.7005317",
"0.7005317",
"0.7005317",
"0.7005317",
"0.7005317",
"0.7005317",
"0.7005317",
"0.69797677",
"0.6975385",
"0.6963179",
"0.69519156",
"0.6920044",
"0.6920044",
"0.69116527",
"0.6907297",
"0.6903982",
"0.6889989",
"0.6880894",
"0.68711925",
"0.6852713",
"0.68315697",
"0.68302864",
"0.68285227",
"0.68220717",
"0.6819676",
"0.6808189",
"0.67916673",
"0.678832",
"0.67851156",
"0.6750148",
"0.6737865",
"0.6725011",
"0.671648",
"0.6706029",
"0.67034036",
"0.67034036",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405",
"0.66981405"
] | 0.0 | -1 |
POST /orders POST /orders.json | def create
@products = Product.all
order_products = []
@products.each do |p|
sym = "product_#{p.id}".to_sym
if params[sym].present?
count = params[sym].to_i
if count > 0
order_product = OrderProduct.new(product: p, count: count)
order_products << order_product
end
end
end
if order_products.size > 0
order = Order.new(user: current_user)
order.save!
order_products.each do |i|
i.order = order
i.save!
end
redirect_to order_path(order.id)
else
redirect_to new_order_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orders\n authenticated_post(\"orders\").body\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def create\n order = Order.create(order_params)\n render json: order\nend",
"def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend",
"def create\n @order = Order.new(order_params)\n if @order.save\n render json: { status: 'SUCCESS', data: @order }\n else\n render json: { status: 'ERROR', data: @order.errors }\n end\n end",
"def create_order(order_params)\n res = request('post', \"https://#{orders_path}\", order_params)\n parse_response res\n end",
"def create\n @order = @orders.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: \"Order was successfully created.\" }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :notice=>\"Order was successfully created.\" }\n format.json { render :json=>@order, :status=>:created, :location=>@order }\n else\n format.html { render :action=>\"new\" }\n format.json { render :json=>@order.errors, :status=>:unprocessable_entry }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :notice => 'Order was successfully created.' }\n format.json { render :json => @order, :status => :created, :location => @order }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_order(options)\n request :account, :post, 'order', options\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: t('app.orders.create.success') }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @order = Order.new() \n total = 0\n \n @order = Order.new()\n for product in params[:_json]\n \n if (product[:quantity].nil? || product[:quantity].to_f < 1 || !isint(product[:quantity]))\n # Handle case when order invalid quantity\n render json: \"\", status: :bad_request\n return\n end\n\n @product = Product.find_by_name_and_size_id(product[:product], product[:size]) \n if @product.nil?\n # Handle case when order invalid products\n render json: \"\", status: :not_found\n return\n end \n total = total + @product.price * product[:quantity].to_f \n @order.orders_products << OrdersProduct.new(:product => @product, :hot => product[:hot], :quantity => product[:quantity]) \n end \n\n @order.total = total\n\n if @order.save\n render json: @order, status: :created, location: @order\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def validate_order() \n\tputs \"Validating order\" \n\tdata = create_order()\n\tresponse = request_post(\"/api/order/validate\", data)\n\tputs response.body\nend",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def cow_order\n @order = Order.new\n @order.lines.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def create\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: { order_id: @order.id }, status: :ok }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n order = Order.create(order_params)\n if order.save\n render json: order\n else\n render new\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_orders params\n @orders_hash = JSON.parse(params)\n\n @orders_hash['orders'].each do |order|\n add_order(order[\"origin\"],order[\"destination\"],order[\"size\"])\n end\n true\n end",
"def create\n @power_order = PowerOrder.new(power_order_params)\n @power_order.save\n render json: @power_order\n end",
"def create\n @order = current_owner.orders.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to orders_path, notice: 'Order was created successfully' }\n format.json { render :show, status: :created, location: orders_path }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n @order_sales = @order.sales\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, flash: { sucess: 'Order was successfully created.' } }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def phone_order(params)\n path = @version + '/Phone/Order/'\n method = 'POST'\n return request(path, method, params)\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @v1_order = V1::Order.new(v1_order_params)\n\n if @v1_order.save\n render json: @v1_order, status: :OK, location: @v1_order\n else\n render json: @v1_order.errors, status: :unprocessable_entity\n end\n end",
"def create_test_order(options)\n request :account, :post, 'order/test', options\n end",
"def create\n @order = Order.new(params[:order])\n @order.user_id = current_user.user_id\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to order_url(@order), notice: I18n.t('orders.successfully_created') }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = current_user.orders.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n @order.submitted_by_id = current_user.id\n respond_to do |format|\n if @order.save\n format.html { redirect_to orders_url, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order, @errors = Order.create_from_cart(@cart, order_params)\n\n if @order\n render json: @order, status: :created, location: @order\n else\n render json: @errors, status: :unprocessable_entity\n end\n end",
"def create\n @admin_order = Order.new(params[:admin_order])\n\n respond_to do |format|\n if @admin_order.save\n format.html { redirect_to @admin_order, notice: 'Order was successfully created.' }\n format.json { render json: @admin_order, status: :created, location: @admin_order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_order(order)\n # response = post(\n # 'peatio/market/orders',\n # {\n # market: order.market.downcase,\n # side: order.side.to_s,\n # volume: order.amount,\n # price: order.price\n # }\n # )\n\n return if order.amount < 1e-8\n od = build_order(order)\n return if od.nil?\n\n# Arke::Log.debug \"Skip order creation #{od.to_json}\\n#{order.inspect}\"\n Ordering.new(od).submit\n @open_orders.add_order(order, od.id) if od.id\n Arke::Log.debug \"Order created #{od.to_json}\"\n\n # @open_orders.add_order(order, response.env.body['id']) if response.env.status == 201 && response.env.body['id']\n\n # response\n end",
"def create\n @order = Order.new( order_params )\n @order.system_id = Order.set_system_id\n respond_to do |format|\n if @order.save\n set_order_values(@order,params)\n route = 'https://private-3643a-orderlordapi.apiary-mock.com/api/v1/jobs'\n respose = HTTParty.post(route, body: @body, :headers => @headers)\n parsed_response = respose.parsed_response.symbolize_keys!\n if \tparsed_response[:success] == \"true\"\n @order.tracker_hash = parsed_response[:tracker_hash]\n @order.save!\n end\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if order.save\n format.html { redirect_to order, notice: 'Order was successfully created.' }\n format.json { render json: order, status: ':created', location: order }\n else\n format.html { render action: 'new' }\n format.json { render json: order.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def create\n # 前端傳回的資料,呼叫 order_params 過濾前端傳回來的資料,用 new 創出一個 Order 的物件 (此時還是 ruby 物件喔)\n @order = Order.new(order_params)\n\n respond_to do |format|\n # save 是指把該筆 物件裡的資料存入資料庫內\n if @order.save\n # 若儲存成功,就導回該筆資料的 show 頁面\n format.html { redirect_to order_path(@order), notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n # 若儲存失敗,就導回新增的頁面重新填寫資料\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n items = params[:items]\n filtered_items = []\n items.each do |item|\n item[:quantity].times do |order|\n filtered_items << {\"apiKey\" => item[:item_api], \"customizationChoices\" => [], \"comments\" => item[:instruction]}\n end\n end\n token = ENV[\"REACT_APP_EAT_STREET_TOKEN\"]\n uri = URI.parse(\"https://api.eatstreet.com/publicapi/v1/send-order\")\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"X-Access-Token\"] = token\n request.body = JSON.dump({\n \"restaurantApiKey\" => processing_params[:restaurant_api_key],\n \"items\" => filtered_items,\n \"method\" => \"delivery\",\n \"payment\" => \"cash\",\n \"test\" => false,\n \"comments\" => processing_params[:comments],\n \"card\" => {\n \"apiKey\" => nil\n },\n \"address\" => {\n \"apiKey\" => nil,\n \"streetAddress\" => processing_params[:address],\n \"latitude\" => processing_params[:latitude],\n \"longitude\" => processing_params[:longitude]\n },\n \"recipient\" => {\n \"apiKey\" => nil,\n \"firstName\" => processing_params[:username],\n \"lastName\" => processing_params[:username],\n \"phone\" => processing_params[:phone],\n 'email' => processing_params[:email]\n }\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n message = ''\n if response.code == 200\n message = {error: false, details: 'You Order Has Been Processed'}\n items.each do |item|\n order = Order.find(item[:id])\n order.ordered = true\n end\n\n else\n message = response.body\n end\n\n render json: message\n end",
"def write_order(order, request_body = nil)\n path = \"/checkout/orders\"\n path += \"/#{order.id}\" if order.id\n\n request_body ||= order.to_json\n response = https_connection.post do |req|\n req.url path\n\n req.headers['Authorization'] = \"Klarna #{sign_payload(request_body)}\"\n req.headers['Accept'] = 'application/vnd.klarna.checkout.aggregated-order-v2+json',\n req.headers['Content-Type'] = 'application/vnd.klarna.checkout.aggregated-order-v2+json'\n req.headers['Accept-Encoding'] = ''\n\n req.body = request_body\n end\n handle_status_code(response.status, response.body)\n response\n end",
"def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n @order.order_create\n format.html { redirect_to @order, notice: 'Замовлення успішно створено.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to orders_url, notice: 'Dati commessa caricati.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_order(order)\n build_persisted_order(\n post('/market/orders', order.symbolize_keys.merge(side: SIDES_MAP.fetch(order.fetch(:side))))\n )\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to home_path, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{order_params['email'].to_s}\")\n codeCustomer = res.code\n dataCustomer = res.parsed_response\n p res\n res = HTTParty.get(\"http://localhost:8082/items/#{order_params['itemid'].to_s}.json\")\n #res = HTTParty.get(\"http://localhost:8082/items/#{order_params['itemid'].to_s}.json\")\n codeItem = res.code\n dataItem = res.parsed_response\n p dataItem\n if codeCustomer != 404 && codeItem != 404\n newParams = order_params\n newParams[\"award\"] = dataCustomer[\"award\"] \n newParams[\"price\"] = dataItem[\"price\"]\n newParams[\"total\"] = dataItem[\"price\"] - dataCustomer[\"award\"]\n p newParams\n \n #HTTParty.put(\"http://localhost:8081/customers/order?award=#{newParams['award']}&total=#{newParams[\"total\"]}&customerId=#{newParams['customerid']}\")\n end\n if codeCustomer == 404 || codeItem == 404\n if codeCustomer == 404 and codeItem == 404\n render json: {error: \"Customer and Item do not exist\"}, status: 400\n return\n end\n if codeCustomer == 404 and codeItem != 404\n render json: {error: \"Customer does not exist\"}, status: 400\n return\n end\n if codeCustomer != 404 and codeItem == 404\n render json: {error: \"Item does not exist\"}, status: 400\n return\n end\n else\n @order = Order.new\n @order.customerid = dataCustomer[\"id\"]\n @order.email = dataCustomer[\"email\"]\n @order.itemid = order_params[:itemid]\n @order.description = dataItem[\"description\"]\n @order.award = newParams[\"award\"]\n @order.total = newParams[\"total\"]\n @order.price = newParams[\"price\"]\n \n orderResult = HTTParty.put('http://localhost:8081/customers/order', \n :body => @order.to_json,\n :headers => {'Content-Type' => 'application/json', 'ACCEPT' => 'application/json'}\n )\n\n res = HTTParty.put(\"http://localhost:8082/items/#{order_params[:itemid]}?stockQty=#{dataItem['stockQty']-1}&description=#{dataItem['description']}&price=#{dataItem['price']}&id=#{order_params[:id]}\")\n p res\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n \n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n end",
"def create\n @order = Order.new(order_params)\n @order.user_id = current_user.id\n @order.uuid = SecureRandom.hex(8)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render 'show', status: :created, location: @order }\n else\n format.html { render 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Create the order \n @order = Order.new\n @email = params[:email]\n \n # Invoke the customer service to retrieve the customer id using the customers\n customerCode, customer = Customer_Service.getCustomerByEmail(@email)\n \n # Check to make sure the customer can be found\n if customerCode != 200\n render json: { error: \"Customer could not be found. \", status: 400 }\n return\n end\n \n # Invoke the item service to retrieve the item information\n orderCode, item = Item_Service.getItemById(params[:itemId])\n # Check to see if the item can be found\n if orderCode != 200\n render json: { error: \"Item could not be found\", status: 400 }\n return\n end\n # Check to see if the item is in stock\n if item[:stockQty] <= 0\n render json: { error: \"Item is out of stock\", status: 400 }\n return\n end\n \n \n # Construct the object\n @order.itemId = params[:itemId]\n @order.description = item[:description]\n @order.customerId = customer[:id]\n @order.price = item[:price]\n @order.award = customer[:award]\n @order.total = @order.price - @order.award\n \n # Check to see if the order can be saved\n if @order.save\n # Save the order to the customer and save it to the item\n tempCode = Customer_Service.postOrder(@order)\n tempCode = Item_Service.postOrder(@order)\n render json: @order, status: 201\n else\n render json: @order.errors, status: 400\n end\n \n end",
"def new\n @path = '/orders'\n @method = 'post'\n @order = Order.new\n @bundles = Bundle.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n persist_order_address\n format.html { redirect_to [:admin, @order], notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: \"Don't think you're going to be there when we deliver? Leave cash in an envelope outside your door. Otherwise, we'll see you in person!\" }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@order = Order.new(order_params)\n\t\t@order.user_id = current_user.id\n\t\t@order.order_date = Time.now\n\t\t@order.status = 1\n\n\t\trespond_to do |format|\n\t\t\tif @order.save\n\t\t\t\tformat.html { redirect_to @order, notice: 'Order was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @order }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @order.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to root_path, notice: 'Order berhasil, tunggu untuk konfirmasi selanjutnya' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n\n @basket = ActiveSupport::JSON.decode(cookies[\"basket\"])\n p @basket\n @basket.each do |order_position|\n @order_detail = OrderDetail.create!(order: @order, product_id: order_position[0], qty: order_position[1])\n end\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@admin_order = Admin::Order.new(order_params)\n\n\t\trespond_to do |format|\n\t\t\tif @admin_order.save\n\t\t\t\tif params[:order_update].present?\n\t\t\t\t\tformat.html { redirect_to edit_admin_order_path(@admin_order), notice: 'Pedido criado com sucesso.'}\n\t\t\t\telse\n\t\t\t\t\tformat.html { redirect_to @admin_order, notice: 'Pedido criado com sucesso.' }\n\t\t\t\t\tformat.json { render json: @admin_order, status: :created, location: @admin_order }\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @admin_order.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def new_order(params)\n camelcase_params!(params)\n call_api('NewOrder', params)\n end",
"def create\n @order = Order.new JSON.parse request.body.read\n\n respond_to do |format|\n rescue_connection_failure do\n if @order.save\n format.html { redirect_to @order, notice: 'ORder was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def create\n @order = Order.new :user_id => params[:user_id], :order_list => params[:order_list], :table_number => params[:table_number], :paid => params[:paid], :fb_user => params[:fb_user], :business_name => params[:business_name]\n @order.order_list = []\n @order.paid = false\n\n success_msg = {\n \"messages\": [\n {\"text\": \"Your order was created.\"},\n {\"text\": \"Thank you.\"}\n ]\n }\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :json => success_msg }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity, response: request.body.read }\n end\n end\n end",
"def create\n @order = current_user.orders.build(order_params)\n\n respond_to do |format|\n if @order.save_with_items(current_user)\n format.json { render json: @order, status: :created }\n format.html { redirect_to @order }\n else\n format.html do\n set_feed_back\n set_addresses_add_express_fee\n\n set_wx_cards\n\n flash.now[:error] = @order.errors.full_messages.join(', ')\n\n render :confirmation, status: :unprocessable_entity\n end\n\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n @order.status = \"Pending\"\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def order_post(order, api_key, opts = {})\n data, _status_code, _headers = order_post_with_http_info(order, api_key, opts)\n return data\n end",
"def index\n @orders = Order.all\n render json: @orders, status: 200\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Provider was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \tredirect_to orders_url\n# @order = Order.new(params[:order])\n\n# respond_to do |format|\n# if @order.save\n# format.html { redirect_to @order, notice: 'Order was successfully created.' }\n# format.json { render json: @order, status: :created, location: @order }\n# else\n# format.html { render action: \"new\" }\n# format.json { render json: @order.errors, status: :unprocessable_entity }\n# end\n# end\n end",
"def create\n @title = t 'view.orders.new_title'\n @order = current_customer.orders.build(params[:order])\n session[:documents_to_order].try(:clear)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: t('view.orders.correctly_created') }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n @order.user = current_user\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def create\n @order = Order.new(tl_params)\n\n if @order.save\n if params[:product]\n \t@order.create_order(params[:product])\n end\n render json: @order, status: :created\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def create\n fail = false\n itemId = order_params[:itemId]\n customerId = order_params[:customerId]\n \n #logger.debug \"getting item\"\n self.class.base_uri \"http://localhost:8082\"\n uri = \"/items/%d\" % [itemId]\n response = self.class.get uri\n \n #Check if item of this id was fetched correctly\n if response.code == 200\n item = response.body\n else\n fail = true\n end\n #logger.debug item\n\n #logger.debug \"getting customer\"\n self.class.base_uri \"http://localhost:8081\"\n uri = \"/customers?id=%d\" % [customerId]\n response = self.class.get uri\n \n\n #Check if customer of this id was fetched correctly\n if response.code == 200\n customer = response.body\n else\n fail = true\n end\n #logger.debug customer\n \n #If item and customer are found, create the order, otherwise, give a 404 not found error\n if !fail\n #logger.debug \"success\"\n item = JSON.parse(item)\n description = item[\"description\"]\n \n price = item[\"price\"].to_f #to float, as it's parsed as a string for some reason\n logger.debug price\n customer = JSON.parse(customer)\n \n award = customer[\"award\"]\n total = price - award\n \n @order = Order.new({itemId: itemId, customerId: customerId, description: description, price: price, award: award, total: total})\n if @order.save\n render json: @order, status: 201\n \n # #raise ActiveRecord::Rollback, \"Rolling back changes\"\n else\n render json: @order.errors.messages, status: 400\n end\n else\n head 404\n end\n\n end",
"def create\n @order = Order.new(order_params)\n \n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :print => 'true' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @orders = Order.all\n @order = Order.create(order_params)\n\n=begin\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n redirect_to :action => :index\n else\n render :action => :new\n end\n end\n end",
"def perform\n Magento2::Api.configure('dz4xnhhgfsfuyj00g6bkel0jq6mwdak2', 'hhjnlf59qh2m7an9sdpfcu0o9nox78y6', 'ie5iafduhqs1dydynidsjki582oti17w', 'mva5hldj17elic6muxmf53fq7zmm7xl5', \"https://mall2door.net\")\n orders = Magento2::Api.get(\"/rest/en/V1/orders\", {searchCriteria: 'all' })\n all_orders = orders[:items]\n all_orders.each do |order|\n unless order[:status].present?\n order_id = order[:increment_id]\n id = order[:entity_id]\n status = order[:state]\n params = {\n entity_id: id,\n increment_id: order_id,\n status: status,\n }\n if status\n Magento2::Api.put(\"/rest/en/V1/orders/create\", {entity: params})\n end\n end\n end\n end",
"def make_api_call_for_order_creation(url, api_params, access_token)\n RestClient.post(url, api_params, Authorization: \"Bearer #{access_token}\", content_type: :json)\n end",
"def create\n @ordered = Ordered.new(ordered_params)\n\n respond_to do |format|\n if @ordered.save\n format.html { redirect_to @ordered, notice: 'Ordered was successfully created.' }\n format.json { render :show, status: :created, location: @ordered }\n else\n format.html { render :new }\n format.json { render json: @ordered.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n @order.user_id = session[:user_id]\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sales_order = SalesOrder.new(sales_order_params)\n @sales_order.date = Time.now\n sodetails = @sales_order.sales_order_details\n sodetails.each do |sod|\n sod.pending_rg = sod.quantity\n sod.pending_cg = sod.quantity\n sod.pending_inv = sod.quantity\n end\n \n respond_to do |format|\n if @sales_order.save\n format.html {\n flash[:notice] = 'La Orden de Venta se creó satisfactoriamente.'\n redirect_to sales_orders_path\n }\n format.json { render :show, status: :created, location: @sales_order }\n else\n format.html { \n flash[:error] = @sales_order.errors\n redirect_to new_sales_order_path\n }\n format.json { render json: @sales_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t @order = Order.new\n\t code, customer = Customer.getCustomer(params[:email])\n\t \n\t if code != 200\n\t\t render json: { error: \"Customer email not found. #{params[:email]}\" }, status: 400\n\t\t return\n\t end\n\t \n\t code, item = Item.getItemById(params[:itemId])\n\t if code != 200\n\t\t render json: { error: \"Item id not found. #{params[:itemId]}\" }, status: 400\n\t\t return\n\t end\n\t \n\t if item[:stockQty] <= 0\n\t\t render json: { error: \"Item is out of stock.\"}, status: 400\n\t\t return\n\t end\n\t \n\t @order.itemId = item[:id]\n\t @order.description = item[:description]\n\t @order.customerId = customer[:id]\n\t @order.price = item[:price]\n\t @order.award = customer[:award]\n\t @order.total = @order.price - @order.award\n\t \n\t if @order.save\n \t\t# put order to customer and item subsystem to do their updates\n\t\t code = Customer.putOrder(@order)\n\t\t code = Item.putOrder(@order)\n\t\t render json: @order, status: 201\n\t else\n \t\trender json: @order.errors, status: 400\n \tend\n end",
"def order_params\n params.require(:order).permit(:date, :obs, :client_id)\n end",
"def create\n if params[:order][:id]\n build do\n message 'Повторый заказ'\n order Order.create_order_from_order(params[:order][:id])\n view 'consumer/orders/show'\n end\n elsif Order.create_orders_from_cart(params[:cart_id], current_user)\n build do\n message 'Создание заказов'\n view 'consumer/orders/create'\n end\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n UserMailer.order_email(@order).deliver\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @orders = Order.all\n render json: { status: 'SUCCESS', message: 'Loaded posts', data: @orders }\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'La commande a été créée avec succès.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.75886714",
"0.7490972",
"0.7488501",
"0.74664384",
"0.72739846",
"0.7195349",
"0.7063682",
"0.69745994",
"0.6910657",
"0.68880194",
"0.68747663",
"0.685004",
"0.6840204",
"0.6838178",
"0.6838178",
"0.6838178",
"0.6838178",
"0.682244",
"0.6790037",
"0.67793274",
"0.6779247",
"0.67782325",
"0.6771919",
"0.6771919",
"0.67691034",
"0.6754747",
"0.6754747",
"0.6754747",
"0.6754747",
"0.6754747",
"0.6754747",
"0.6754747",
"0.6754747",
"0.6754747",
"0.6754747",
"0.6754747",
"0.6750308",
"0.6741648",
"0.6727289",
"0.67202854",
"0.67192626",
"0.67174095",
"0.66730356",
"0.66511375",
"0.66424936",
"0.66256195",
"0.66148645",
"0.65905017",
"0.6581552",
"0.6574477",
"0.65712935",
"0.65698874",
"0.6569679",
"0.65657544",
"0.656543",
"0.6562849",
"0.6553006",
"0.65528905",
"0.65511286",
"0.65461224",
"0.6544374",
"0.65240365",
"0.65232676",
"0.6502522",
"0.64868236",
"0.6485337",
"0.6483515",
"0.64801395",
"0.6467508",
"0.6463724",
"0.6455904",
"0.64464027",
"0.6438949",
"0.64251065",
"0.6424166",
"0.6408214",
"0.64042836",
"0.6403627",
"0.63958675",
"0.639366",
"0.63919747",
"0.6391734",
"0.6390046",
"0.63786453",
"0.6368862",
"0.63676715",
"0.63499165",
"0.6326805",
"0.6325994",
"0.6319851",
"0.63150823",
"0.6309701",
"0.6297522",
"0.62932307",
"0.6284583",
"0.62811166",
"0.6266786",
"0.6266663",
"0.62406427",
"0.6232846",
"0.6231927"
] | 0.0 | -1 |
DELETE /orders/1 DELETE /orders/1.json | def destroy
Order.where(id: params[:id], user: current_user).first.destroy!
redirect_to action: 'index'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end",
"def destroy\n @order1 = Order1.find(params[:id])\n @order1.destroy\n\n respond_to do |format|\n format.html { redirect_to order1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_item.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def destroy\n #@order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n render json: {success: true, status: :ok} \n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: t('orders.deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @allorder.destroy\n respond_to do |format|\n format.html { redirect_to allorders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to farm_orders_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order1.destroy\n respond_to do |format|\n format.html { redirect_to order1s_url, notice: 'Order1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url, notice: I18n.t('orders.successfully_deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n head :no_content\n end",
"def destroy\n @order = Order.get!(params[:id])\n @order.destroy if @order\n\n respond_to do |format|\n format.html { redirect_to(orders_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Замовлення скасовано.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @updateallorder.destroy\n respond_to do |format|\n format.html { redirect_to updateallorders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @order_line = OrderLine.find(params[:id])\n @order_line.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to api_orders_url, notice: \"Order was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to circle_orders_path, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'La transacción se ha eliminado con exito' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to(orders_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to(orders_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.75915873",
"0.7474085",
"0.7430466",
"0.73727256",
"0.73726606",
"0.73718613",
"0.73583674",
"0.73583674",
"0.73583674",
"0.73583674",
"0.73583674",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.734848",
"0.7348152",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.731227",
"0.7293748",
"0.72833794",
"0.7281109",
"0.7238469",
"0.7228825",
"0.7190349",
"0.7185685",
"0.71509385",
"0.7150568",
"0.7146138",
"0.71319234",
"0.7113484",
"0.71025765",
"0.7094033",
"0.7083263",
"0.7077533",
"0.7077307",
"0.7073675",
"0.70622516",
"0.70622516",
"0.70610887",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775",
"0.7060775"
] | 0.0 | -1 |
GET /articles or /articles.json | def index
@article = Article.includes(:user).order('created_at DESC')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end",
"def article(id, params = {})\n get \"articles/#{id}\", {query: params}\n end",
"def GetArticles params = {}\n\n params = params.merge(path: 'help_center/articles.json')\n APICall(params)\n\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.json { render json: @articles }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n @articles = Article.all\n raise if @articles.blank?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @article }\n end\n end",
"def show\n @article = article_get!(params[:id])\n respond_with(@article)\n end",
"def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n respond_to do |format|\n format.html { render }\n format.json { render_json_responsibly(@article) }\n end\n end",
"def index\n @articles = current_user.articles\n json_response(@articles)\n end",
"def index\n @articles = Article.all.sort_by(&:url)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get(\"articles/#{id}\",options)\n response.article\n end",
"def show\n @article = Article.published.find_by_id_or_permalink(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n # GET /articles\n @articles = Article.all\n end",
"def index\n @articles = article_all\n respond_with(@articles)\n end",
"def show\n @article = Article.find(params[:id])\n if @article==nil\n redirect_to articles_url\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end\n end",
"def show\n @article = Article.where(id: params[:id]).last\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n @articles = Article.all\n respond_with @articles, status: get_status\n end",
"def index\n @articles = Article.order('id DESC')\n respond_to do |format|\n format.html\n format.json { render json: @articles }\n end\n end",
"def get_articles\n @articles = ActiveSupport::JSON.decode(access_token.get('/articles.json'))\n end",
"def index\n @menu = \"articles\"\n @num_articles = num_articles\n @page_number = 1\n begin\n @page_number = params[:page].to_i unless params[:page].blank?\n last_page = (@num_articles / Ufo::MAX_PAGE_ITEMS) + 1\n if @page_number <= 0\n @page_number = 1\n elsif @page_number > last_page\n @page_number = last_page\n end\n rescue\n logger.error \"Page number not valid!\"\n end\n @articles = Rails.cache.fetch(\"articles/index/#{@page_number}\", :expires_in => 1.week) do\n Article.where(:status => 1).without(:article_helper_method, :article_type, :date_filter, :email, :partial_1).desc(:published_date).skip((@page_number-1) * Ufo::MAX_PAGE_ITEMS).limit(Ufo::MAX_PAGE_ITEMS).entries\n end\n @page_title = \"Articles\"\n @page_description = \"Latest Articles\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def call\n articles = JSON.parse(Base64.urlsafe_decode64(@params['articles']))\n Success(articles)\n rescue StandardError\n Failure(Value::Result.new(status: :bad_request, message: 'Article list not found'))\n end",
"def index\n @response = HTTParty.get(\"http://newsapi.org/v2/top-headlines?category=sports&q=golf&apiKey=12e692d8e7254efa8cf6276ea99736b0\")\n @report = JSON.parse(@response.body)\n @article = @report[\"articles\"]\n end",
"def show\n respond_with @articles, status: get_status\n end",
"def index # uses paginate\n @articles = Article.paginate page: params[:page], per_page: 10\n #@articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n @article = Article.find(params[:id])\n respond_with(@article)\n end",
"def index\n @articles = Article.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end",
"def show\n return render :status => 404, :text => \"Not found\" unless @article\n @title = @article.title\n to = {:lang => I18n.default_locale}\n if @article.category =~ /(conference|contacts|sponsors|reports)/\n to.merge!(:category => @article.category, :name => @article.name)\n @canonical_url = article_by_name_url(to)\n @canonical_path = article_by_name_path(to)\n else\n to.merge!(:id => @article.id)\n @canonical_url = article_url(to)\n @canonical_path = article_path(to)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @clothing_article = ClothingArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clothing_article }\n end\n end",
"def index\n if params.include?(:name)\n @owner = Owner.find_by_name(params[:name])\n @articles = @owner.articles\n else\n @owner = nil\n @articles = Article.includes(:owner).all\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render_json_responsibly(articles: @articles) }\n end\n end",
"def show\n @article_datum = ArticleDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article_datum }\n end\n end",
"def show\n @article = Article.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @pages_article = PagesArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pages_article }\n end\n end",
"def list\n if params[:search]\n articles = Article.where(status: \"accepted\")\n .where('lower(title) LIKE ?', \"%#{params[:search].downcase}%\")\n .paginate(page: params[:page], per_page: params[:limit] || 10)\n else\n articles = Article.where(status: \"accepted\")\n .paginate(page: params[:page], per_page: params[:limit] || 10)\n end\n render json: articles, \n only: [ :id, :title, :created_at, :tags ], \n methods: [ :pictures, :created_by ], \n status: :ok\n end",
"def index\n#\t\t@search = Article.search(params[:search])\n#\t\t@articles = @search.paginate(:page => params[:page], :per_page => 15)\n @articles = Article.all\n respond_with(@articles)\n end",
"def articles(page = 'hot', options = {})\n get_resources(\"#{@url}#{page}\", options) do |resource_json|\n Article.new(resource_json['data'])\n end\n end",
"def index\n @articles = Article.order('published_at DESC').page(params[:page]).per(5)\n\n respond_to do |format|\n format.html { render :layout => false if request.xhr? }\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.page(params[:page]).order(:pub_date,:source,:headline)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n @feed = Feed.find(params[:feed_id])\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n authorize! :admin, :dashboard\n @articles = Article.internal.paginate(\n :per_page => 20,\n :page => params[:page],\n :order => 'created_at DESC'\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @articles }\n end\n end",
"def index\n @articles = Article.order(\"created_at DESC\").paginate(:page=>params[:page],:per_page=>40)\n\n respond_to do |format|\n format.html # index.html.erb\n# format.json { render json: @articles }\n end\n end",
"def show\n @admin_article = Admin::Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_article }\n end\n end",
"def GetArticle id\n\n APICall(path: \"help_center/articles/#{id}.json\")\n\n end",
"def index\n @articles = Article.published\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end",
"def show\n respond_with article\n end",
"def show\n @user_article = UserArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_article }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @article, methods: [:image_url] }\n end\n end",
"def index\n #remove_cache #if params[:page]\n #@articles = #Article.where(:is_published => true)\n @articles = Article.published.paginated(params[:page], 10)\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n begin\n article = Article.joins(:article_text).select(\"text, title\").find(params[:id])\n if article.text.nil?\n render :json => {title: article.title, text: MESSAGE}.to_json\n else\n render :json => article\n end\n rescue\n render :json => {title: \"\", text: MESSAGE}.to_json\n end\n end",
"def show\n @article = Article.published.find(params[:id])\n\n @open_graph = @article.open_graph\n @twitter_card = @article.twitter_card\n\n if request.path != article_path(@article)\n redirect_to @article, status: :moved_permanently\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @menu = \"articles\"\n @article = Rails.cache.fetch(\"articles/#{params[:id]}\", :expires_in => 1.month) do\n Article.without(:email).find(params[:id])\n end\n @page_title = ArticlesHelper.friendly_title(@article)\n @page_description = @article.teaser[0..200] + \"...\"\n\n unless @article.article_helper_method.blank?\n if ArticlesHelper.respond_to? @article.article_helper_method.to_sym\n @ufo_list = ArticlesHelper.send @article.article_helper_method.to_sym, @article\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n\n end",
"def index\n @articles = Article.truth\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end",
"def service_knowledge_base_articles_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: KnowledgeBaseArticlesApi.service_knowledge_base_articles_get ...\"\n end\n # resource path\n local_var_path = \"/service/knowledgeBaseArticles\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'conditions'] = opts[:'conditions'] if !opts[:'conditions'].nil?\n query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].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 = []\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 = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<KnowledgeBaseArticle>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KnowledgeBaseArticlesApi#service_knowledge_base_articles_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @news = News.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @news }\n end\n end",
"def show\n @news = News.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @news }\n end\n end",
"def show\n @news = News.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @news }\n end\n end",
"def show\n @news = News.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @news }\n end\n end",
"def show\n @article = Article.find(params[:id])\n @title = @article.title\n respond_with(@article)\n end",
"def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @article.to_xml }\n end\n end",
"def index\n @articles = if user_can_chive? && !params.key?(:public)\n Article.latest\n else\n Article.latest_published\n end.paginate(page: params[:page], per_page: Chive.per_page)\n end",
"def show\n # Find news from the DB\n @news = News.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @news }\n end\n end",
"def show\n @articles = Article.all\n end",
"def show\n @article = Article.find(params[:id])\n\t\t@categories = Category.all\n\t\t@message = Message.new\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @article }\n end\n end",
"def index\n @tourism_articles = @tourism_articles.published.recent.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tourism_articles }\n end\n end",
"def show\n @kind=params[:k] || 'news'\n @locale=params[:locale] || 'zh_CN'\n @article = Article.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def index #this is our index action which will display all articles. the view for this page will have links to corresponding articles, which will be shown via the show path\n\t\t@articles = Article.all #we want to get all the articles, y'all\n\tend",
"def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @articleaddressee = Articleaddressee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articleaddressee }\n end\n end",
"def index\n @articles = Article.translated\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end"
] | [
"0.7225488",
"0.72081155",
"0.70706594",
"0.70543015",
"0.70543015",
"0.70543015",
"0.70543015",
"0.70543015",
"0.70543015",
"0.7025084",
"0.7021429",
"0.6986294",
"0.6986294",
"0.6986294",
"0.6986294",
"0.6986294",
"0.6986294",
"0.6986294",
"0.6986294",
"0.6986294",
"0.6986294",
"0.6986294",
"0.6986294",
"0.6986294",
"0.6986294",
"0.697113",
"0.6953563",
"0.6949233",
"0.6907127",
"0.6891321",
"0.6849116",
"0.68441015",
"0.6842419",
"0.6822251",
"0.68092984",
"0.6775349",
"0.6674919",
"0.6674552",
"0.6612784",
"0.65952367",
"0.65939873",
"0.6589973",
"0.65657294",
"0.65547603",
"0.6536726",
"0.6520964",
"0.6505365",
"0.6480866",
"0.64640296",
"0.6463356",
"0.64598125",
"0.6428841",
"0.6427852",
"0.6423996",
"0.64129543",
"0.6406518",
"0.64016885",
"0.6388741",
"0.63860285",
"0.63744295",
"0.6353542",
"0.63387734",
"0.63342905",
"0.6330556",
"0.6326401",
"0.63024795",
"0.6297055",
"0.628735",
"0.6274942",
"0.62722695",
"0.62656486",
"0.6243901",
"0.6242449",
"0.62168115",
"0.6211378",
"0.6177282",
"0.6177282",
"0.6177282",
"0.6177282",
"0.6177282",
"0.6177282",
"0.6177282",
"0.6177282",
"0.6133843",
"0.6133843",
"0.6133843",
"0.6133843",
"0.6131821",
"0.611652",
"0.6106632",
"0.610634",
"0.61019415",
"0.6100861",
"0.60891503",
"0.6088138",
"0.6073495",
"0.60693777",
"0.60693777",
"0.60693777",
"0.6065705",
"0.6057148"
] | 0.0 | -1 |
GET /articles/1 or /articles/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end",
"def article(id, params = {})\n get \"articles/#{id}\", {query: params}\n end",
"def article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get(\"articles/#{id}\",options)\n response.article\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.where(id: params[:id]).last\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = article_get!(params[:id])\n respond_with(@article)\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @article }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.published.find_by_id_or_permalink(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n @articles = Article.all\n raise if @articles.blank?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n respond_to do |format|\n format.html { render }\n format.json { render_json_responsibly(@article) }\n end\n end",
"def GetArticle id\n\n APICall(path: \"help_center/articles/#{id}.json\")\n\n end",
"def index\n @articles = Article.order('id DESC')\n respond_to do |format|\n format.html\n format.json { render json: @articles }\n end\n end",
"def GetArticles params = {}\n\n params = params.merge(path: 'help_center/articles.json')\n APICall(params)\n\n end",
"def index\n @articles = Article.all.sort_by(&:url)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @menu = \"articles\"\n @num_articles = num_articles\n @page_number = 1\n begin\n @page_number = params[:page].to_i unless params[:page].blank?\n last_page = (@num_articles / Ufo::MAX_PAGE_ITEMS) + 1\n if @page_number <= 0\n @page_number = 1\n elsif @page_number > last_page\n @page_number = last_page\n end\n rescue\n logger.error \"Page number not valid!\"\n end\n @articles = Rails.cache.fetch(\"articles/index/#{@page_number}\", :expires_in => 1.week) do\n Article.where(:status => 1).without(:article_helper_method, :article_type, :date_filter, :email, :partial_1).desc(:published_date).skip((@page_number-1) * Ufo::MAX_PAGE_ITEMS).limit(Ufo::MAX_PAGE_ITEMS).entries\n end\n @page_title = \"Articles\"\n @page_description = \"Latest Articles\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = current_user.articles\n json_response(@articles)\n end",
"def index\n @response = HTTParty.get(\"http://newsapi.org/v2/top-headlines?category=sports&q=golf&apiKey=12e692d8e7254efa8cf6276ea99736b0\")\n @report = JSON.parse(@response.body)\n @article = @report[\"articles\"]\n end",
"def show\n @article = Article.find(params[:id])\n if @article==nil\n redirect_to articles_url\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end\n end",
"def index\n @articles = Article.all\n respond_with @articles, status: get_status\n end",
"def index\n @articles = article_all\n respond_with(@articles)\n end",
"def call\n articles = JSON.parse(Base64.urlsafe_decode64(@params['articles']))\n Success(articles)\n rescue StandardError\n Failure(Value::Result.new(status: :bad_request, message: 'Article list not found'))\n end",
"def show\n @article = Article.find(params[:id])\n respond_with(@article)\n end",
"def show\n respond_with @articles, status: get_status\n end",
"def show\n @article_datum = ArticleDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article_datum }\n end\n end",
"def index # uses paginate\n @articles = Article.paginate page: params[:page], per_page: 10\n #@articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n # GET /articles\n @articles = Article.all\n end",
"def index\n @articles = Article.page(params[:page]).order(:pub_date,:source,:headline)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n @clothing_article = ClothingArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clothing_article }\n end\n end",
"def show\n @article = Article.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @admin_article = Admin::Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_article }\n end\n end",
"def show\n @pages_article = PagesArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pages_article }\n end\n end",
"def get_articles\n @articles = ActiveSupport::JSON.decode(access_token.get('/articles.json'))\n end",
"def index\n #remove_cache #if params[:page]\n #@articles = #Article.where(:is_published => true)\n @articles = Article.published.paginated(params[:page], 10)\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end",
"def show\n @feed = Feed.find(params[:feed_id])\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n @title = @article.title\n respond_with(@article)\n end",
"def show\n @article = Article.where(:id => params[:id]).first\n redirect_to articles_path and return unless @article\n\n if @article and params[:v]\n @version = Version.find params[:v]\n @article = @version.reify\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n @articles = Article.order('published_at DESC').page(params[:page]).per(5)\n\n respond_to do |format|\n format.html { render :layout => false if request.xhr? }\n format.json { render json: @articles }\n end\n end",
"def index\n if params.include?(:name)\n @owner = Owner.find_by_name(params[:name])\n @articles = @owner.articles\n else\n @owner = nil\n @articles = Article.includes(:owner).all\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render_json_responsibly(articles: @articles) }\n end\n end",
"def show\n begin\n article = Article.joins(:article_text).select(\"text, title\").find(params[:id])\n if article.text.nil?\n render :json => {title: article.title, text: MESSAGE}.to_json\n else\n render :json => article\n end\n rescue\n render :json => {title: \"\", text: MESSAGE}.to_json\n end\n end",
"def article(cps_id)\n @client.request(:get, \"articles/#{cps_id}\")[\"article\"]\n end",
"def index\n @articles = Article.published\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end",
"def articles(page = 'hot', options = {})\n get_resources(\"#{@url}#{page}\", options) do |resource_json|\n Article.new(resource_json['data'])\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @article, methods: [:image_url] }\n end\n end",
"def index\n @articles = Article.order(\"created_at DESC\").paginate(:page=>params[:page],:per_page=>40)\n\n respond_to do |format|\n format.html # index.html.erb\n# format.json { render json: @articles }\n end\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @user_article = UserArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_article }\n end\n end",
"def list\n if params[:search]\n articles = Article.where(status: \"accepted\")\n .where('lower(title) LIKE ?', \"%#{params[:search].downcase}%\")\n .paginate(page: params[:page], per_page: params[:limit] || 10)\n else\n articles = Article.where(status: \"accepted\")\n .paginate(page: params[:page], per_page: params[:limit] || 10)\n end\n render json: articles, \n only: [ :id, :title, :created_at, :tags ], \n methods: [ :pictures, :created_by ], \n status: :ok\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id]) \n end",
"def show\n return render :status => 404, :text => \"Not found\" unless @article\n @title = @article.title\n to = {:lang => I18n.default_locale}\n if @article.category =~ /(conference|contacts|sponsors|reports)/\n to.merge!(:category => @article.category, :name => @article.name)\n @canonical_url = article_by_name_url(to)\n @canonical_path = article_by_name_path(to)\n else\n to.merge!(:id => @article.id)\n @canonical_url = article_url(to)\n @canonical_path = article_path(to)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def index\n @tourism_articles = @tourism_articles.published.recent.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tourism_articles }\n end\n end",
"def show\n @article = Article.find params[:id]\n end",
"def show\n respond_with article\n end",
"def show\n @menu = \"articles\"\n @article = Rails.cache.fetch(\"articles/#{params[:id]}\", :expires_in => 1.month) do\n Article.without(:email).find(params[:id])\n end\n @page_title = ArticlesHelper.friendly_title(@article)\n @page_description = @article.teaser[0..200] + \"...\"\n\n unless @article.article_helper_method.blank?\n if ArticlesHelper.respond_to? @article.article_helper_method.to_sym\n @ufo_list = ArticlesHelper.send @article.article_helper_method.to_sym, @article\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def show\n @news = News.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @news }\n end\n end",
"def show\n @news = News.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @news }\n end\n end",
"def show\n @news = News.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @news }\n end\n end",
"def show\n @news = News.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @news }\n end\n end"
] | [
"0.72986925",
"0.72947234",
"0.7097804",
"0.704951",
"0.704951",
"0.704951",
"0.704951",
"0.704951",
"0.704951",
"0.704951",
"0.704951",
"0.704951",
"0.704951",
"0.704951",
"0.704951",
"0.704951",
"0.704951",
"0.7026049",
"0.70235556",
"0.70208627",
"0.7020236",
"0.7013127",
"0.7013127",
"0.7013127",
"0.7013127",
"0.7013127",
"0.7013127",
"0.69886625",
"0.6947247",
"0.69414604",
"0.69038486",
"0.6860173",
"0.6840871",
"0.6790114",
"0.6785032",
"0.67463726",
"0.6701368",
"0.669521",
"0.6664575",
"0.6642102",
"0.66138",
"0.6608835",
"0.66077155",
"0.6605605",
"0.6590003",
"0.6588531",
"0.6586048",
"0.65368074",
"0.65311164",
"0.6524265",
"0.6477887",
"0.644836",
"0.64473534",
"0.64455944",
"0.6443455",
"0.64243454",
"0.64021945",
"0.6391532",
"0.63866323",
"0.63777626",
"0.63750285",
"0.6369101",
"0.635685",
"0.6351193",
"0.6328555",
"0.63126284",
"0.63115",
"0.63019353",
"0.6296662",
"0.6296662",
"0.6296662",
"0.6296662",
"0.6296662",
"0.6296662",
"0.6296662",
"0.6296662",
"0.6296662",
"0.6296662",
"0.6296662",
"0.62965757",
"0.62949044",
"0.629277",
"0.62257624",
"0.62235355",
"0.6219784",
"0.6213294",
"0.6213197",
"0.6207634",
"0.6206431",
"0.62003595",
"0.62003595",
"0.62003595",
"0.62003595",
"0.62003595",
"0.62003595",
"0.62003595",
"0.62003595",
"0.6199674",
"0.6199674",
"0.6199674",
"0.6199674"
] | 0.0 | -1 |
POST /articles or /articles.json | def create
@article = Article.new(article_params)
respond_to do |format|
if @article.save
format.html { redirect_to root_path, notice: 'Article was successfully created.' }
format.json { render :index, status: :created, location: @article }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @article.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = article_create(params[:article])\n @article.save\n respond_with(@article)\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to articles_public_url, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:article])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Article was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n \n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html do\n redirect_to @article, notice: 'Article was successfully created.'\n end\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json do\n render json: @article.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: \"Article was successfully created.\" }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t @article = Article.new(article_params)\n\n\t respond_to do |format|\n\t if @article.save\n\t format.html { redirect_to @article, notice: 'article was successfully created.' }\n\t format.json { render :show, status: :created, location: @article }\n\t else\n\t format.html { render :new }\n\t format.json { render json: @article.errors, status: :unprocessable_entity }\n\t end\n\t end\n\tend",
"def create\r\n\t\t\t\t# whitelisting certain fields that we want to enter by passing in article_params\r\n\t\t\t\tarticle = Article.new(article_params)\r\n\r\n\t\t\t\t# check similarities\r\n\t\t\t\tif article.save\r\n\t\t\t\t\t# render a response\t\r\n\t\t\t\t\trender json: {status: 'Success', message:'Save artice', data:article}, status: :ok\r\n\t\t\t\telse\r\n\t\t\t\t\t# unsuccessfully\r\n\t\t\t\t\trender json: {status: 'ERROR', message:'Article not saved', \r\n\t\t\t\t\t\tdata:article.errors}, status: :unprocessable_entity\r\n\t\t\t\tend\t\r\n\t\t\tend",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Dodano artykuł.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n flash[:success] = 'Article was successfully created.';\n format.html { redirect_to dashboard_articles_url }\n format.json { render :article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to [:edit, @article], notice: 'Nouvel article créé.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n article = Article.create params['article']\n if article.invalid?\n render status: 400, inline: extract_first_error_message(article.errors.messages)\n else\n respond_with article\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to action: :index, notice: 'Create Success.' }\n format.json { render action: :index, status: :created }\n else\n format.html { render action: :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.internal.new(params[:article])\n @article.user = current_user\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to admin_articles_path, :notice => t('articles.article_successfully_created') }\n format.json { render :json => @article, :status => :created, :location => @articles }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html do\n redirect_to @article,\n notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.article', count: 1))\n end\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json do\n render json: @article.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def CreateArticle params = {}\n \n APICall(path: 'help_center/articles.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Articulo creado exitosamente' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: \"L'article a ete correctement cree\" }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @article = Article.new(article_params)\n @article.author = current_user\n if @article.save\n render :show, status: :created\n else\n render json: { errors: @article.errors }, status: :unprocessable_entity\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Članek je bil uspešno ustvarjen!' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = current_user.articles.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @article }\n end\n end",
"def create\n @article = current_user.articles.create(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t@article = current_user.articles.new(params[:article]) \n#@article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n\tformat.html{ redirect_to(@article, \"article created successfully\")}\n#\tformat.html { redirect_to(@article, :notice => t('articles.create_success')) }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = current_user.articles.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n flash[:notice] = t('actions.create.success', Article.model_name.human) if @article.save\n respond_with(@article)\n end",
"def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def create\n @article = current_user.articles.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_article = Admin::Article.new(params[:admin_article])\n\n respond_to do |format|\n if @admin_article.save\n format.html { redirect_to @admin_article, notice: 'Article was successfully created.' }\n format.json { render json: @admin_article, status: :created, location: @admin_article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to(@article, :notice => 'Article was successfully created.') }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to(@article, :notice => 'Article was successfully created.') }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to(@article, :notice => 'Article was successfully created.') }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.create(params[:article])\n redirect_to @article\n end",
"def create\n @article = Article.new article_from_parameters\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n end",
"def create\n @article = Article.new(article_params)\n @article.user = current_user\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n response = RestClient.get 'http://scraper:3000/api/get', { params: { url: @article.url } }\n scraped_article = JSON.parse(response.body)\n @article.update({\n :title => scraped_article['title'],\n :byline => scraped_article['byline'],\n :excerpt => scraped_article['excerpt'],\n :content_html => scraped_article['content'],\n :readerable => scraped_article['readerable'],\n :scraped_at => DateTime.now\n })\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n check_admin_or_dziekan\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n# format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n \n respond_to do |format|\n if @article.save\n flash[:notice] = 'Article was successfully created.'\n \n format.html { redirect_to article_url(@article) }\n format.xml do\n headers[\"Location\"] = article_url(@article)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors.to_xml }\n end\n end\n end",
"def create\n @backend_article = Backend::Article.new(article_params)\n\n respond_to do |format|\n if @backend_article.save\n format.html { redirect_to @backend_article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @backend_article }\n else\n format.html { render action: 'new' }\n format.json { render json: @backend_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article_datum = ArticleDatum.new(params[:article_datum])\n\n respond_to do |format|\n if @article_datum.save\n format.html { redirect_to @article_datum, notice: 'Article datum was successfully created.' }\n format.json { render json: @article_datum, status: :created, location: @article_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @article = Article.new(params[:article])\n @article = Article.new(:title => params[:article][:title], :body => params[:article][:body])\n\n @article = Article.new(params[:article])\n\n # @article.title = params[:article][:title]\n # @article.body = params[:article][:body]\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_article\n return unless request.method == \"POST\"\n\n return if flash_missing_title?\n article = Article.new(title: params[:article][:title],\n body: params[:article][:body],\n user_id: @user.id)\n article.save\n redirect_to(action: \"show_article\", id: article.id)\n end",
"def create\n @article = Article.new(article_params)\n\n if @article.save\n redirect_to @article\n # As @article is a Hash, the redirection will be done to the _url (similar to using 'link_to' helper).\n # It is important to use redirect_to after mutating the database or application state. Otherwise,\n # if the user refreshes the page, the browser will make the same request, and the mutation will be repeated.\n else\n render :new # Renders the 'new' view\n end\n end",
"def create\n @article = current_user.articles.build(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: \"Article was successfully created. #{undo_link}\" }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n @article.user = current_user\n respond_to do |format|\n if @article.save\n format.html { redirect_to open_article(@article), notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\n @article = Article.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def create\n @article = Article.new(params[:article])\n\t\tdeny_access_unless(admin? || editor?)\n\t\t\n\t\topts = {}\n\t\topts[:as]=[]\n\t\t\n\t\topts = {}\n\t\topts = { :as => :editor } if editor?\n\t\topts = { :as => :admin } if admin?\n\t\t\n respond_to do |format|\n if @article.save(opts)\n\t\t\t\t@article.update_attributes(params[:article], opts)\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find_by_authentication_token(params[:auth_token])\n @article = Article.new.from_json(params[:article])\n @article.nb_comments = 0\n @article.publication_date = Time.now\n @article.user_id = @user.id\n respond_to do |format|\n if @article.save\n @article.score = Score.create(:score_pos => 0, :score_neg => 0)\n @article.save\n @author = Author.create(:article_id => @article.id, :user_id => @user.id, :job => \"author\")\n @author.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n @article.user = @user\n respond_to do |format|\n if @article.save\n format.html { redirect_to new_article_path, notice: 'Artigo enviado com sucesso' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: '記事の投稿が完了しました' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n flash[:notice] = 'Article was successfully created.'\n format.html { redirect_to(@article) }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n logger.debug \"request: #{params.inspect}\"\n vari = params.require(:article).permit(:text, :title)\n logger.debug \"SOLO LOS ARTICLES : #{vari}\"\n @article = Article.new(vari)\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n logger.debug \"New article: #{@article.attributes.inspect}\"\n logger.debug \"Article should be valid: #{@article.valid?}\"\n end",
"def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n # Format HTML representa o padrão de projeto Template, que redefine partes do algoritmo\n # sem mudar a estrutura do codigo.\n format.html { redirect_to @article, notice: 'Artigo criado com sucesso.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n @article.user_id = current_user.id\n\n if @article.save\n redirect_to root_path\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end"
] | [
"0.69139385",
"0.69022036",
"0.6837345",
"0.6837345",
"0.6837345",
"0.6837345",
"0.6837345",
"0.6837345",
"0.6837345",
"0.6837345",
"0.6790484",
"0.6773438",
"0.67692786",
"0.6758303",
"0.6749435",
"0.6733409",
"0.6721679",
"0.6721679",
"0.6715562",
"0.6715562",
"0.6715562",
"0.6715562",
"0.6715562",
"0.6715562",
"0.6715562",
"0.6715562",
"0.6715562",
"0.6715562",
"0.6715562",
"0.66710776",
"0.6663971",
"0.66453224",
"0.6637117",
"0.66178536",
"0.6615982",
"0.6600207",
"0.65967274",
"0.65664464",
"0.65594345",
"0.6557695",
"0.6536541",
"0.6486166",
"0.64749616",
"0.64737386",
"0.6462963",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6442284",
"0.6424697",
"0.6401659",
"0.63787687",
"0.63666725",
"0.6342008",
"0.6337688",
"0.63264716",
"0.6299322",
"0.6266704",
"0.6266704",
"0.6266704",
"0.62535733",
"0.6251711",
"0.6249965",
"0.6246383",
"0.62339324",
"0.6217698",
"0.62151027",
"0.6207421",
"0.62019134",
"0.6190381",
"0.6189853",
"0.6180594",
"0.618023",
"0.6170898",
"0.6167835",
"0.6166351",
"0.6164066",
"0.6160772",
"0.61592925",
"0.61495334",
"0.61385274",
"0.6135929"
] | 0.6786828 | 11 |
PATCH/PUT /articles/1 or /articles/1.json | def update
if @article.user != current_user
redirect_to root_path
else
respond_to do |format|
if @article.update(article_params)
format.html { redirect_to @article, notice: 'Article was successfully updated.' }
format.json { render :show, status: :ok, location: @article }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @article.errors, status: :unprocessable_entity }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @article = article_get(params[:id])\n @article.update(params[:article])\n respond_with(@article)\n end",
"def update_article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"articles/#{id}\",options)\n if response['success']\n return response['results']['article']\n else\n return response\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to articles_path, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, :notice => 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n auth_privilege\n\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to articles_public_url, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateArticle id,params = {}\n \n APICall(path: \"help_center/articles/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to [:edit, @article], notice: 'Article modifié.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find_by_authentication_token(params[:auth_token])\n @newArticle = Article.new.from_json(params[:article])\n @oldArticle = Article.find(@newArticle.id)\n @author = Author.find_by_user_id_and_article_id(@user.id, @newArticle.id)\n if @author != nil\n @oldArticle.content = @newArticle.content\n @oldArticle.category = @newArticle.category\n @oldArticle.title = @newArticle.title\n respond_to do |format|\n if @oldArticle.save\n format.html { redirect_to @oldArticle, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oldArticle.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { render json: \"error\" }\n format.json { render json: \"error\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @article\n if @article.update(article_params)\n render status: :ok, template: 'articles/show'\n else\n render json: {errors: @article.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"def update\n@article=Article.find(params[:id])\n @article.title=params[:article][:title]\n@article.body=params[:article][:body]\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update\n @article = Article.find(params[:id])\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n #check_for_destroys\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n flash[:success] = 'Article was successfully updated.';\n format.html { redirect_to dashboard_articles_url }\n format.json { render :article }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html do\n redirect_to @article, notice: 'Article was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json do\n render json: @article.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n authorize! :edit, @article\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to(:back, :notice => 'article was successfully updated.') }\n format.json { respond_with_bip(@article) }\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@article) }\n end\n end\n end",
"def update\n if @article.update(article_params)\n render :show\n else\n render json: { errors: @article.errors }, status: :unprocessable_entity\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:article])\n format.html { redirect_to @post, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update_attributes(article_params)\n format.html { redirect_to action: :index, notice: 'Update Success.' }\n format.json { render action: :index, status: :accepted }\n else\n format.html { render action: :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params_for_update)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.'} \n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: \"Article was successfully updated.\" }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\t\tdeny_access_unless(can_edit?(@article))\n\t\t\n\t\topts = {}\n\t\topts = { :as => :editor } if can_edit?(@article)\n\t\topts = { :as => :admin } if admin?\n\n respond_to do |format|\n if @article.update_attributes(params[:article], opts)\n format.html { redirect_to @article, :notice => 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @article.update(article_params)\n\t\t\t\tformat.html { redirect_to @article, notice: 'Article was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @article }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @article.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n authorize @article\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html do\n redirect_to @article,\n notice: t('shared.msgs.success_updated',\n obj: t('activerecord.models.article', count: 1))\n end\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n flash.now[:alert]= 'Error: '+ @article.errors.full_messages.join(\". \")\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n # increase edit by 1\n if @article.edit_count\n @article.edit_count = @article.edit_count + 1\n else\n @article.edit_count = 0\n end\n # save\n respond_to do |format|\n if @article.update_attributes(params[:article])\n #format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.html { redirect_to session[:edit_redirect], notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Zmodyfikowano artykuł.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Articulo actualizado exitosamente' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t params.permit!\n\t respond_to do |format|\n\t if @article.update(article_params)\n\t format.html { redirect_to @article, notice: 'article was successfully updated.' }\n\t format.json { render :show, status: :ok, location: @article }\n\t else\n\t format.html { render :edit }\n\t format.json { render json: @article.errors, status: :unprocessable_entity }\n\t end\n\t end\n\tend",
"def update\n expire_one(params[:id])\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to([:admin, @article], :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t@article = current_user.articles.find([:id]) \n#@article = Article.find(params[:id])\n respond_to do |format|\n if @article.update_attributes(params[:article])\nformat.html { redirect_to(@article, \"article updated succesfully\") }\n#format.html { redirect_to(@article,\n#\t:notice => t('articles.update_success')) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to article_url(@article) }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors.to_xml } \n end\n end\n end",
"def update\n respond_to do |format|\n if @backend_article.update(article_params)\n format.html { redirect_to @backend_article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @backend_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to open_article(@article), notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n @partenaire = @art\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Artigo atualizado com sucesso' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = current_user.articles.find(params[:id])\n\n if @article.approved?\n params[:article].delete(:title)\n params[:article].delete(:teaser)\n end\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_article = Admin::Article.find(params[:id])\n @admin_article.format_title = @admin_article.title.gsub(/ /,\"_\").downcase\n\n respond_to do |format|\n if @admin_article.update_attributes(params[:admin_article])\n format.html { redirect_to @admin_article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to(@article, :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to(@article, :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to(@article, :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.get(params[:id])\n\n respond_to do |format|\n if @article.update(params[:article])\n flash[:notice] = 'Article was successfully updated.'\n format.html { redirect_to(@article) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: '您已成功修改经验贴' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n setup_images()\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: '記事を更新しました。' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Članek je bil uspešno posodobljen!' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize Article\n\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n @article_count = Article.count\n\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@article = current_user.articles.find(params[:id])\n authorize! :article_set_published, Article if params[:article][:published]\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@article = Article.find(params[:id])\n #@article = current_user.articles.update_attributes(params[:article])\n @article = Article.where(:user_id => current_user.id).find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @about_article.update(about_article_params)\n format.html { redirect_to @about_article, notice: 'About article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @about_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Straipsnis sekmingai atnaujintas.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to [@article.issue.magazine, @article.issue, @article], notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.unscoped.find(params[:id])\n\n unless current_user.is_admin? or (current_user == @article.author and !@article.is_verified?)\n raise ActionController::RoutingError.new('Not Found')\n end\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, flash: { success: '文章修改成功' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n undo_link = view_context.link_to(\"undo\", revert_version_path(@article.versions.last), :method => :post)\n format.html { redirect_to @article, notice: \"Article was successfully updated. #{undo_link}\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.70243174",
"0.6928369",
"0.69101673",
"0.68680274",
"0.6860129",
"0.6860129",
"0.6860129",
"0.6860129",
"0.6860129",
"0.6860129",
"0.6860129",
"0.6860129",
"0.6860129",
"0.6860129",
"0.68567026",
"0.68324685",
"0.682033",
"0.6802904",
"0.6786608",
"0.6786608",
"0.6786608",
"0.6786608",
"0.6784162",
"0.67570174",
"0.6756645",
"0.6756645",
"0.671755",
"0.671147",
"0.66990614",
"0.667525",
"0.66668963",
"0.66630715",
"0.65933126",
"0.6561837",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6542048",
"0.6537905",
"0.6531718",
"0.65114814",
"0.6502616",
"0.6497614",
"0.64970845",
"0.649348",
"0.6488048",
"0.64793783",
"0.64675343",
"0.64583546",
"0.6450929",
"0.6442865",
"0.6433363",
"0.642995",
"0.6423799",
"0.6419437",
"0.63935745",
"0.638857",
"0.6385227",
"0.63632786",
"0.63569045",
"0.63375837",
"0.63055193",
"0.6301318",
"0.6297359",
"0.6295217",
"0.6291867",
"0.6290614",
"0.6290614",
"0.6290614",
"0.6284101",
"0.6276905",
"0.62758553",
"0.626301",
"0.6243001",
"0.62383354",
"0.62295455",
"0.6228954",
"0.6220914",
"0.62077045",
"0.62038594",
"0.619919"
] | 0.0 | -1 |
DELETE /articles/1 or /articles/1.json | def destroy
if @article.user != current_user
redirect_to root_path
else
@article.destroy
respond_to do |format|
format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }
format.json { head :no_content }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @article = Article.where(id: params[:id]).last\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id]) \n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n auth_privilege\n\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_articles_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.internal.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_path, :notice => t('articles.article_successfully_deleted') }\n format.json { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n \n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_article = Admin::Article.find(params[:id])\n @admin_article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article ||= Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Recipe was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n # format.html design Template\n format.html { redirect_to articles_url, notice: 'Artigo apagado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Usunięto artykuł.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Articulo eliminado exitosamente' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Članek je bil uspešno izbrisan!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n check_admin_or_dziekan\n respond_to do |format|\n format.html { redirect_to articles_url }\n# format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url, :notice => \"Successfully destroyed article. #{undo_link}\" }\n format.json { head :ok }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Straipsnis sekmingai pasalintas.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Vous avez bien detruit cet article' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @journalarticle.destroy\n respond_to do |format|\n format.html { redirect_to journalarticles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: \"Article was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Aritcle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n \n respond_to do |format|\n format.html { redirect_to articles_url }\n format.xml { render :nothing => true }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to magazine_issue_articles_url, notice: 'Article was successfully desleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html do\n redirect_to articles_url,\n notice: t('shared.msgs.success_destroyed',\n obj: t('activerecord.models.article', count: 1))\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.where(:user_id => current_user.id).find(params[:id])\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7802082",
"0.77808625",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.7762953",
"0.77581215",
"0.7732303",
"0.7732303",
"0.7732303",
"0.7732303",
"0.7732303",
"0.7732303",
"0.76984644",
"0.76984644",
"0.76942176",
"0.7693202",
"0.7693202",
"0.7693202",
"0.7693202",
"0.7665091",
"0.76288295",
"0.7610879",
"0.7599495",
"0.7530667",
"0.7519727",
"0.75083566",
"0.7500425",
"0.749915",
"0.74917036",
"0.74846566",
"0.7466164",
"0.74653465",
"0.7465246",
"0.74508905",
"0.7446582",
"0.74447876",
"0.74189293",
"0.7406477",
"0.7406477",
"0.7406477",
"0.7406477",
"0.7406477",
"0.7399906",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7397823",
"0.7393946",
"0.73910695",
"0.7376911",
"0.7375611",
"0.7375611",
"0.7357274",
"0.7355624",
"0.734365"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_article
@article = Article.find(params[:id])
@article_bodies=ArticleBody.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Only allow a list of trusted parameters through. | def article_params
params.require(:article).permit(:title,:image,:buyer_id,:item_id, tags_attributes: [:id, :text, :_destroy], article_bodies_attributes: [:id, :order, :body,{images: []},:_destroy]).merge(user_id: current_user.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] | 0.0 | -1 |
GET /draft_lists/new GET /draft_lists/new.xml | def new
@draft_list = DraftList.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @draft_list }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @draft = SmsOnRails::Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft }\n end\n end",
"def new\n @draft = @compare.drafts.build \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft }\n end\n end",
"def new\n @draft = Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @draft }\n end\n end",
"def new\n @draft = Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @draft }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n\t\t@list = List.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @list }\n\t\tend\n\tend",
"def new\n @whitelist = Whitelist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @whitelist }\n end\n end",
"def new\n @mailinglist = Mailinglist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mailinglist }\n end\n end",
"def new\n @action_list = ActionList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @action_list }\n end\n end",
"def new\n @email_list = EmailList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @email_list }\n end\n end",
"def new\n @blacklist = Blacklist.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blacklist }\n end\n end",
"def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end",
"def new\n @draft_company = DraftCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft_company }\n end\n end",
"def new\n @book_list = BookList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book_list }\n end\n end",
"def new\n @wordlist = Wordlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wordlist }\n end\n end",
"def new\n @draft_partnership = DraftPartnership.new\n\n respond_to do |format|\n \n format.xml { render :xml => @draft_partnership }\n end\n end",
"def new\n @page_title = \"Task List New\"\n @task_list = TaskList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task_list }\n end\n end",
"def new\n @todo_list = TodoList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo_list }\n end\n end",
"def new\n @group_list = GroupList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group_list }\n end\n end",
"def new\n @list = @project.lists.new\n\n respond_to do |format|\n format.html { render layout: 'form' }# new.html.erb\n format.json { render json: @list }\n end\n end",
"def new\n @draft_investment = DraftInvestment.new\n\n respond_to do |format|\n\n format.xml { render :xml => @draft_investment }\n end\n end",
"def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @listing }\n end\n end",
"def new\n @favourites = Favourites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @favourites }\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 @order_list = OrderList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order_list }\n end\n end",
"def new\n @wish_list = WishList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list }\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 new\n @show_set_list = show.show_set_lists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @show_set_list }\n end\n end",
"def new\n @mylist = Mylist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mylist }\n end\n end",
"def new\n @fwlist = Fwlist.new\n \t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fwlist }\n end\n end",
"def new\n @lb202556 = Lb202556.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lb202556 }\n end\n end",
"def new\n @list_view = ListView.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @list_view }\n end\n end",
"def new\n @article = Article.new\n @drafts = Article.draft.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @list = List.find(params[:id])\n @todolist = @list.todolists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todolist }\n end\n end",
"def new\n @list = List.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end",
"def new\n @list = List.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end",
"def new\n @list = List.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end",
"def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def new\n @list_record = ListRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @list_record }\n end\n end",
"def new\n @list = current_user.lists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end",
"def new\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\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @list_item }\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 new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fund_request }\n end\n end",
"def new\n @list_cat = ListCat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @list_cat }\n end\n end",
"def new\n @play_list = PlayList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @play_list }\n end\n end",
"def new\n @data_list = DataList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @data_list }\n end\n end",
"def new\n @playlist = Playlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @playlist }\n end\n end",
"def create\n @draft = Draft.new(params[:draft])\n\n respond_to do |format|\n if @draft.save\n format.html { redirect_to(compare_path(:id => @draft.compare_id), :flash => { :success => 'draft created.'}) }\n format.xml { render :xml => @draft, :status => :created, :location => @draft }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @draft.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @pledge = Pledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pledge }\n end\n end",
"def new\n @pending_titles_for_collection = PendingTitlesForCollection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pending_titles_for_collection }\n end\n end",
"def new\n @reminder_task_list = ReminderTaskList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reminder_task_list }\n end\n end",
"def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def new\n @runlist = Runlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @runlist }\n end\n end",
"def new\n @document_status = DocumentStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document_status }\n end\n end",
"def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.fbml # new.fbml.erb\n format.xml { render :xml => @listing }\n end\n end",
"def new\n @lendable = Lendable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lendable }\n end\n end",
"def new\n @swlist_blacklist = SwlistBlacklist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @swlist_blacklist }\n end\n end",
"def new\n @program_list= Programlist.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @program_list}\n end\n end",
"def new\n @user = User.new\n get_list\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @user }\n end\n end",
"def new\n @pledge = Pledge.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pledge }\n end\n end",
"def new\n @lista_precio = ListaPrecio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lista_precio }\n end\n end",
"def new\n @list_field_value = ListFieldValue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @list_field_value }\n end\n end",
"def create\n params[:draft_list].store(:user_id, current_user.id)\n params[:draft_list].store(:year, Time.now.year)\n @draft_list = DraftList.new(params[:draft_list])\n\n respond_to do |format|\n if @draft_list.save\n \n # Populate this list with all of the available cars\n\n rankedCars = \n PreseasonRanking.find_all_by_year(\n @draft_list.year, \n :order => \"position DESC\").collect{|pr| pr.car}\n \n rankedCars.each do |car|\n @draft_list.add_car(car)\n end\n \n # Car.find_all_by_year(@draft_list.year, :order => \"number\").each do |car|\n # @draft_list.add_car(car)\n # end\n \n flash[:notice] = 'Draft list was successfully created.'\n format.html { redirect_to(draft_lists_path) }\n format.xml { render :xml => @draft_list, :status => :created, :location => @draft_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @draft_list.errors, :status => :unprocessable_entity }\n end\n end\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 new\n @blacklisted_site = BlacklistedSite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blacklisted_site }\n end\n end",
"def new\n head :status => 405\n return\n \n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def new\n @twitterfeed = Twitterfeed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @twitterfeed }\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 create\n @draft = Draft.new(params[:draft])\n\n respond_to do |format|\n if @draft.save\n format.html { redirect_to @draft, :notice => 'Draft was successfully created.' }\n format.json { render :json => @draft, :status => :created, :location => @draft }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @draft.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end",
"def new\n @fixed_deposit = FixedDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fixed_deposit }\n end\n end",
"def new\n @office = Office.new\n\t\t\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @office }\n end\n end",
"def new\n @waiting_list = WaitingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @waiting_list }\n end\n end",
"def new\n @tipo_lista = TipoLista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_lista }\n end\n end",
"def new\n @shelf = Shelf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shelf }\n end\n end",
"def new\n @holder = Holder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @holder }\n end\n end",
"def new\n @post377 = Post377.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post377 }\n end\n end",
"def new\n @task = Task.new(:task_list => TaskList.find(params[:task_list_id]))\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @list_of_value = Irm::ListOfValue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @list_of_value }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def new\n @collection = Collection.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end",
"def new\n @blueprint = Blueprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blueprint }\n end\n end",
"def new\n @lb30 = Lb30.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lb30 }\n end\n end",
"def new\n @copy = Copy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @copy }\n end\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 new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll }\n end\n end",
"def new\n @mailing_list = MailingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mailing_list }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @team }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notifier }\n end\n end",
"def new\n @feed = Feed.new\n @page_title = 'Add Feed'\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @feed }\n end\n end",
"def new\n @docent = Docent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @docent }\n end\n end",
"def new\n @published_document = PublishedDocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @published_document }\n end\n end",
"def new\n @approval = Approval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @approval }\n end\n end"
] | [
"0.69568026",
"0.6762843",
"0.67102605",
"0.670306",
"0.66820025",
"0.6679832",
"0.66745394",
"0.6630775",
"0.65615577",
"0.65440714",
"0.6540415",
"0.6540345",
"0.6521184",
"0.6509956",
"0.6496252",
"0.6495337",
"0.6472967",
"0.6470149",
"0.6447194",
"0.64383936",
"0.6425332",
"0.64123243",
"0.6406218",
"0.6388347",
"0.63845533",
"0.6378196",
"0.63465637",
"0.63426256",
"0.6341947",
"0.63377243",
"0.63234156",
"0.6322619",
"0.63210446",
"0.63060975",
"0.6304886",
"0.6304886",
"0.6304886",
"0.62936497",
"0.6290316",
"0.6283194",
"0.62680733",
"0.62644506",
"0.6263683",
"0.6262676",
"0.6252425",
"0.6245244",
"0.62426835",
"0.6240669",
"0.62355286",
"0.6234053",
"0.62331",
"0.62218213",
"0.6221746",
"0.62154526",
"0.6209799",
"0.6209721",
"0.62001157",
"0.61969787",
"0.6194325",
"0.61894125",
"0.6186952",
"0.6183885",
"0.61827415",
"0.6169622",
"0.6150042",
"0.6128602",
"0.61190677",
"0.61190456",
"0.6117416",
"0.6117416",
"0.6117416",
"0.61072165",
"0.6106545",
"0.61036664",
"0.61031806",
"0.61021715",
"0.6101284",
"0.6088568",
"0.6088295",
"0.6086033",
"0.6085744",
"0.60778123",
"0.607621",
"0.60717523",
"0.60694957",
"0.6068726",
"0.60669184",
"0.60668546",
"0.60637534",
"0.6060228",
"0.60575956",
"0.6054188",
"0.60531384",
"0.6046491",
"0.6046272",
"0.6044706",
"0.6041993",
"0.60419315",
"0.604151",
"0.6040959"
] | 0.80648017 | 0 |
POST /draft_lists POST /draft_lists.xml | def create
params[:draft_list].store(:user_id, current_user.id)
params[:draft_list].store(:year, Time.now.year)
@draft_list = DraftList.new(params[:draft_list])
respond_to do |format|
if @draft_list.save
# Populate this list with all of the available cars
rankedCars =
PreseasonRanking.find_all_by_year(
@draft_list.year,
:order => "position DESC").collect{|pr| pr.car}
rankedCars.each do |car|
@draft_list.add_car(car)
end
# Car.find_all_by_year(@draft_list.year, :order => "number").each do |car|
# @draft_list.add_car(car)
# end
flash[:notice] = 'Draft list was successfully created.'
format.html { redirect_to(draft_lists_path) }
format.xml { render :xml => @draft_list, :status => :created, :location => @draft_list }
else
format.html { render :action => "new" }
format.xml { render :xml => @draft_list.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @draft_list = DraftList.find(params[:id])\n\n respond_to do |format|\n if @draft_list.update_attributes(params[:draft_list])\n flash[:notice] = 'Draft list was successfully updated.'\n format.html { redirect_to(draft_lists_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @draft_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @draft_list = DraftList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft_list }\n end\n end",
"def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end",
"def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end",
"def test_list\n @builder.write_list('http://lancaster.myreadinglists.org/lists/4510B70F-7C50-D726-4A6C-B129F5EABB2C')\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 save_draft\n frm.button(:name=>\"save\").click\n AssignmentsList.new(@browser)\n end",
"def create\n @draft = current_user.drafts.build(params[:draft])\n\n respond_to do |format|\n if @draft.save\n format.html { redirect_to @draft, flash: { success: 'Черновик был успешно создан' } }\n format.json { render json: @draft, status: :created, location: @draft }\n else\n format.html { render action: \"new\" }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @draft = Draft.new(params[:draft])\n\n respond_to do |format|\n if @draft.save\n format.html { redirect_to @draft, :notice => 'Draft was successfully created.' }\n format.json { render :json => @draft, :status => :created, :location => @draft }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @draft.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def create\n @draft = Draft.new(draft_params)\n\n respond_to do |format|\n if @draft.save\n format.html { redirect_to @draft, notice: 'Draft was successfully created.' }\n format.json { render :show, status: :created, location: @draft }\n else\n format.html { render :new }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n frm.button(:name=>\"post\").click\n AssignmentsList.new(@browser)\n end",
"def create\n @saved_list = SavedList.new(saved_list_params)\n\n respond_to do |format|\n if @saved_list.save\n format.html { redirect_to @saved_list, notice: \"Saved list was successfully created.\" }\n format.json { render :show, status: :created, location: @saved_list }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def collection_draft_params\n params.require(:draft).permit(:user_id, :draft, :short_name, :entry_title, :provider_id, :native_id, :draft_type)\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 create(name)\n Iterable.request(conf, '/lists').post(name: name)\n end",
"def post\n frm.button(:value=>\"Post\").click\n AssignmentsList.new(@browser)\n end",
"def create\n @list = List.new(params[:list])\n @list.feeds_by_id = ''\n @list.user_id = current_user.id\n \n @lists = current_user.lists\n @feeds = current_user.feeds\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to(@list, :notice => 'List was successfully created.') }\n format.xml { render :xml => @list, :status => :created, :location => @list }\n format.js {render :layout => false}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @list.errors, :status => :unprocessable_entity }\n format.js {render :layout => false}\n end\n end\n end",
"def create\n @group_list = GroupList.new(params[:group_list])\n\n respond_to do |format|\n if @group_list.save\n format.html { redirect_to(@group_list, :notice => 'Group list was successfully created.') }\n format.xml { render :xml => @group_list, :status => :created, :location => @group_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @email_list = EmailList.new(params[:email_list])\n\n respond_to do |format|\n if @email_list.save\n format.html { redirect_to(@email_list, :notice => 'Email list was successfully created.') }\n format.xml { render :xml => @email_list, :status => :created, :location => @email_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @email_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @list = @user.lists.create(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @draft = Draft.new(params[:draft])\n\n respond_to do |format|\n if @draft.save\n format.html { redirect_to(compare_path(:id => @draft.compare_id), :flash => { :success => 'draft created.'}) }\n format.xml { render :xml => @draft, :status => :created, :location => @draft }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @draft.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.create!(list_params)\n json_response(@list, :created)\n end",
"def create_list(params)\n MailManager::List.create(params)\n end",
"def list_params\n params.require(:list).permit(:name,:amount,:body,:status,:group_id, :list )\n end",
"def create_list(project_id, list)\n record \"/projects/#{project_id}/todos/create_list\", list\n end",
"def create_list(name)\n Wunderlist::List.new(name, false, self).save\n end",
"def index\n @drafts = SmsOnRails::Draft.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @drafts }\n end\n end",
"def create\n @list = current_user.lists.build(params[:list])\n @list.user = current_user\n @user = @list.user\n respond_to do |format|\n if @list.save\n \n format.html { redirect_to root_path, notice: 'List was successfully created!' }\n format.json { render json: @user, status: :created, location: @user }\n else\n @feed_items = []\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_params\n params.require(:list).permit(:entity_id, :date, proposals_attributes: [:id, :consultant_id, :nbre_jour, :date, :etat, :_destroy])\n end",
"def drafts\n response = get 'drafts'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def create\n @list = Blog::List.new(list_params)\n\n respond_to do |format|\n if @list.save\n ActionCable.server.broadcast \"board\",\n { commit: 'addList', \n payload: render_to_string(:show, formats: [:json]) }\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @draft = @compare.drafts.build \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft }\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 @waiting_list = WaitingList.new(params[:waiting_list])\n\n respond_to do |format|\n if @waiting_list.save\n format.html { redirect_to @waiting_list, notice: 'Waiting list was successfully created.' }\n format.json { render json: @waiting_list, status: :created, location: @waiting_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @waiting_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @draft_list = DraftList.find(params[:id])\n \n errorMessage = \"\"\n \n if !@draft_list.league_memberships.empty?\n errorMessage += 'Cannot delete the list named ' + @draft_list.name +\n ' because it is being used by the following memberships: ' + \n @draft_list.league_memberships.collect{|m| m.toString}.join(\", \");\n end\n \n if errorMessage.length == 0 \n @draft_list.destroy_preferences\n @draft_list.destroy \n end\n\n respond_to do |format|\n if errorMessage.length != 0\n flash[:error] = errorMessage\n end\n \n format.html { redirect_to(draft_lists_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @book_list = BookList.new(params[:book_list])\n\n respond_to do |format|\n if @book_list.save\n format.html { redirect_to(@book_list, :notice => 'Book list was successfully created.') }\n format.xml { render :xml => @book_list, :status => :created, :location => @book_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @order_list = OrderList.new(params[:order_list])\n\n respond_to do |format|\n if @order_list.save\n format.html { redirect_to(@order_list, :notice => 'OrderList was successfully created.') }\n format.xml { render :xml => @order_list, :status => :created, :location => @order_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @action_list = ActionList.new(params[:action_list])\n\n respond_to do |format|\n if @action_list.save\n format.html { redirect_to(@action_list, :notice => 'ActionList was successfully created.') }\n format.xml { render :xml => @action_list, :status => :created, :location => @action_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @action_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def drafts; end",
"def create\n @feed_list = FeedList.new(feed_list_params)\n\n respond_to do |format|\n if @feed_list.save\n if Rails.env.development?\n format.html { redirect_to @feed_list }\n else\n format.html { redirect_to \"https://kennelapp.herokuapp.com/feed_lists/1.pdf\"}\n end\n format.json { render :show, status: :created, location: @feed_list }\n else\n format.html { render :new }\n format.json { render json: @feed_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_params\n params.require(:list).permit(:title, :description, :is_deleted)\n end",
"def create\n @list = List.new(params[:list])\n Grade.all.each do |g|\n @list.posts.build(gname: g.name, tname: g.teacher_name)\n end\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mail_list = MailList.new(mail_list_params)\n\n respond_to do |format|\n if @mail_list.save\n format.html { redirect_to [:admin, @mail_list], notice: 'Mail list was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mail_list }\n else\n format.html { render action: 'new' }\n format.json { render json: @mail_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_params\n params.require(:list).permit(:name, :date, :family_id)\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 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 create\n @list = @project.lists.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to [@project, @list], notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list_of_value = Irm::ListOfValue.new(params[:irm_list_of_value])\n\n respond_to do |format|\n if @list_of_value.save\n format.html { redirect_to({:action => \"index\"}, :notice => t(:successfully_created)) }\n format.xml { render :xml => @list_of_value, :status => :created, :location => @list_of_value }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @list_of_value.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @document_list = DocumentList.new(document_list_params)\n\n respond_to do |format|\n if @document_list.save\n format.html { redirect_to @document_list, notice: 'Document list was successfully created.' }\n format.json { render :show, status: :created, location: @document_list }\n else\n format.html { render :new }\n format.json { render json: @document_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # Create new saved list table entry\n @saved_list = SavedList.new\n\n # Store attributes\n @saved_list.login_id = params[:login_id]\n @saved_list.list_name = params[:list_name]\n @saved_list.saved_user_list = true\n @saved_list.date_saved = params[:date_saved]\n\n # Save the saved list\n respond_to do |format|\n if @saved_list.save\n\n # Create new user saved list entries for all users in list\n @user_ids = params[\"user_ids\"]\n @user_ids.each do |user_id|\n SavedListUser.create(saved_list_id: @saved_list.id, user_id: user_id)\n end\n\n format.html { redirect_to @saved_list, notice: 'Saved list was successfully created.' }\n format.json { render :show, status: :created, location: @saved_list }\n else\n format.html { render :new }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\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\n @list = current_user.lists.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def draft_params\n params.require(:draft).permit(:title, :content, :category_id, :approval_status_id, :page_id, :user_id, :description, :comments)\n end",
"def create\n @reminder_task_list = ReminderTaskList.new(params[:reminder_task_list])\n\n respond_to do |format|\n if @reminder_task_list.save\n format.html { redirect_to(@reminder_task_list, :notice => 'Reminder task list was successfully created.') }\n format.xml { render :xml => @reminder_task_list, :status => :created, :location => @reminder_task_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reminder_task_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @party_list = PartyList.new(party_list_params)\n\n respond_to do |format|\n if @party_list.save\n format.html { redirect_to @party_list, notice: 'Party list was successfully created.' }\n format.json { render :show, status: :created, location: @party_list }\n else\n format.html { render :new }\n format.json { render json: @party_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list.entity, notice: 'La liste de propositions pour la semaine ' + @list.date.to_time.strftime(\"%W\") + ' a été créée avec succès.' }\n format.json { render action: 'show', status: :created, location: @list }\n else\n format.html { render action: 'new' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @draft_partnership = DraftPartnership.new(params[:partnership])\n\n respond_to do |format|\n if @draft_partnership.save\n\n format.xml { render :xml => @draft_partnership, :status => :created, :location => @draft_partnership }\n else\n \n format.xml { render :xml => @draft_partnership.errors, :status => :unprocessable_entity }\n end\n end\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 create\n @wordlist = Wordlist.new(params[:wordlist])\n\n respond_to do |format|\n if @wordlist.save\n flash[:notice] = 'Wordlist was successfully created.'\n format.html { redirect_to(@wordlist) }\n format.xml { render :xml => @wordlist, :status => :created, :location => @wordlist }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wordlist.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @fwlist = Fwlist.new(params[:fwlist])\n\n respond_to do |format|\n if @fwlist.save\n format.html { redirect_to @fwlist, notice: 'Fwlist was successfully created.' }\n format.json { render json: @fwlist, status: :created, location: @fwlist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fwlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'Nice Work- List Created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mailee_list = Mailee::List.new(params[:mailee_list])\n\n respond_to do |format|\n if @mailee_list.save\n format.html { redirect_to(@mailee_list, :notice => 'Mailee list was successfully created.') }\n format.xml { render :xml => @mailee_list, :status => :created, :location => @mailee_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mailee_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @data_list = DataList.new(params[:data_list])\n\n respond_to do |format|\n if @data_list.save\n format.html { redirect_to(@data_list, :notice => 'Data list was successfully created.') }\n format.xml { render :xml => @data_list, :status => :created, :location => @data_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @data_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_list(options={})\n database_id = options[:database_id]\n list_name = options[:contact_list_name]\n visibility = options[:visibility]\n\n raise ArgumentError, \":database_id option is required\" unless database_id\n raise ArgumentError, \":list_name option is required\" unless list_name\n raise ArgumentError, \":visibility option is required\" unless visibility\n\n request_body = ''\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n xml.instruct!\n xml.Envelope do\n xml.Body do\n xml.CreateContactList do\n xml.DATABASE_ID database_id\n xml.CONTACT_LIST_NAME list_name\n xml.VISIBILITY visibility\n end\n end\n end\n\n doc = send_xml_api_request(request_body)\n result_dom(doc)['CONTACT_LIST_ID']\n end",
"def send_list_edition(list, edition, who)\n xml = Builder::XmlMarkup.new\n xml.tag!(\n 'Send',\n ((who.is_a?(String)) ? [ who ] : who).join(','),\n 'List' => list,\n 'Edition' => edition)\n\n Request::Post.send(self, xml)\n end",
"def index\n #@feed_lists = FeedList.all\n create\n end",
"def create\n @wish_list = WishList.new(params[:wish_list])\n\n respond_to do |format|\n if @wish_list.save\n flash[:notice] = 'WishList was successfully created.'\n format.html { redirect_to(admin_wish_lists_path) }\n format.xml { render :xml => @wish_list, :status => :created, :location => @wish_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wish_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def pending_list\n @design_changes = DesignChange.find_pending\n \n respond_to do |format|\n format.html # pending_list.html.erb\n format.xml { render :xml => @design_changes }\n end\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @runlist = Runlist.new(params[:runlist])\n\n\n respond_to do |format|\n if @runlist.save\n\t\t\t\t(rend; return) if request.xhr?\n flash[:notice] = 'Runlist was successfully created.'\n format.html { redirect_to(@runlist) }\n format.xml { render :xml => @runlist, :status => :created, :location => @runlist }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @runlist.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @todo_list = @project.todo_lists.build(params[:todo_list])\n\n respond_to do |format|\n if @todo_list.save\n flash[:notice] = 'TodoList was successfully created.'\n format.html { redirect_to(@project) }\n format.xml { render :xml => @todo_list, :status => :created, :location => @todo_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @todo_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @list = @organization.lists.build(list_params.merge(creator: authed_user))\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to [@list.organization, @list], notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: [@list.organization, @list] }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_post(api_key, access_token, list, body, opts = {})\n data, _status_code, _headers = add_post_with_http_info(api_key, access_token, list, body, opts)\n return data\n end",
"def create\n @list = List.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(params[:list])\n if @list.save\n redirect_to @list, :notice =>\"List successfully created.\"\n else\n flash[:error] = \"Your list could not be saved.\"\n render :action => \"new\"\n end\n end",
"def create\n @day_list = DayList.new(params[:day_list])\n\n respond_to do |format|\n if @day_list.save\n format.html { redirect_to @day_list, notice: 'Day list was successfully created.' }\n format.json { render json: @day_list, status: :created, location: @day_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @day_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invite_list = InviteList.new(params[:invite_list])\n\n respond_to do |format|\n if @invite_list.save\n format.html { redirect_to @invite_list, notice: 'Invite list was successfully created.' }\n format.json { render json: @invite_list, status: :created, location: @invite_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = current_user.lists.build(params[:list])\n respond_to do |format|\n format.js\n end\n end",
"def create\n @articy_draft = ArticyDraft.new\n\n file = params[:articy_draft][:file]\n @articy_draft.xml = file\n @articy_draft.notes = params[:articy_draft][:notes]\n\n respond_to do |format|\n if @articy_draft.save\n format.html { redirect_to root_path, notice: 'Articy Draft XML was successfully created.' }\n format.json { render action: 'show', status: :created, location: @articy_draft }\n else\n format.html { render action: 'new' }\n format.json { render json: @articy_draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = current_user.lists.new(new_list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to my_list_path(@list), notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: my_list_path(@list) }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page_title = \"Task List Create\"\n @task_list = TaskList.new(params[:task_list])\n\n respond_to do |format|\n if @task_list.save\n flash[:notice] = 'TaskList was successfully created.'\n format.html { redirect_to(@task_list) }\n format.xml { render :xml => @task_list, :status => :created, :location => @task_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @email_list = EmailList.new(email_list_params)\n\n respond_to do |format|\n if @email_list.save\n format.html { redirect_to @email_list, notice: 'Email list was successfully created.' }\n format.json { render :show, status: :created, location: @email_list }\n else\n format.html { render :new }\n format.json { render json: @email_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reference_list = ReferenceList.new(reference_list_params)\n\n respond_to do |format|\n if @reference_list.save\n format.html { redirect_to @reference_list, notice: 'Reference list was successfully created.' }\n format.json { render :show, status: :created, location: @reference_list }\n else\n format.html { render :new }\n format.json { render json: @reference_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render action: 'show', status: :created, location: @list }\n else\n format.html { render action: 'new' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dump_list = DumpList.new(dump_list_params)\n\n respond_to do |format|\n if @dump_list.save\n flash[:success] = 'Dump list was successfully created.'\n format.html { redirect_to @dump_list }\n format.json { render :show, status: :created, location: @dump_list }\n else\n flash[:danger] = \"There are some mistakes, please try again\"\n format.html { render :new }\n format.json { render json: @dump_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_list\n\n # Try listing from a non-Admin account.\n # VERIFY: The user is redirected.\n post :list, {}, rich_designer_session\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try listing from an Admin account\n # VERIFY: The project list data is retrieved\n post(:list, { :page => 1 }, cathy_admin_session)\n assert_equal(5, assigns(:document_types).size)\n end",
"def dump_list_params\n params.require(:dump_list).permit(:post_id)\n end",
"def create\n\t\t@list = List.new(list_params)\n\t\t@list.save\n\t\t\tredirect_to '/tasks'\n\tend",
"def new\n @draft = SmsOnRails::Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft }\n end\n end",
"def list_params\n params.require(:list).permit(:name, :board_id)\n end",
"def list_update_params\n\t\tparams.require(:list).permit(:description, :deadline, :completion_status, :userID)\n\tend",
"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 announce_post(listname,domain,subject,message,name,options={})\n values = {\n \"listname\" => listname,\n \"domain\" => domain,\n \"subject\" => subject,\n \"message\" => message,\n \"name\" => name\n }.merge(options)\n doc = request(\"announcement_list-post_announcement\", values, true)\n api_error?(doc)\n true\n end",
"def create\n #@list = List.new(list_params)\n @list = current_user.lists.create(list_params)\n if params[:campsite_id] && @list.listeds.find_by_campsite_id(params[:campsite_id]).blank?\n campsite = Campsite.find(params[:campsite_id])\n @listed = campsite.listeds.create(list:@list.id, user_id:current_user.id)\n #@listed = Listed.new()\n #@listed.list_id = @list.id\n #@listed.user_id = current_user.id\n #@listed.save\n end\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to management_lists_path, notice: 'List was successfully created.' }\n format.json { render action: 'show', status: :created, location: @list }\n else\n format.html { render action: 'new' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_params\n params.require(:list).permit(:title, :category_id, :body)\n end",
"def create\n @list = List.new(list_params)\n if @list.save\n return redirect_to list_url(@list)\n else\n flash[:error] = \"U is broken yo\"\n return render :new\n end\n end"
] | [
"0.63938475",
"0.6388358",
"0.6145281",
"0.5994053",
"0.5969233",
"0.5941389",
"0.58176166",
"0.5741093",
"0.5715119",
"0.5673285",
"0.5673227",
"0.56605244",
"0.56574726",
"0.5634852",
"0.5632401",
"0.56087613",
"0.5605864",
"0.55926204",
"0.55814457",
"0.5562096",
"0.5528696",
"0.5526065",
"0.5501948",
"0.5488538",
"0.54698753",
"0.5469114",
"0.5466059",
"0.54525316",
"0.5449732",
"0.54447573",
"0.54334015",
"0.54308224",
"0.5428752",
"0.5422834",
"0.5420088",
"0.54140306",
"0.5395531",
"0.5395195",
"0.53935874",
"0.5371358",
"0.5370032",
"0.5364244",
"0.53627",
"0.53549194",
"0.5345126",
"0.533999",
"0.5333889",
"0.5331791",
"0.5319132",
"0.53166425",
"0.53094786",
"0.5301748",
"0.53014",
"0.530013",
"0.52988833",
"0.5291954",
"0.52909726",
"0.5283108",
"0.528249",
"0.52802247",
"0.5280157",
"0.5277623",
"0.5276211",
"0.5262021",
"0.5260494",
"0.5259552",
"0.5258454",
"0.5257594",
"0.5256003",
"0.5249362",
"0.524475",
"0.5243527",
"0.5243527",
"0.52375436",
"0.5233638",
"0.52294964",
"0.5228936",
"0.5227386",
"0.52255076",
"0.5225479",
"0.5223469",
"0.52202517",
"0.52169126",
"0.52154577",
"0.52126724",
"0.5211232",
"0.52097833",
"0.520846",
"0.5207564",
"0.52004176",
"0.5196912",
"0.5195747",
"0.5194176",
"0.5190988",
"0.5182353",
"0.5180085",
"0.51783967",
"0.517741",
"0.5172458",
"0.5169527"
] | 0.6137105 | 3 |
PUT /draft_lists/1 PUT /draft_lists/1.xml | def update
@draft_list = DraftList.find(params[:id])
respond_to do |format|
if @draft_list.update_attributes(params[:draft_list])
flash[:notice] = 'Draft list was successfully updated.'
format.html { redirect_to(draft_lists_path) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @draft_list.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end",
"def update\n @list = List.find(params[:id])\n @show_list = true\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { render @list }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @adventure.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @draft = Draft.find(params[:id])\n\n respond_to do |format|\n if @draft.update_attributes(params[:draft])\n format.html { redirect_to(@draft, :notice => 'Draft was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @draft.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@list = List.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @list.update_attributes(params[:list])\n\t\t\t\tformat.html\t{ redirect_to(root_url) }\n\t\t\t\tformat.xml\t{ head :ok }\n\t\t\telse\n\t\t\t\tformat.html\t{ render :action => \"edit\" }\n\t\t\t\tformat.xml\t{ render :xml => @list.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"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 @book_list = BookList.find(params[:id])\n\n respond_to do |format|\n if @book_list.update_attributes(params[:book_list])\n format.html { redirect_to(@book_list, :notice => 'Book list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @draft = Draft.find(params[:id])\n\n respond_to do |format|\n if @draft.update_attributes(params[:draft])\n format.html { redirect_to @draft, :notice => 'Draft was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @draft.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @email_list = EmailList.find(params[:id])\n\n respond_to do |format|\n if @email_list.update_attributes(params[:email_list])\n format.html { redirect_to(@email_list, :notice => 'Email list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_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 \n list_attributes = params[:list] || params[:check_list]\n \n if @list.update(list_attributes)\n flash[:notice] = t(:list_saved)\n redirect_to @list\n else\n render :action => 'edit'\n end\n end",
"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 @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, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: blog_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 @draft_partnership = DraftPartnership.find(params[:id])\n\n respond_to do |format|\n if @draft_partnership.update_attributes(params[:partnership])\n\n format.xml \n else\n \n format.xml { render :xml => @draft_partnership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @list = @project.lists.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to [@project, @list], notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @draft = Draft.find(params[:id])\n\n respond_to do |format|\n if @draft.update_attributes(params[:draft])\n format.html { redirect_to @draft, flash: { success: 'Черновик был успешно обновлён'} }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @draft.update(draft_params)\n format.html { redirect_to @draft, notice: 'Draft was successfully updated.' }\n format.json { render :show, status: :ok, location: @draft }\n else\n format.html { render :edit }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @draft = SmsOnRails::Draft.find(params[:id])\n\n respond_to do |format|\n if @draft.update_attributes(params[:draft])\n flash[:notice] = 'Draft was successfully updated.'\n format.html { redirect_to(sms_draft_url(:id => @draft)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @draft.errors, :status => :unprocessable_entity }\n end\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 respond_to do |format|\n if @document_list.update(document_list_params)\n format.html { redirect_to @document_list, notice: 'Document list was successfully updated.' }\n format.json { render :show, status: :ok, location: @document_list }\n else\n format.html { render :edit }\n format.json { render json: @document_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @draft.update(draft_params)\n format.html { redirect_to @draft, notice: 'Draft was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @draft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @saved_list.update(saved_list_params)\n format.html { redirect_to @saved_list, notice: \"Saved list was successfully updated.\" }\n format.json { render :show, status: :ok, location: @saved_list }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @action_list = ActionList.find(params[:id])\n\n respond_to do |format|\n if @action_list.update_attributes(params[:action_list])\n format.html { redirect_to(@action_list, :notice => 'ActionList was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @action_list.errors, :status => :unprocessable_entity }\n end\n end\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 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 = List.find(params[:id])\n \n @lists = current_user.lists\n @feeds = current_user.feeds\n \n # Case where feed is dropped\n puts params[:id]\n if(params[:feed_title]!=nil || params[:feed_id]!=nil)\n if(params[:feed_title]==nil)\n params[:feed_title] = Feed.find(params[:feed_id]).title\n end\n respond_to do |format|\n if(@list.add_feed(@list.id,params[:feed_title]))\n format.html { redirect_to(@list, :notice => 'List was successfully updated.') }\n format.xml { head :ok }\n format.js {render :layout => false}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @list.errors, :status => :unprocessable_entity }\n format.js {render :layout => false}\n end\n end\n # Case where list is updated\n else\n @list.name = params[:list][:name]\n puts \"params!!!!!!!\"\n puts params[:list][:name]\n puts @list.convert_titles_to_string(params[:feeds])\n @list.feeds_by_id = @list.convert_titles_to_string(params[:feeds])\n respond_to do |format|\n if @list.save\n flash[:notice] = \"List successfully updated\"\n format.html { redirect_to(@list, :notice => 'List was successfully updated.') }\n format.xml { head :ok }\n format.js {render :layout => false}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @list.errors, :status => :unprocessable_entity }\n format.js {render :layout => false}\n end\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\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list.entity, notice: 'La Liste de propositions pour la semaine ' + @list.date.to_time.strftime(\"%W\") + ' a été modifiée avec succès.' }\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 @checklist = Checklist.find(params[:id])\n\n respond_to do |format|\n if @checklist.update_attributes(params[:checklist])\n flash[:notice] = 'Checklist was successfully updated.'\n format.html { redirect_to(@checklist) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @checklist.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 respond_to do |format|\n if @feed_list.update(feed_list_params)\n format.html { redirect_to @feed_list, notice: 'Feed list was successfully updated.' }\n format.json { render :show, status: :ok, location: @feed_list }\n else\n format.html { render :edit }\n format.json { render json: @feed_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_list\n current_path = '/api/v1/update'\n @conn.get(current_path)\n end",
"def update\n @order_list = OrderList.find(params[:id])\n\n respond_to do |format|\n if @order_list.update_attributes(params[:order_list])\n format.html { redirect_to(@order_list, :notice => 'OrderList was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def editList\n\t\t@list = List.find(params[:id])\n\tend",
"def update\n @list_of_value = Irm::ListOfValue.find(params[:id])\n\n respond_to do |format|\n if @list_of_value.update_attributes(params[:irm_list_of_value])\n format.html { redirect_to({:action => \"index\"}, :notice => t(:successfully_updated)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @list_of_value.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 save\n raise NotImplementedError, \"Lists can't be edited through the API\"\n end",
"def update\n @page_title = \"Task List Update\"\n @task_list = TaskList.find(params[:id])\n\n respond_to do |format|\n if @task_list.update_attributes(params[:task_list])\n flash[:notice] = 'TaskList was successfully updated.'\n format.html { redirect_to(@task_list) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task_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 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.organization, @list], notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: [@list.organization, @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 @thing_list = ThingList.find(params[:id])\n\n respond_to do |format|\n if @thing_list.update_attributes(params[:thing_list])\n format.html { redirect_to(@thing_list, :notice => 'Thing list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @thing_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n if @todo_list.update_attributes(params[:todo_list])\n flash[:notice] = 'TodoList was successfully updated.'\n format.html { redirect_to(@todo_list) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @todo_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 new\n @draft_list = DraftList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft_list }\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_list(user, list, options={})\n post(\"/#{user}/lists/#{list}.json\", options)\n end",
"def update\n @mailee_list = Mailee::List.find(params[:id])\n\n respond_to do |format|\n if @mailee_list.update_attributes(params[:mailee_list])\n format.html { redirect_to(@mailee_list, :notice => 'Mailee list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mailee_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @wordlist = Wordlist.find(params[:id])\n\n respond_to do |format|\n if @wordlist.update_attributes(params[:wordlist])\n flash[:notice] = 'Wordlist was successfully updated.'\n format.html { redirect_to(@wordlist) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wordlist.errors, :status => :unprocessable_entity }\n end\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 respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n\n else\n format.html { render :edit }\n\n end\n end\n end",
"def update_list(access_token, list)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list.id)\n url = build_url(url)\n payload = list.to_json\n response = RestClient.put(url, payload, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\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 authorize! :update, @ml_list\n respond_to do |format|\n if @ml_list.update(ml_list_params)\n format.html { redirect_to @ml_list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @ml_list }\n else\n format.html { render :edit }\n format.json { render json: @ml_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reminder_task_list = ReminderTaskList.find(params[:id])\n\n respond_to do |format|\n if @reminder_task_list.update_attributes(params[:reminder_task_list])\n format.html { redirect_to(@reminder_task_list, :notice => 'Reminder task list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reminder_task_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group_list = GroupList.find(params[:id])\n\n respond_to do |format|\n if @group_list.update_attributes(params[:group_list])\n format.html { redirect_to(@group_list, :notice => 'Group list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @word_list = WordList.find(params[:id])\n\n respond_to do |format|\n if @word_list.update_attributes(params[:word_list])\n format.html { redirect_to @word_list, notice: 'Word list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n if @invite_list.update_attributes(params[:invite_list])\n format.html { redirect_to @invite_list, notice: 'Invite list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @list_view = ListView.find(params[:id])\n\n respond_to do |format|\n if @list_view.update_attributes(params[:list_view])\n format.html { redirect_to(@list_view, :notice => 'List view was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @list_view.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @waiting_list = WaitingList.find(params[:id])\n\n respond_to do |format|\n if @waiting_list.update_attributes(params[:waiting_list])\n format.html { redirect_to @waiting_list, notice: 'Waiting list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @waiting_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data_list = DataList.find(params[:id])\n\n respond_to do |format|\n if @data_list.update_attributes(params[:data_list])\n format.html { redirect_to(@data_list, :notice => 'Data list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @data_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @list.update_attributes list_params\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 @reference_list.update(reference_list_params)\n format.html { redirect_to @reference_list, notice: 'Reference list was successfully updated.' }\n format.json { render :show, status: :ok, location: @reference_list }\n else\n format.html { render :edit }\n format.json { render json: @reference_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ota_code_list_list = Ota::CodeList::List.find(params[:id])\n\n respond_to do |format|\n if @ota_code_list_list.update_attributes(params[:ota_code_list_list])\n format.html { redirect_to(@ota_code_list_list, :notice => 'List was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ota_code_list_list.errors, :status => :unprocessable_entity }\n end\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 @twitter_list = TwitterList.find(params[:id])\n\n respond_to do |format|\n if @twitter_list.update_attributes(params[:twitter_list])\n format.html { redirect_to @twitter_list, notice: 'Twitter list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @twitter_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_update_params\n\t\tparams.require(:list).permit(:description, :deadline, :completion_status, :userID)\n\tend",
"def update\n respond_to do |format|\n if @email_list.update(email_list_params)\n format.html { redirect_to @email_list, notice: 'Email list was successfully updated.' }\n format.json { render :show, status: :ok, location: @email_list }\n else\n format.html { render :edit }\n format.json { render json: @email_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 @checklist = Checklist.find(params[:id])\n\n respond_to do |format|\n if @checklist.update_attributes(params[:checklist])\n format.html { redirect_to @checklist, notice: 'Checklist was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @checklist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @set_list.update(set_list_params)\n format.html { redirect_to @set_list, notice: 'Set list was successfully updated.' }\n format.json { render :show, status: :ok, location: @set_list }\n else\n format.html { render :edit }\n format.json { render json: @set_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topping_list.update(topping_list_params)\n format.html { redirect_to @topping_list, notice: 'Topping list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topping_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @draft_list = DraftList.find(params[:id])\n \n errorMessage = \"\"\n \n if !@draft_list.league_memberships.empty?\n errorMessage += 'Cannot delete the list named ' + @draft_list.name +\n ' because it is being used by the following memberships: ' + \n @draft_list.league_memberships.collect{|m| m.toString}.join(\", \");\n end\n \n if errorMessage.length == 0 \n @draft_list.destroy_preferences\n @draft_list.destroy \n end\n\n respond_to do |format|\n if errorMessage.length != 0\n flash[:error] = errorMessage\n end\n \n format.html { redirect_to(draft_lists_url) }\n format.xml { head :ok }\n end\n end",
"def update_list(list_name, text)\n update_value(\"#{list_name}-list\", text)\n end",
"def update\n @army_list = ArmyList.find(params[:id])\n\n respond_to do |format|\n if @army_list.update_attributes(params[:army_list])\n flash[:notice] = 'ArmyList was successfully updated.'\n format.html { redirect_to :controller => :builder }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @army_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @draft_investment = DraftInvestment.find(params[:id])\n\n respond_to do |format|\n if @draft_investment.update_attributes(params[:investment])\n\n format.xml \n else\n\n format.xml { render :xml => @draft_investment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @word_list.update(word_list_params)\n format.html { redirect_to @word_list, notice: 'Word list was successfully updated.' }\n format.json { render :show, status: :ok, location: @word_list }\n else\n format.html { render :edit }\n format.json { render json: @word_list.errors, status: :unprocessable_entity }\n end\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 @list= List.find(params[:id])\n if @list.update(list_params)\n \tflash[:notice] = \"List successfully updated!\"\n redirect_to list_path(@list)\n else\n render :edit\n flash[:alert] = \"ERROR :(\"\n end\n end",
"def update\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n if @todo_list.update_attributes(params[:todo_list])\n format.html { redirect_to @todo_list, :notice=>\"Todo list was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render :action=>\"edit\" }\n format.json { render :json=>@todo_list.errors, :status=>\"unprocessable_entry\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booklist.update(booklist_params)\n format.html { redirect_to @booklist, notice: 'Booklist was successfully updated.' }\n format.json { render :show, status: :ok, location: @booklist }\n else\n format.html { render :edit }\n format.json { render json: @booklist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @checklist = Checklist.find(params[:id])\n\n respond_to do |format|\n if @checklist.update_attributes(checklist_params)\n format.html { redirect_to @checklist, notice: 'Checklist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @checklist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mylist = Mylist.find(params[:id])\n\n respond_to do |format|\n if @mylist.update_attributes(params[:mylist])\n format.html { redirect_to(@mylist, :notice => 'Mylist was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mylist.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n params[:draft_list].store(:user_id, current_user.id)\n params[:draft_list].store(:year, Time.now.year)\n @draft_list = DraftList.new(params[:draft_list])\n\n respond_to do |format|\n if @draft_list.save\n \n # Populate this list with all of the available cars\n\n rankedCars = \n PreseasonRanking.find_all_by_year(\n @draft_list.year, \n :order => \"position DESC\").collect{|pr| pr.car}\n \n rankedCars.each do |car|\n @draft_list.add_car(car)\n end\n \n # Car.find_all_by_year(@draft_list.year, :order => \"number\").each do |car|\n # @draft_list.add_car(car)\n # end\n \n flash[:notice] = 'Draft list was successfully created.'\n format.html { redirect_to(draft_lists_path) }\n format.xml { render :xml => @draft_list, :status => :created, :location => @draft_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @draft_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, params = {})\n @client.call(method: :put, path: \"recipient-lists/#{id}\", body_values: params.slice(:name, :description, :attributes, :recipients))\n end",
"def update\n respond_to do |format|\n if @mail_list.update(mail_list_params)\n format.html { redirect_to [:admin, @mail_list], notice: 'Mail list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mail_list.errors, status: :unprocessable_entity }\n end\n end\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\n # @task_list = TaskList.find(params[:id])\n\n respond_to do |format|\n if @task_list.update_attributes(params[:task_list])\n format.html { redirect_to @task_list, notice: 'Task list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n list = List.find_by_title(params[:task][:list_title])\n task_params = Task.format_params(params[:task][:title], params[:task][:description], list.id)\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to lists_url, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @office.update(office_params)\n head :no_content\n end",
"def update\n @stocklist = Stocklist.find(params[:id])\n\n respond_to do |format|\n if @stocklist.update_attributes(params[:stocklist])\n format.html { redirect_to @stocklist, notice: 'Stocklist was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stocklist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @check_list.update(check_list_params)\n format.html { redirect_to @check_list, notice: \"Check list was successfully updated.\" }\n format.json { render :show, status: :ok, location: @check_list }\n else\n format.html { render :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 @list_spreadsheet.update(list_spreadsheet_params)\n format.html { redirect_to @list_spreadsheet, notice: 'List spreadsheet was successfully updated.' }\n format.json { render :show, status: :ok, location: @list_spreadsheet }\n else\n format.html { render :edit }\n format.json { render json: @list_spreadsheet.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.63704234",
"0.6353446",
"0.6287557",
"0.6285754",
"0.6237817",
"0.6230982",
"0.6184482",
"0.6094058",
"0.6075279",
"0.6065166",
"0.6065166",
"0.60512656",
"0.6043054",
"0.6038768",
"0.6019874",
"0.6018788",
"0.60174894",
"0.6013198",
"0.59993565",
"0.59912586",
"0.5988361",
"0.59848213",
"0.59810126",
"0.5979088",
"0.5974214",
"0.5971941",
"0.5957731",
"0.5957731",
"0.59475446",
"0.594408",
"0.593704",
"0.5934147",
"0.59156",
"0.59067863",
"0.5905635",
"0.5900639",
"0.5899317",
"0.5898773",
"0.5897855",
"0.587416",
"0.58735156",
"0.5869114",
"0.5869114",
"0.5869114",
"0.5869114",
"0.5869114",
"0.5861646",
"0.58592397",
"0.5856886",
"0.5856386",
"0.58532524",
"0.58516276",
"0.58504194",
"0.58403623",
"0.58340615",
"0.58305866",
"0.5823069",
"0.58152187",
"0.5805372",
"0.5776876",
"0.5775619",
"0.57644755",
"0.5759206",
"0.57587653",
"0.5756522",
"0.5750948",
"0.57438964",
"0.5726018",
"0.57205737",
"0.5710662",
"0.56895775",
"0.5687965",
"0.5679731",
"0.5678514",
"0.5674526",
"0.5668682",
"0.5660157",
"0.56576306",
"0.5643749",
"0.56406033",
"0.5633322",
"0.56316435",
"0.56303775",
"0.5626793",
"0.5624923",
"0.56207746",
"0.56176245",
"0.5615361",
"0.56123376",
"0.5606813",
"0.560671",
"0.560219",
"0.5601429",
"0.55982184",
"0.5589406",
"0.5587377",
"0.5583223",
"0.5583015",
"0.5580909",
"0.55788726"
] | 0.765184 | 0 |
DELETE /draft_lists/1 DELETE /draft_lists/1.xml | def destroy
@draft_list = DraftList.find(params[:id])
errorMessage = ""
if !@draft_list.league_memberships.empty?
errorMessage += 'Cannot delete the list named ' + @draft_list.name +
' because it is being used by the following memberships: ' +
@draft_list.league_memberships.collect{|m| m.toString}.join(", ");
end
if errorMessage.length == 0
@draft_list.destroy_preferences
@draft_list.destroy
end
respond_to do |format|
if errorMessage.length != 0
flash[:error] = errorMessage
end
format.html { redirect_to(draft_lists_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end",
"def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n format.html { redirect_to(checklists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @email_list = EmailList.find(params[:id])\n @email_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(email_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @action_list = ActionList.find(params[:id])\n @action_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @draft = SmsOnRails::Draft.find(params[:id])\n @draft.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_drafts_url) }\n format.xml { head :ok }\n end\n end",
"def delete(list_id)\n Iterable.request(conf, \"/lists/#{list_id}\").delete\n end",
"def destroy\n @book_list = BookList.find(params[:id])\n @book_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(book_lists_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @draft.destroy\n respond_to do |format|\n format.html { redirect_to drafts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_list = GroupList.find(params[:id])\n @group_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(group_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @wordlist = Wordlist.find(params[:id])\n @wordlist.destroy\n\n respond_to do |format|\n format.html { redirect_to(wordlists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @draft = Draft.find(params[:id])\n @draft.destroy\n\n respond_to do |format|\n format.html { redirect_to drafts_url }\n format.json { head :no_content }\n end\n end",
"def destroy1\n @draft = Draft.find(params[:id])\n @draft.destroy\n\n respond_to do |format|\n format.html { redirect_to(\n # @draft.compare_id , \n compare_path(:id => @draft.compare_id ),\n :notice => 'Draft was successfully deleted.'\n )\n }\n\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @draft = Draft.find(params[:id])\n @draft.destroy\n\n respond_to do |format|\n format.html { redirect_to drafts_url, notice: 'Черновик был успешно удалён' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mailee_list = Mailee::List.find(params[:id])\n @mailee_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(mailee_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @draft_investment = DraftInvestment.find(params[:id])\n @draft_investment.destroy\n\n respond_to do |format|\n\n format.xml { head :ok }\n end\n end",
"def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end",
"def delete_list(id)\n query(\"DELETE FROM todos WHERE list_id = $1\", id)\n query(\"DELETE FROM lists WHERE id = $1\", id)\n end",
"def destroy\n @mylist = Mylist.find(params[:id])\n @mylist.destroy\n\n respond_to do |format|\n format.html { redirect_to(mylists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @order_list = OrderList.find(params[:id])\n @order_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(order_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @data_list = DataList.find(params[:id])\n @data_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_lists_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end",
"def destroy\n\t\t@list = List.find(params[:id])\n\t\t@list.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html\t{ redirect_to(root_url) }\n\t\t\tformat.xml\t{ head :ok }\n\t\tend\n\tend",
"def destroy\n listentries = List.find(:all,:conditions => \"list_cat_id = #{params[:id]}\")\n for listentry in listentries \n listentry.destroy\n end\n @list_cat = ListCat.find(params[:id])\n @list_cat.destroy\n\n respond_to do |format|\n format.html { redirect_to(:controller => 'lists') }\n format.xml { head :ok }\n end\n end",
"def delete_list(user, list)\n delete(\"/#{user}/lists/#{list}.json\")\n end",
"def destroy\n @fwlist = Fwlist.find(params[:id])\n @fwlist.destroy\n\t\n respond_to do |format|\n format.html { redirect_to fwlists_url }\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 @mailinglist = Mailinglist.find(params[:id])\n @mailinglist.destroy\n\n respond_to do |format|\n format.html { redirect_to(mailinglists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n format.html { redirect_to checklists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document_status = DocumentStatus.find(params[:id])\n @document_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_document_statuses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @list = List.find(params[:id])\n @list.destroy\n flash[:notice] = \"List successfully deleted\"\n \n @lists = current_user.lists\n @feeds = current_user.feeds\n\n respond_to do |format|\n format.html { redirect_to(lists_url) }\n format.xml { head :ok }\n format.js {render :layout => false}\n end\n end",
"def destroy\n @document_list.destroy\n respond_to do |format|\n format.html { redirect_to document_lists_url, notice: 'Document list 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 delete_now\n revisions.each do |rev_id| \n CouchDB.delete( \"#{uri}?rev=#{rev_id}\" )\n end\n true \n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def destroy\n @draft.destroy\n respond_to do |format|\n format.html { redirect_to drafts_url, notice: 'Draft was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @draft.destroy\n respond_to do |format|\n format.html { redirect_to drafts_url, notice: 'Draft was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wish_list = WishList.find(params[:id])\n @wish_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_wish_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @saved_list.destroy\n respond_to do |format|\n format.html { redirect_to saved_lists_url, notice: \"Saved list was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @draft_company = DraftCompany.find(params[:id])\n @draft_company.destroy\n\n respond_to do |format|\n format.html { redirect_to(draft_companies_url) }\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 @check_list.destroy\n respond_to do |format|\n format.html { redirect_to check_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chore_list = ChoreList.find(params[:id])\n @chore_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(chore_lists_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n Checklist.find(params[:format]).destroy\n flash[:notice] = \"Delete successful\"\n redirect_to '/'\n end",
"def destroy\n @list = @project.lists.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to project_lists_url(@project) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dbs_deposit = DbsDeposit.find(params[:id])\n @dbs_deposit.destroy\n\n respond_to do |format|\n format.html { redirect_to(dbs_deposits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @page_title = \"Task List Delete\"\n @task_list = TaskList.find(params[:id])\n @task_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(task_lists_url) }\n format.xml { head :ok }\n end\n end",
"def delete_list(params={})\n @obj.delete('delete', @auth.merge(params))\n end",
"def destroy\n @thing_list = ThingList.find(params[:id])\n @thing_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(thing_lists_url) }\n format.xml { head :ok }\n end\n end",
"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 @reminder_task_list = ReminderTaskList.find(params[:id])\n @reminder_task_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(reminder_task_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @list_view = ListView.find(params[:id])\n @list_view.destroy\n\n respond_to do |format|\n format.html { redirect_to(list_views_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @office = Office.find(params[:id])\n @office.destroy\n\n respond_to do |format|\n format.html { redirect_to(offices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @army_list = ArmyList.find(params[:id])\n @army_list.destroy\n\n respond_to do |format|\n format.html { redirect_to :controller => :builder }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize! :delete, @ml_list\n @ml_list.destroy\n respond_to do |format|\n format.html { redirect_to ml_lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @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 :no_content }\n end\n end",
"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 :no_content }\n end\n end",
"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 :no_content }\n end\n end",
"def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @draft_partnership = DraftPartnership.find(params[:id])\n @draft_partnership.destroy\n\n respond_to do |format|\n format.html { redirect_to(draft_partnerships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @program_list= Programlist.find(params[:id])\n @program_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(programlists_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @whitelist = Whitelist.find(params[:id])\n @whitelist.destroy\n\n respond_to do |format|\n format.html { redirect_to(whitelists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lb202556 = Lb202556.find(params[:id])\n @lb202556.destroy\n\n respond_to do |format|\n format.html { redirect_to(lb202556s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @check_list.destroy\n respond_to do |format|\n format.html { redirect_to check_lists_url, notice: 'Чек-лист успешно удален.' }\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 list_types_url, notice: \"Check ya later list.\" }\n format.json { head :no_content }\n end\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def destroy\n @dump_list.destroy\n respond_to do |format|\n flash[:success] = 'Dump list was successfully destroyed.'\n format.html { redirect_to dumplist_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @definition.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(:back) }\n wants.xml { head :ok }\n end\n end",
"def destroy\n @feed_list.destroy\n respond_to do |format|\n format.html { redirect_to feed_lists_url, notice: 'Feed list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list_of_value = Irm::ListOfValue.find(params[:id])\n @list_of_value.destroy\n\n respond_to do |format|\n format.html { redirect_to(list_of_values_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @mail_list.destroy\n respond_to do |format|\n format.html { redirect_to admin_mail_lists_url, notice: 'Mail list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sent_list.destroy\n respond_to do |format|\n format.html { redirect_to sent_lists_url, notice: 'Sent list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @articy_draft.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wellist.destroy\n\n head :no_content\n end",
"def destroy\n @play_list = PlayList.find(params[:id])\n @play_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(play_lists_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n DB.exec(\"DELETE FROM stylists WHERE id = #{self.id};\")\n end",
"def destroy\n @check_list.destroy\n respond_to do |format|\n format.html { redirect_to check_lists_url, notice: \"Check list was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listitem.destroy\n head :no_content\nend",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy\n @email_list.destroy\n respond_to do |format|\n format.html { redirect_to email_lists_url, notice: 'Email list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word_list = WordList.find(params[:id])\n @word_list.destroy\n\n respond_to do |format|\n format.html { redirect_to word_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @app_list.app_resouces.destroy\n @app_list.destroy\n respond_to do |format|\n format.html { redirect_to app_lists_url }\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 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_rest\n @entry_item = EntryItem.find(params[:id])\n @entry_item.destroy\n\n respond_to do |format|\n #format.html { redirect_to(entry_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @blacklist = Blacklist.find(params[:id])\n @blacklist.destroy\n\n respond_to do |format|\n format.html { redirect_to(blacklists_url) }\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, notice: \"List was successfully destroyed.\" }\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, notice: 'List was successfully destroyed.' }\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, notice: 'List was successfully destroyed.' }\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, notice: 'List was successfully destroyed.' }\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, notice: 'List was successfully destroyed.' }\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, notice: 'List was successfully destroyed.' }\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, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.6686314",
"0.663948",
"0.66389483",
"0.65358526",
"0.6514827",
"0.6477018",
"0.6456549",
"0.64453",
"0.6440348",
"0.64037955",
"0.63965863",
"0.6386861",
"0.63488877",
"0.634262",
"0.6325674",
"0.6303573",
"0.6302348",
"0.630143",
"0.6289629",
"0.62745905",
"0.6265695",
"0.62650466",
"0.62594724",
"0.62400997",
"0.6227897",
"0.62180835",
"0.621685",
"0.6202684",
"0.6195054",
"0.6193689",
"0.6186036",
"0.61781013",
"0.6175358",
"0.6172094",
"0.6169889",
"0.6166884",
"0.61529434",
"0.6152254",
"0.615131",
"0.6147624",
"0.6141751",
"0.6141133",
"0.6137462",
"0.6137462",
"0.6137462",
"0.6132445",
"0.61161214",
"0.6115054",
"0.6110348",
"0.6103981",
"0.61015207",
"0.6096142",
"0.60912406",
"0.6078553",
"0.60761034",
"0.60750246",
"0.60727847",
"0.60701025",
"0.6066902",
"0.60656136",
"0.6057392",
"0.6057392",
"0.6057392",
"0.6056933",
"0.60516083",
"0.6050883",
"0.60471714",
"0.60463804",
"0.6030094",
"0.6020329",
"0.60164636",
"0.60134566",
"0.60134566",
"0.601147",
"0.6009852",
"0.6009097",
"0.6004561",
"0.59993726",
"0.5992003",
"0.5977896",
"0.59777683",
"0.59734654",
"0.5970603",
"0.59687364",
"0.5962549",
"0.5958541",
"0.59575707",
"0.5949281",
"0.5942983",
"0.5939839",
"0.59395653",
"0.5938421",
"0.5936224",
"0.59345764",
"0.5933318",
"0.5933318",
"0.5933318",
"0.5933318",
"0.5933318",
"0.5933318"
] | 0.6921329 | 0 |
There is a problem with test_removes_hyphens, still need to identify. | def test_removes_spaces
assert_equal(true,check_isbn_length("123 123 123 4"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_result(str)\n str.gsub(/- /, '-')\n end",
"def test_tablenames_with_hyphens\n end",
"def unhyphenate(string)\n string.to_s.gsub(/(pre|post)xfer/, '\\1-xfer')\nend",
"def fix_dash_dash(text); end",
"def __hyphen_\n while true # kleene\n\n begin # choice\n _tmp = apply(:_space)\n break if _tmp\n _tmp = apply(:_comment)\n end while false # end choice\n\n break unless _tmp\n end\n _tmp = true # end kleene\n set_failed_rule :__hyphen_ unless _tmp\n return _tmp\n end",
"def dashify\n strip.gsub(/[ \\/_~]/, '-').squeeze('-')\n end",
"def test_remove_punctuation_from_id\nresult = remove_punctuation(\"sha?wn\")\nassert_equal(\"shawn\", result)\t\nend",
"def dasherize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"-\").downcase)\n end",
"def cleanup(string)\n string.gsub!(/^--- $/, \"\")\n end",
"def __hyphen_\n while true\n\n _save1 = self.pos\n while true # choice\n _tmp = apply(:_space)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_comment)\n break if _tmp\n self.pos = _save1\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n set_failed_rule :__hyphen_ unless _tmp\n return _tmp\n end",
"def delete_harmful!\n harmful = [ Plaintext.soft_hyphen(encoding), UTF8_BOM ]\n local_copy.in_place :perl, \"s/#{harmful.join('//g; s/')}//g\"\n end",
"def slug_for(title)\n dasherized_title = title.downcase.gsub(/\\s+/, '-')\n characters_to_remove = /(\"|'|!|\\?|:)/\n dasherized_title.gsub(characters_to_remove, '')\nend",
"def test_remove_non_letter_character_from_id\nresult = remove_punctuation(\"sh&awn\")\nassert_equal(\"shawn\", result)\nend",
"def standardize\n # clean.delete(' ').delete('-').delete('.')\n clean.gsub(/[-\\s.#]/, '')\n end",
"def remove_negations\n\n logger(\"Removing negations in #{@prefix.compact.join(\" \").to_s}\")\n\n prefix_array_reduced = @prefix.compact.join(\" \").to_s.gsub(/[\\/\\*]\\s0\\s[A-Za-z1-9]+|-\\s((([1-9][0-9]*\\.?[0-9]*)|(\\.[0-9]+)|[A-Za-z]+))\\s\\1|[\\+-\\/\\*]\\s0\\s0|[\\/\\*]\\s[A-Za-z0-9]+\\s0/,\"0\").gsub(/\\/\\s([A-Za-z1-9])\\s\\1/,\"1\")\n\n logger(\"Reduced to #{prefix_array_reduced}\")\n\n @prefix = prefix_array_reduced.split\n prefix_array_reduced = prefix_array_reduced.split.join(\" \")\n\n if !/\\/\\s([A-Za-z1-9])\\s\\1|[\\/\\*]\\s0\\s[A-Za-z1-9]+|-\\s((([1-9][0-9]*\\.?[0-9]*)|(\\.[0-9]+)|[A-Za-z]+))\\s\\2|[\\+-\\/\\*]\\s0\\s0|[\\/\\*]\\s[A-Za-z0-9]+\\s0/.match(prefix_array_reduced).nil?\n remove_negations\n else\n if !/^-\\s[\\/\\*\\+-].*0$/.match(prefix_array_reduced).nil?\n prefix_array_reduced.slice!(0..1)\n prefix_array_reduced.slice!((prefix_array_reduced.length-2)..(prefix_array_reduced.length-1))\n end\n return prefix_array_reduced\n end\n\n end",
"def clean(name)\n name.gsub(/[^a-zA-Z0-9-]/, '-')\n end",
"def sanitize_data str\n str.to_s.strip.gsub(%r{^(-\\s)+}, \"\")\n end",
"def test_remove_dashes_spaces\r\n\t\tisbn_number = '123-4X67 890'\r\n\t\tassert_equal('1234X67890', remove_dashes_spaces(isbn_number))\r\n\tend",
"def fix_dash_dash(text)\n text.gsub(/—(?=\\S)/, '--')\n end",
"def clean_title(title)\n title.gsub(/[\\#=>\\d]|Papers We Love|PWL/, '').sub(/[-{1}]/, '').sub(/\\(part \\d?( of \\d?)?\\)/i, '').strip\nend",
"def clean_for_search(id)\n id.gsub(/[^\\w\\-]/, '')\n end",
"def __hyphen_\n while true\n\n _save1 = self.pos\n while true # choice\n _tmp = apply(:_space)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_comment)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_end_hyphen_of_hyphen_line)\n break if _tmp\n self.pos = _save1\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n set_failed_rule :__hyphen_ unless _tmp\n return _tmp\n end",
"def cleanup_id(url) # :nodoc:\n url.gsub(/(\\-{2,}|[\\W^-_]+)/, '-').gsub(/(\\A\\-|\\-\\Z)/, \"\").strip\n end",
"def trim_job_name(job_name)\n job_name = job_name.gsub('grid-', '');\n job_name = job_name.gsub('store-', '');\n job_name = job_name.gsub('sphere-', '');\n job_name = job_name.gsub('-public-deb', '');\n job_name = job_name.gsub('-private-deb', '');\n job_name = job_name.gsub('solr', 's');\n job_name = job_name.gsub('automation', 'am');\n job_name = job_name.gsub('webtests-production', 'wp');\n job_name = job_name.gsub('webtests-staging', 'ws');\n job_name = job_name.gsub('checkout', 'co');\n job_name = job_name.gsub('saucelabs', 'slabs');\n return job_name\nend",
"def test_String_007_remove_suffix\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_007_remove_suffix\")\n puts2(\"#######################\")\n \n sMyFile = \"some_long_filename.log\"\n puts2(\"\\nReturn the file name with the extension removed: \" + sMyFile)\n sMyFileSuffix = sMyFile.remove_suffix(\".\")\n puts2(\"File name extension: \" + sMyFileSuffix)\n #\n sMyEmailAddress = \"joe@gmail.net\"\n puts2(\"\\nReturn the User Account of the Email address: \" + sMyEmailAddress)\n sMyDomain = sMyEmailAddress.remove_suffix(\"@\")\n puts2(\"Domain: \" + sMyDomain)\n \n sMyString = \"This is a test\"\n puts2(\"\\nReturn the string with the last word removed: \" + sMyString)\n sMyLastWord = sMyString.remove_suffix(\" \")\n puts2(\"Last word: \" + sMyLastWord)\n \n sMyString = \" String with leading & trailing white space \"\n puts2(\"\\nReturn the string with the last word removed: \" + sMyString)\n sMyLastWord = sMyString.remove_suffix(\" \")\n puts2(\"Last word: \" + sMyLastWord)\n \n sMyString = \" No delimiter specified \"\n puts2(\"\\nReturn the whole String if: \" + sMyString)\n sMyLastWord = sMyString.remove_suffix(\"\")\n puts2(\"String: \" + sMyLastWord)\n \n sMyString = \" Multiple delimiter-characters that are in the specified string \"\n puts2(\"\\nReturn the string with the last word removed: \" + sMyString)\n sMyLastWord = sMyString.remove_suffix(\" #\")\n puts2(\"Last word: \" + sMyLastWord)\n \n sMyString = \" Delimiter character is NOT in the string \"\n puts2(\"\\nReturn the whole String if: \" + sMyString)\n sMyLastWord = sMyString.remove_suffix(\".\")\n puts2(\"String: \" + sMyLastWord)\n \n end",
"def slug\n self.downcase.gsub(\" \", \"-\").gsub(/[^0-9a-z\\-]/, '')\nend",
"def test_ignoring_accent\n end",
"def test_ignoring_accent\n end",
"def test_remove_space_end_of_id_space\nresult = remove_punctuation(\"shawn\")\nassert_equal(\"shawn\", result)\nend",
"def test_remove_special_characters_from_id\nresult = remove_punctuation(\"sh\\nawn\")\nassert_equal(\"shawn\", result)\nend",
"def undasherize(str)\n str.sub(/^-{1,2}/, '')\n end",
"def test_html5_data_attributes_without_hyphenation; skip # hyphenate\n assert_equal(\"<div data-author_id='123' data-biz='baz' data-foo='bar'></div>\\n\",\n render(\"%div{:data => {:author_id => 123, :foo => 'bar', :biz => 'baz'}}\",\n :hyphenate_data_attrs => false))\n\n assert_equal(\"<div data-one_plus_one='2'></div>\\n\",\n render(\"%div{:data => {:one_plus_one => 1+1}}\",\n :hyphenate_data_attrs => false))\n\n assert_equal(\"<div data-foo='Here's a \\\"quoteful\\\" string.'></div>\\n\",\n render(%{%div{:data => {:foo => %{Here's a \"quoteful\" string.}}}},\n :hyphenate_data_attrs => false)) #'\n end",
"def optionify\n output = self.apachify\n output = \"-#{output[3..-1]}\" if self.to_s[0..3] == 'not_'\n output\n end",
"def optionify\n output = self.apachify\n output = \"-#{output[3..-1]}\" if self.to_s[0..3] == 'not_'\n output\n end",
"def clean_slug!\n blank = \"\"\n separator = \"-\"\n self.slug = slug.downcase\n .gsub(/\\(|\\)|\\[|\\]\\./, blank)\n .gsub(/&/, blank)\n .gsub(/\\W|_|\\s|-+/, separator)\n .gsub(/^-+/, blank)\n .gsub(/-+$/, blank)\n .gsub(/--*/, separator)\n end",
"def dasherize(word)\n word.gsub(/_/,'-')\nend",
"def clean_id(id)\n if id != nil\n id.gsub!(/-|\\s|\\t/,'')\n id.downcase!\n end\n return id\n end",
"def test_remove_space_middle_of_id_space\nresult = remove_punctuation(\"sha wn\")\nassert_equal(\"shawn\", result)\nend",
"def test_clean_moviename_working\n @test = CinePassion.new\n \n assert_equal(@test.CleanMovieName(\"Home.DVDRip\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.LiMiTED\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.REPACK\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.720p\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.FRENCH\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.UNRATED\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.iNTERNAL\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.TRUEFRENCH\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.DVDRip.LiMiTED.REPACK.720p.FRENCH.UNRATED.iNTERNAL.TRUEFRENCH\"), \"Home\")\n assert_equal(@test.CleanMovieName(\"Home.TRUEFRENCH.iNTERNAL.UNRATED.FRENCH.720p.REPACK.LiMiTED.DVDRip\"), \"Home\")\n end",
"def test_neg_check_fail\n assert_equal neg_check(['0', '-1', '0']), false # return false\n assert_equal neg_check(['0', '0', '-1']), false # return false\n assert_equal neg_check(['0', '-9', '-9']), false # return false\n end",
"def negative_failure_message\n \"expected following text to not match selector #{@expected}:\\n#{@document}\"\n end",
"def handle_long_dash(string)\n words = string.split('--')\n @in_brackets ? close_brackets(words) : open_brackets(words)\n end",
"def test_clean_at_sign\n #assert false # bogus assert -- remove or comment out\n assert(@concordance.clean(\"test@@one@two\").eql?(\"test one two\"),\"Clean function not working properly\")\n end",
"def test_a_character_class_can_be_negated\n assert_equal 'the number is ', \"the number is 42\"[/[^0-9]+/]\n end",
"def scan_for_minus(token); end",
"def clean_url\n self.url = self.title.clone if self.url.blank?\n \n self.url.downcase!\n self.url = self.url.gsub(/[^[:alnum:]]/,'-').gsub(/-{2,}/,'-')\n self.url = self.url.gsub(/^[-]/,'').gsub(/[-]$/,'')\n self.url.strip!\n\n return true\n \tend",
"def _number_hyphen_base_hyphen_whole\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\"0\")\n break if _tmp\n self.pos = _save\n _tmp = scan(/\\A(?-mix:-?[1-9]\\d*)/)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_number_hyphen_base_hyphen_whole unless _tmp\n return _tmp\n end",
"def normalize_friendly_id(slug_str)\n super.gsub(\"-\", \"\")\n end",
"def negative_failure_message\n \"expected following text to not match selector #{@expected}:\\n#{@document}\"\n end",
"def negative_failure_message\n \"expected following text to not match selector #{@expected}:\\n#{@document}\"\n end",
"def clean_string(string)\n #string.to_s.gsub(/\\s+/, \"-\")\n\n string.parameterize \n end",
"def cleanup_new(string)\n string.tr(' -/:-@[-`{-~',' ')\nend",
"def normalize_friendly_id(string)\n super.delete(\"-\")\n end",
"def hide_all_ssns(string)\n string.gsub /\\d{3}-\\d{2}-/, \"XXX-XX-\"\nend",
"def test_sub_is_like_find_and_replace\n assert_equal 'one t-three', \"one two-three\".sub(/(t\\w*)/) { $1[0, 1] }\n end",
"def DISABLED_test_subtract_token\n assert_tokenises_as '-', SubtractOpToken.instance\n assert_tokenises_as ' -', SubtractOpToken.instance\n assert_tokenises_as ' - ', SubtractOpToken.instance\n end",
"def test_illegal_char\n\t\tassert_equal(\"877195GILL869x\", glosub(\"877195G IL--L869x\"))\n\tend",
"def sanitize_name(name)\n name.gsub(/\\//,\"\").gsub(/\\s/, \"-\").downcase\nend",
"def sanitize_result(result)\n result = result.downcase\n\n # many times, featured results, or additional producers are appended\n # to the result like so: (featuring beep and boop...)\n result = result.gsub(/[\\(\\)\\[\\]]/, \"\")\n\n # remove all [.'!&+] and replace them with \"\"\n result = result.gsub(/[.'!&+]/, \"\")\n\n # remove all - or _ and replace them with \" \"\n result = result.gsub(/[-_]/, \" \")\n\n # remove all blacklisted articles\n result = result.gsub(/\\b(#{BLACKLIST})\\b/, \"\")\n\n # replace multiple spaces with a single space\n result = result.gsub(/\\s+/, \" \").strip\n end",
"def DISABLED_test_integer_minus_sequence\n assert_tokenises_as '2-2', IntegerToken.new(2), SubtractOpToken.instance, IntegerToken.new(2)\n assert_tokenises_as '2--2', IntegerToken.new(2), SubtractOpToken.instance, IntegerToken.new(-2)\n end",
"def sanitized_title\n @sanitized_title ||= title.downcase.gsub(/[\\s\\x00\\/\\\\:\\*\\?\\\"<>\\|]+/, '-')\n end",
"def replace_dashes_with_hyphens(text)\t\t\t\n\ttext.gsub!(/(?<=[a-zA-Z])-(?=[a-zA-Z])/,'\\hyp ')\n\t\n\ttext.scan(/\\*\\*(.*?)\\*\\*/).each do |match|\n\t\tdamaged = match[0]\n\t\trepaired = damaged.gsub('\\hyp ','-')\n\t\ttext.gsub!(damaged,repaired)\n\tend\t\n\n\ttext.scan(/\\[\\[(.*?)\\]\\]/).each do |match|\n\t\tdamaged = match[0]\n\t\trepaired = damaged.gsub('\\hyp ','-')\n\t\ttext.gsub!(damaged,repaired)\n\tend\n\t\n\ttext.scan(/cite{(.*?)}/).each do |match|\n\t\tdamaged = match[0]\n\t\trepaired = damaged.gsub('\\hyp ','-')\n\t\ttext.gsub!(damaged,repaired)\n\tend\t\n\n\ttext\nend",
"def dasherize_number(num)\r\n nums = num.to_s.split('') #turns argument into a string and splits it into an array of single numbers. NOTE: '2' != 2\r\n nums.map! do |i| #Loop through nums .map! so you can change the orginal array\r\n if i.to_i.odd? == true # convert each iteration from string to integer, if its odd...\r\n i = \"-\"+ i # add a \"-\" before the number\r\n end\r\n i.to_s #leave it alone if its not odd and convert it back a string\r\n end#^^^\r\n\r\n if nums[0].to_i.odd? #this is to compensate for odd numbers at the beginning. \r\n nums[0].reverse! #example: [\"-3\",\"0\", \"-3\"] >> [\"3-\",\"0\", \"-3\"] \r\n end\r\n\r\nnums = nums.join('').split('') #converts [\"-3\",\"0\", \"-3\"] >> [\"3\", \"-\", \"0\", \"-\", \"3\"].\r\nnums.map! do |k| #loop through nums\r\n index = nums.index(k) #set index\r\n if nums[index] == \"-\" && nums[index+1] == \"-\" # checks to see if a dash is next to a dash\r\n nums.delete_at(index) #if so, delete it\r\n end\r\n k = k # otherwise leave k alone\r\n end\r\nreturn nums.join('') #return as a single string\r\nend",
"def space_replace_hyphen(call_number)\n return unless call_number\n general_normalization(call_number) do |cn|\n # dashes should be followed by spaces e.g. cd-10994\n # ls, cass, dat, cd, vcass, dvd\n cn = cn.sub(\"-\", \" \") if format_prefix?(cn)\n cn\n end\n end",
"def normalize_testcases(body, idx, decoder)\n prev = ''\n body.each do |l|\n if l[idx].empty?\n l[idx] = prev\n else\n if l[idx].strip.match(/^-+$/)\n l[idx] = :dont_care\n else\n l[idx] = decode(decoder, l[idx])\n end\n prev = l[idx]\n end\n end\n end",
"def test_regexp_number_negative\n @numbers.each do |value, expected|\n # add auto negative values\n value = value.is_a?(String) ? '-' + value : value * -1\n expected = expected == '0' ? expected : '-' + expected\n\n assert_equal expected, @TS_Regexp.format(value)\n end\n end",
"def words\n reject { |arg| arg.index('-') == 0 }\n end",
"def slugify(filename)\n filename.downcase.gsub(/[^0-9a-z]/i, '-')\nend",
"def hide_all_sins(string)\n string_test = \"\"\n string_test = string.scan(/\\d{3}-\\d{3}-\\d{3}/).join(\", \").gsub(/\\d{3}-\\d{3}-/, \"XXX-XXX-\") # => \"\"\n if string_test.empty? == false\n string_test\n else\n string\n end\nend",
"def cfn_safe(string)\n string.gsub(/[\\W_]/, '-')\n end",
"def slugize(text)\n text.downcase.strip.gsub(' ', '-').gsub(/[^\\w-]/, '')\nend",
"def test_exclusion_match_nocase\r\n\t\tcontent = \"first line.\\nthis string does not contain a case sensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"mymatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(0, match,\"case sensitive exclusion match on content didnt fire.\")\t\r\n\tend",
"def fix_subfield_demarcators(value)\n value.gsub(/\\|\\w{1}/,\"--\")\n end",
"def insert_hyphens(word)\r\n w = word.dup\r\n counter = 0\r\n previous_pos = 0\r\n @hyphenator.hyphenate(w).each do |pos|\r\n if pos != 0 && (w[pos.to_i + counter -1, 1] != '-') && (pos - previous_pos > 2)\r\n w[pos.to_i + counter, 0] = '|'\r\n counter += 1\r\n previous_pos = pos\r\n end\r\n end\r\n w\r\nend",
"def test_exclusion_match_nocase_no_match\r\n\t\tcontent = \"first line.\\nthis string does not contain a case insensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"some other string\"\r\n\t\tsnort_rule_content.nocase = true\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(0, match,\"nocase exclusion match on content didnt fire.\")\t\r\n\tend",
"def failure_message_when_negated\n actual = prettify_args(@actual)\n matcher = prettify_matcher(@metadata[:name])\n\n if @metadata[:args].count > 0\n args = prettify_args(*@metadata[:args])\n\n \"'#{actual}' should not #{matcher} '#{args}'\"\n else\n \"'#{actual}' should not #{matcher}\"\n end\n end",
"def sanitize_attr(attr)\n return attr.gsub(/[^a-zA-Z\\:\\_]/, '-')\n end",
"def clean_text(datacontent)\n return datacontent.gsub(/[^a-z0-9]/i, \"\").downcase\nend",
"def makeNegative(num)\n if(num.to_s.start_with?(\"-\"))\n return num\n else\n return -num\nend\nend",
"def test_normalize_works_with_non_roman_chars\n assert_equal \"検-索\", Slug::normalize(\"検 索\")\n end",
"def cleanup(str)\n # str.gsub!(/[^a-z]/, ' ').squeeze(' ')\n str.tr_s(' -/:-@[-`{-~', ' ')\nend",
"def negative?(string)\n true if string.start_with?('-')\nend",
"def replace_character_sequence_with_hyphen(string, mode: T.unsafe(nil)); end",
"def hyphen_absent?\r\n aba_routing_no_frm_db_with_hyphen = @micr_line_info.aba_routing_number.match(/[\\-]/)\r\n payer_account_no_frm_db_with_hyphen = @micr_line_info.payer_account_number.match(/[\\-]/)\r\n hyphen_absent = aba_routing_no_frm_db_with_hyphen == nil &&\r\n payer_account_no_frm_db_with_hyphen == nil\r\n end",
"def slug\n self.title.downcase.gsub(/\\s+/, '-').gsub(/[^a-z0-9_-]/, '').squeeze('-')\n end",
"def slug\n self.title.downcase.gsub(/\\s+/, '-').gsub(/[^a-z0-9_-]/, '').squeeze('-')\n end",
"def test_shortcut_character_classes_are_negated_with_capitals\n assert_equal \"the number is \", \"the number is 42\"[/\\D+/]\n assert_equal \"space:\", \"space: \\t\\n\"[/\\S+/]\n assert_equal \" = \", \"variable_1 = 42\"[/\\W+/]\n end",
"def repair(text); end",
"def test_exclusion_match\r\n\t\tcontent = \"first line.\\nthis string contains a case sensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect case sensitive exclusion match on content.\")\r\n\tend",
"def sanitize_label(label)\n label.gsub(%r![^a-z0-9_\\-.]!i, \"\")\n end",
"def dasherize(word)\n classify(word).to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"_\", \"-\").downcase\n end",
"def test_validate_reason_code_with_valid_special_characters_only\n reason_code1 = ReasonCode.new\n reason_code1.reason_code = \"-._\"\n reason_code1.save\n assert !reason_code1.valid?, reason_code1.errors.full_messages.to_s\n end",
"def _end_hyphen_of_hyphen_line\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\"\\\\r\\\\n\")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\\\n\")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\\\r\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_end_hyphen_of_hyphen_line unless _tmp\n return _tmp\n end",
"def scrub_input(instring)\n unless instring =~ /\\A[a-zA-Z0-9\\.\\-_]*\\z/\n puts \"#{instring} is an invalid attribute\"\n exit 1\n end\nend",
"def test_exclusion_match_nocase\r\n\t\tcontent = \"first line.\\nthis string contains a case insensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"mymatch123\"\r\n\t\tsnort_rule_content.nocase = true\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect nocase exclusion match on content.\")\r\n\tend",
"def failure_message_when_negated; end",
"def failure_message_when_negated; end",
"def failure_message_when_negated; end",
"def cleanup_isbn(isbn)\n return isbn.downcase.gsub(\"-\", \"\").gsub(\" \", \"\") #return statement is optional\n end",
"def remove_dash_and_number(variable)\n variable.sub(/-\\d/, \"\").strip\n end",
"def test_shortcut_character_classes_are_negated_with_capitals\n assert_equal 'the number is ', \"the number is 42\"[/\\D+/]\n assert_equal 'space:', \"space: \\t\\n\"[/\\S+/]\n # ... a programmer would most likely do\n assert_equal ' = ', \"variable_1 = 42\"[/[^a-zA-Z0-9_]+/]\n assert_equal ' = ', \"variable_1 = 42\"[/\\W+/]\n end"
] | [
"0.643038",
"0.6262071",
"0.6161886",
"0.61124504",
"0.6020855",
"0.5934467",
"0.58910143",
"0.5854226",
"0.58385634",
"0.58158493",
"0.579575",
"0.57797027",
"0.5774522",
"0.57717985",
"0.5751172",
"0.57336986",
"0.5732711",
"0.57112056",
"0.5694054",
"0.56866884",
"0.5685706",
"0.5681517",
"0.5676634",
"0.56657964",
"0.5665571",
"0.5600068",
"0.55827147",
"0.55827147",
"0.5574392",
"0.5573382",
"0.5568564",
"0.55529124",
"0.5543516",
"0.5543516",
"0.5541829",
"0.553573",
"0.5529691",
"0.5526679",
"0.55187696",
"0.5476902",
"0.54700863",
"0.54693556",
"0.54258627",
"0.5414376",
"0.5412457",
"0.5410191",
"0.54080987",
"0.54074323",
"0.5402813",
"0.5402813",
"0.5401608",
"0.53994375",
"0.53990513",
"0.5395874",
"0.53954935",
"0.5389943",
"0.5375573",
"0.5356171",
"0.53529155",
"0.5352795",
"0.53448635",
"0.53447735",
"0.53438956",
"0.5336063",
"0.53348875",
"0.53332967",
"0.53219146",
"0.5319813",
"0.5317225",
"0.53058934",
"0.529928",
"0.5296112",
"0.52885497",
"0.52857333",
"0.527455",
"0.52738905",
"0.525521",
"0.5254396",
"0.5249319",
"0.5247608",
"0.52455026",
"0.52453154",
"0.5224967",
"0.5206793",
"0.520464",
"0.520464",
"0.52042884",
"0.52023333",
"0.5196838",
"0.51920795",
"0.5186827",
"0.51714915",
"0.5171436",
"0.5170962",
"0.5159765",
"0.51571524",
"0.51571524",
"0.51571524",
"0.51569074",
"0.51545316",
"0.5153975"
] | 0.0 | -1 |
if target is _, returns false if we've guessed the word's char already if target is az, returns false if our word has a different char | def char_valid?(char, guesses, target)
if target == '_'
return !guesses.include?(char)
end
char == target
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_a_letter?(guess)\n return true if @word.include?(guess)\n return false\n end",
"def check_winner\n @word.downcase.chars == @guess\n end",
"def guessed?\n \t(word.split('') - selected_letters).empty?\n\tend",
"def win?\n if word_guessed.select{|x| x!=\"_ \"}.count == @word.length\n \t\treturn true\n \telse\n \t\tfalse\n \tend\n end",
"def check_guess\n\t\t@word.include?(@guess)\n\n\tend",
"def check_if_correct(word, letter)\n if word.include?(letter)\n index = word.index(letter)\n word[index] = '' # Clear the letter from word so it can check for other instances of letter\n @hints[index] = letter\n check_if_correct(word, letter) # It will loop through every instace of letter on word\n elsif !@hints.include?(letter)\n @incorrect.push(letter) unless @incorrect.include?(letter)\n @lives += 1\n end\n end",
"def check_word(guess)\n\t\tguess_used = false\n\t\t@guess_history.each do |x|\n\t\t\t\tif x == guess\n\t\t\t\t\tguess_used = true\n\t\t\t\tend\n\t\t\tend\n\t\tif !guess_used\n\t\t\t@guess_count += 1\n\t\t\t@guess_history << guess\n\t\tend\n\t\tif guess == @target_word\n\t\t\t@win = true\n\t\t\t@is_over = true\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def win?\n @correct_letters.join == @secret_word\n end",
"def correct?(word)\n if @word == word\n @guessed_correctly = true\n return true\n end\n false\n end",
"def check_guess(word, guess)\n if word.include? guess\n @correct_guess = true\n\n elsif !word.include? guess\n @correct_guess = false\n end\nend",
"def guess(letter)\n is_letter = /^[a-zA-Z]$/\n if letter.nil? or letter.empty? or not letter.match(is_letter)\n throw ArgumentError \n end\n letter.downcase!\n if self.guesses.include? letter or self.wrong_guesses.include? letter\n return false\n end\n if self.word.include? letter\n self.guesses = self.guesses + letter\n else\n self.wrong_guesses = self.wrong_guesses + letter\n end\n return true\n end",
"def guess?(letter)\n if !self_is_letter?(letter)\n puts \"Not a letter!\"\n return false\n end\n if @word.include? letter\n if(@word.count(letter) > 1)\n while(@word.include? letter)\n puts \"Hit this while loop\"\n index = @word.index(letter)\n @word.slice!(index,0)\n @word[index] = '_'\n\n puts \"Word\" + @word\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n end\n else\n index = @word.index(letter)\n\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n\n\n end\n\n\n output_word()\n return true\n end\n p \"Word does not contain #{letter}\"\n @health -= 1\n p \"you have #{@health} tries left\"\n return false\n end",
"def check_within(guess)\n\t\t@target_word.include? guess\n\tend",
"def valid_word_guess?(guess)\n if !guess.match?(/\\A([a-z]|[-]|\\d){2,}\\z/) \n puts \"Not a legal word guess! Guess again.\"\n return false\n elsif @incorrect_guesses.include?(guess) || @correct_guesses.include?(guess)\n puts \"You already guessed that word. Guess again.\\n\\n\"\n return false\n else\n return true\n end\n end",
"def guess!(letter)\n self.word.include? letter\n self.letter = letter\n end",
"def fail_letter?(letter)\n return @secret_word.include?(letter) ? false : letter\n end",
"def check_player_words(player_guess_word)\n word.chomp.chars.each_with_index{\n |item, index|\n if item == player_guess_word.chomp.chars[index].to_s # exactly equal and in the same postion\n result = \"Exact\"\n elsif word.chomp.include?(player_guess_word.chars[index].to_s) # just includes the letter\n result = \"Near\"\n else # other condition that either not exact nor includes is.\n result = \"Miss\"\n end\n sleep(SLEEP_TIME) # just stop for a time make a good user experience\n puts \"Letter: #{player_guess_word.chars[index]} : #{result}\"\n }\n end",
"def guess? (letter)\n \t\tif word.include?(letter)==true\n \t\tvalid_guess(letter)\n \telse\n \t\tinvalid_guess(letter)\n \tend\n end",
"def letter_test(letter)\n # If it is in the word pass it to find_locations(), if not pass it to wrong_letter()\n $word.include?(letter) ? find_locations(letter) : wrong_letter(letter)\nend",
"def guess(char)\n if char==''||!(char=~/[A-Za-z]/)\n raise ArgumentError\n else\n char = char.downcase\n if @guesses.include?(char)||@wrong_guesses.include?(char)\n return false\n else\n if @word.include?(char)\n @guesses+=char\n for i in 0..@word.length-1\n if @word[i]==char\n @word_with_guesses[i]=char\n end\n end\n if !@word_with_guesses.include?('-')\n @check_win_or_lose=:win\n end\n else\n @wrong_guesses+=char\n if @wrong_guesses.length>=7\n @check_win_or_lose=:lose\n end\n end\n return true\n end\n end\n end",
"def check_choice\n @word.downcase.include?(@letter)\n end",
"def is_win?\n @matched_letters == @secret_word ? true : false\n end",
"def include?(letter)\n @guess_spaces +=1\n guessed_letter << letter\n if @real_word.include?(letter)\n letter_index = 0\n @real_word.each_char do |l|\n @guess_word[letter_index] = l if \n l == letter\n letter_index += 1\n end\n return true\n else\n return false\n end\n end",
"def\tgood_guess?(g)\n\t\t@word_array.include?(g)\n\tend",
"def\tgood_guess?(g)\n\t\t@word_array.include?(g)\n\tend",
"def winner?\n if @real_word == @guess_word\n return true\n else\n return false\n end\n end",
"def guessed_wrong_letter()\n if $hidden_word_arr.exclude?($input)\n $guessed.append($input)\n end\n end",
"def already_guessed? (letter)\r\n letter = letter.downcase\r\n @guessed_letters.include? letter\r\n end",
"def guessed_all_correct?\n @displayed_character.all? { |char| char != '_' }\n end",
"def all_letters_guessed?\n @word_to_guess.each do |letter_in_word_to_guess|\n if !has_been_guessed_correctly?(letter_in_word_to_guess)\n return false\n end\n end\n return true\n end",
"def check_guess\n @guess_count += 1 # Increment guess count\n @guess_feedback = \"\"\n return true if @input == @current_word # Return true value if input is same as chosen word - correctly guessed word\n i = 0\n @input.split('').each do |letter| # Split user input and check if each letter is in exact position as chosen word, or if it is somewhere or not in the word at all\n # Use << to append to string as this is faster and doesn't create new string objects, as opposed to concatenation using a +\n # Below line uses nested ternary operators, where the condition is first evaluated and then if true, the first statement is executed, if false, the second statement is executed\n # This allows the code to be more readable and shorter\n @current_word.index(letter) == i ? (@guess_feedback << \"exact \") : (@current_word.index(letter).nil? ? (@guess_feedback << \"miss \") : (@guess_feedback << \"near \"))\n i += 1\n end\n puts @guess_feedback\n end",
"def letter_in_word?(letter)\n end",
"def good_guess?\n @code_word.include?(@word_guesser.guess)\n end",
"def mutation?(base_word, mutation)\n x = mutation.split('')\n x.each do |letter|\n if base_word.include?(letter)\n @answer = true\n else \n @answer = false\n break\n end\n end \n @answer\nend",
"def is_guessed?()\n return false if @ingame_word.include?(' ')\n return true\n end",
"def guess char\n #get 1st char\n \n if char.nil?\n raise ArgumentError, 'Argument is not string' \n return false\n end\n if char.length != 1\n raise ArgumentError, 'Argument is not string'\n return false\n end \n if char.match(/[a-zA-Z]/) == nil\n raise ArgumentError, 'Argument is not string' \n return false\n end\n \n pick = char.chr.downcase\n\n #catch replicant entries\n if @guesses.match(\"#{pick}\") != nil\n # @word_with_guesses << \"You have already used that letter\"\n return false\n end \n \n if @wrong_guesses.match(\"#{pick}\") != nil\n# @word_with_guesses << \"You have already used that letter\"\n return false\n end \n \n #actual match\n if @word.match(\"#{pick}\") != nil\n guesses << pick # 1st char\n else\n wrong_guesses << pick # \n @attempt += 1\n end\n \n # build up guess string i.e. \"----a-e\"\n @word_with_guesses = '';\n @check_win_or_lose = :win\n word.each_char { |a|\n if @guesses.match(\"#{a}\") != nil \n @word_with_guesses << a\n else\n @word_with_guesses << '-'\n @check_win_or_lose = :play\n end\n }\n \n #check game status\n if @attempt > 6\n @check_win_or_lose = :lose\n end\n \n return true\n end",
"def check_letter_in_random_word(guess_letter)\n position_letter = 0\n @correct_guess = false\n @random_word.each_char do |letter_random_word|\n if letter_random_word == guess_letter\n change_guess_word_status(position_letter)\n @correct_guess = true\n end\n position_letter += 1\n end\n if @correct_guess == true\n line_of_30_stars\n puts \"WhoopWhoop: Letter '#{guess_letter}' is in the word!\\n\"\n else\n line_of_30_stars\n puts \"No, sorry, '#{guess_letter}' isn't in the word.\"\n end\n end",
"def guessed_all_correct?\n if self.output == self.word \n puts \"You have guessed the word\"\n end\n end",
"def check_guess(word, char)\n if word.downcase.include?(char.downcase) && AVAILABLE_LETTERS.include?(char.downcase)\n AVAILABLE_LETTERS.delete(char.downcase)\n else\n AVAILABLE_LETTERS.delete(char.downcase)\n $incorrect_guesses += 1\n end\n puts display_word(word)\nend",
"def word_has?(letter)\r\n @word.include?(letter)\r\n end",
"def correct_guess?(letter)\n if @word_selected.include?(letter)\n if @correct_guesses.empty?\n @correct_guesses << letter\n elsif @correct_guesses.include?(letter)\n puts 'Letter already guessed! try another one!'\n else\n @correct_guesses << letter\n end\n return true\n end\n false\n end",
"def check_guess(player_guess, display)\n letter_found = false\n @secret_word.chars.each_with_index do |char, index|\n if char.downcase == player_guess\n display[index] = char\n letter_found = true\n end\n end\n letter_found\n end",
"def extra_letter( dict_word, word )\n\n\tnum = word.length - 1\n\n\t# Remove a letter from the test word to see if a match results\n\tnum.times do |i|\n\n\t\ttest_word = word[0, i+1] + word[i+2, num]\n\n\t\t# Match made\n\t\treturn true if @dictionary[test_word]\t\n\tend\n\n\t# No match found\n\treturn false\nend",
"def player_won?\n unless @display_content.include?(\"_\")\n puts \"You found the correct word!\"\n true\n end\n end",
"def good_guess?\n current_guess == \"save\" || current_guess == secret_word || current_guess.length == 1\n end",
"def word_has?(letter)\n @word.include? letter\n end",
"def test_guess_passes_letter\n\t\tword = \"hello\"\n\t\tchar = \"e\"\n\t\th= Hangman.new(word)\n\t\tassert_equal true, h.guess?(char)\n\tend",
"def check_word(str, word)\n if str == word\n puts \"Congratulations! You guessed my word correctly!\" \n @game_is_over = true\n else\n false\n end\t\n end",
"def check_phrase guess\r\n\t\t\t\t\t\t\t\tif guess == @secretword\r\n\t\t\t\t\t\t\t\t\tincement_score\r\n\t\t\t\t\t\t\t\t\t@win = true\r\n\t\t\t\t\t\t\t\t\treturn true\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\treturn false\r\n\t\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\tend",
"def check_word(word, rack)\n if rack.include?(\"?\") ? blank_tile = true : blank_tile = false\n end\n # Make a copy of rack to use to change values.\n rack_copy = rack.clone\n # result equals true and only goes false if a letter from rack isn't in the word\n result = true\n word.chars do |letter|\n if rack_copy.include?(letter)\n # Find the first instance of letter by its index and delete it at index.\n # This must be down to avoid .include? returning true on a letter multiple\n # times\n rack_copy.delete_at(rack_copy.index(letter))\n # If the letter isn't in rack but theres a blank tile then go back to start\n # of loop\n elsif blank_tile\n # change to false to avoid using blank tile more than once\n blank_tile = false\n # if the letter doesn't exist than turn result to false and break loop\n else\n result = false\n break\n end\n end\n result\nend",
"def word_has?(letter)\n @word.include?(letter)\n end",
"def word_test()\n if $build_word.join == $word # if $build_word equals $word, the user won\n $game_over = true # set the flag to indicate that the game is over\n $game_won = true # set the flag to indicate that the player won the game\n $games_won += 1 # so increase the games_won score by 1\n else # if they don't match, run user_input() for another letter\n $prompt = \"Good job - that letter was in the word. Please guess again!\"\n end\nend",
"def check_word(word)\n letters = make_letter_array(@tiles)\n w = word.split(\"\")\n for letter in w\n if letters.index(letter)\n letters[letters.index(letter)] = nil\n letters.compact!\n else\n return false\n end\n end\n return true\n end",
"def guessed_all_correct?\n if !@guessedWord.include? '_'\n p \"You guessed them all correctly! YOU WIN!\"\n return true\n end\n\n return false\n end",
"def guess?(letter)\n correct = false\n @@secret.length.times do |i|\n if (@@secret[i] == letter && @@progress[i] == '_')\n @@progress[i] = letter\n correct = true\n end\n end\n @@incorrect << letter if !correct\n @@guesses += 1\n puts(\"secret: #{@@secret}\")\n correct\n end",
"def danglers?\n !valid_word?(@str[@first_letter..@last_letter]) && @last_letter == @str.length && @words.join.length < @str.length\n end",
"def hard_to_pronounce?\n word = last_epithet.downcase\n word.gsub!(/(ou|ii|ae|au|ei|eu|oe)/, '_')\n word.gsub!(/(sch|[cptzsg]h|[ct]r|t[sz])/, '@')\n word.gsub!(/([^aeiouy_])\\1/, '@')\n return true if word =~ /[aeiou_]{4}/ || word =~ /[aeiou_]{3}y($|[^aeiou_])/\n return true if word =~ /[^aeiouy_]{4}/\n false\n end",
"def guess_correct(letter)\n\t\tif @secret_word.include?(letter)\n\t\t\t@secret_word.each_with_index do |correct, index|\n\t\t\tif letter == correct\n\t\t\t\t@display[2*index+1] = letter\n\t\t\t\tputs @display\n\t\t\t\t@attempted_letters << letter\n\t\t\t\tend\n\t\t\tend\n\t\t\t@number_of_guesses -= 1\n\t\t\treturn true\n\t\telse \n\t\t\treturn false\n\t\tend \n\tend",
"def guesses_include_in?(letter)\n #puts @word\n word = @word.split(\"\")\n guessChar = @guesses.split(\"\")\n #puts \"***guesses_include_in? #{word} #{guessChar}\"\n word.each do |w|\n guessChar.each do |g|\n #puts \"w == g && g == letter\"\n #puts \"#{w} == #{g} && #{g} == #{letter} ==> #{w == g && g == letter}\"\n if w == g && g == letter\n return true\n else\n #return false\n end\n end\n\n end\n return false\nend",
"def correct(word)\n end",
"def check_guess(letter)\n\t\t# If the guessed letter is in the word, replace \"_\" in the guess variable with the letter in the right spot\n\t\t@word.each_with_index do |l, i|\n\t\t\tif l == letter\n\t\t\t\t@guess[i] = letter\n\t\t\tend\n\t\tend\n\t\t# If the guessed word and the answer are the same, the user won!\n\t\t# Show message and if the game was previously saved, delete it\n\t\tif @word.join == @guess\n\t\t\tputs \n\t\t\tshow_board\n\t\t\tputs \"You won!!\"\n\t\t\tif @running_saved_game != nil\n\t\t\t\tover_write_data\n\t\t\tend\n\t\t\tgo_again\n\t\t# Got a letter but didn't win. Get another guess\n\t\telsif @word.include?(letter)\n\t\t\tputs\n\t\t\tputs \"You got a letter!\"\n\t\t\tget_guess\n\t\t# Letter wasn't in word, put letter in missed letter variable and guess again\n\t\telse\n\t\t\tputs \n\t\t\tputs \"No #{letter}'s.\"\n\t\t\t@wrong_letters.sub!(\"_\", letter)\n\t\t\t@turn += 1\n\t\t\tget_guess\n\t\tend\n\tend",
"def makes_word (base, word)\n\ttemp = base.dup\n\tword.chars.each do |char|\n\t\tif base[char]\n\t\t\ttemp.sub!(char, '')\n\t\telse \n\t\t\treturn false\n\t\tend\n\tend\n\ttrue\nend",
"def uses_available_letters?(input, letter_in_hand)\n hand_copy = letter_in_hand.clone\n input.upcase.split(\"\").each do |letter|\n if hand_copy.include?(letter)\n hand_copy.delete_at(hand_copy.index(letter))\n else\n return false\n end\n end\n return true\nend",
"def correct word\n known [word] or known(variation_words word) or [word]\n end",
"def mutation?(base_word, mutation)\n\n word1_array = base_word.downcase.split(\"\")\n word2_array = mutation.downcase.split(\"\")\n\n word2_array.each do |letter|\n if word1_array.include?(letter)\n @result = true\n else\n @result = false\n end \n end\n @result\nend",
"def guess?(letter)\n if @guessed_letter.include?(letter)\n puts \"You already guessed that letter!\"\n return\n end\n @guessed_letter << letter\n \n found = false\n if @characters.include?(letter)\n found = true \n puts \"Yes that letter is in the word!\"\n else\n puts \"Wrong answer!\"\n end \n \n @characters.each_with_index do |char, index|\n if char == letter\n @displayed_character[index] = letter\n end\n end\n found\n end",
"def second_anagram?(str, target)\n # debugger\n str.each_char do |char|\n target_idx = target.index(char) \n target[target_idx] = \"\" if target_idx != nil\n end\n\n target.length == 0\nend",
"def check_word(letter)\n i = 0\n @secret_word.each_char do |char|\n if char == letter\n @display_word[i] = letter\n end\n i += 2 ##because in display word after each letter or underscore there is a space\n end\n return @display_word\n end",
"def whole_word_guess(input,dead_man)\n guessed_word_array = input.split(//)\n if guessed_word_array == @correct_word_array\n win\n else\n puts \"The word you have guessed is incorrect!\"\n dead_man.wrong_guesses += 1\n display(dead_man) \n end\n end",
"def guess(letters)\n raise ArgumentError if letters == \"\"\n raise ArgumentError if letters !~ %r{\\w}\n letters.downcase!\n if @word.include?(letters) \n !@guesses.include?(letters) ? @guesses << letters : false\n\n else\n @wrong_guesses.include?(letters) ? false : wrong_guesses << letters \n end\n end",
"def letter_guess(input,dead_man)\n if @letters_guessed_array.include?(input) || dead_man.wrong_letters.include?(input)\n puts \"You have already guessed this letter!\"\n display(dead_man)\n elsif @correct_word_array.include?(input)\n @letters_guessed_array.each_with_index do |letter, index|\n @letters_guessed_array[index] = input if @correct_word_array[index] == input\n end\n puts \"The letter #{input} is in the word.\"\n if @letters_guessed_array.include?(\"__\")\n display(dead_man)\n else\n win\n end\n else\n puts \"The letter #{input} is not in the word.\"\n dead_man.wrong_letters.push(input)\n dead_man.wrong_guesses += 1\n display(dead_man)\n end\n end",
"def check_guessed_letter(word,letter,available_letters)\n\n\tif word.include?(letter)\n\t\treturn 0\n\telsif !available_letters.include?(letter)\n\t\treturn 0\n\telse\n\t\t$missed_letters.push(letter)\n\t\treturn -1\n\tend\nend",
"def test_index word, guess, index\r\n (word[index] == guess)? \"!\" : \"?\" #if the indexes match it means outputs a \"!\", else it means the letter exists in the word but not in that exact index and outputs a \"?\" \r\nend",
"def current_word\n #for each char in the word, either fill it in if its guessed or replace with '_'\n my_word = \"\"\n word.each_char do |c|\n if guesses.include? c\n my_word << c\n else\n my_word << \"_\"\n end\n end\n my_word\n\n end",
"def check_for_matches(input)\n @matched = false\n secret_word_array = @secret_word.split(\"\")\n\n secret_word_array.each_with_index do |char, idx|\n if char == input || char == input.upcase\n @matched_letters.insert(idx, char).slice!(idx+1)\n @matched = true\n end\n end\n\n if !@matched\n @guesses_left -= 1\n @misses += \", \" unless @misses == \"\"\n @misses += input\n end\n end",
"def game_over()\n if $hidden_word_arr.exclude?(\"_\")\n puts \"You win the game! Well done!\"\n $end_game = true\n elsif $turns == 0\n puts \"It looks like you weren't able to guess the right letters. The word was #{$word}. Better luck next time!\"\n $end_game = true\n end\n end",
"def check_guess(guess)\n # checks human guess, displays discovered, and return if letter found\n letter_found = false\n self.secret_word.split('').each_with_index do |chr, ind|\n if chr == guess\n self.currently_discovered[ind] = chr\n letter_found = true\n end\n end\n p self.currently_discovered\n letter_found\n end",
"def check_guess\n if current_guess == secret_word\n player_won?\n else\n if secret_word.include? current_guess\n show_letter\n puts \"This word includes the guessed letter\\n\\n\"\n elsif current_guess == \"save\"\n create_save\n puts \"Game saved! Exiting game!\"\n exit\n else\n show_letter\n puts \"This word does not include the guessed letter\\n\\n\"\n end\n end\n end",
"def secret_word_guessed?\n\t\t@secret_word.split(\"\").all? { |letter| @guessed_letters.include?(letter) }\n\tend",
"def letter_match?(letter)\n if @secret.include?(letter)\n return true; end\n return false\n end",
"def check_letter(input_letter)\n # Each time we check, the number of guesses is increased \n @guess_count += 1\n \n # Transform the words into arrays for convenience\n arr_word_to_guess = @word_to_guess.split('') \n arr_guessed_word = @guessed_word.split('') \n \n # Search for the input_letter in arr_word_to_guess\n index_found = arr_word_to_guess.each_index.select{|i| arr_word_to_guess[i] == input_letter}\n \n if (index_found == []) then\n return false \n else \n # if the letter is found, update the guessed word\n n_found = index_found.size\n i = 0 \n n_found.times do \n arr_guessed_word[index_found[i]] = input_letter\n i += 1\n end\n @guessed_word = arr_guessed_word.join('')\n return true\n end \n end",
"def is_word_complete()\n !@current_state.include? \"_\"\n end",
"def valid_guess?(letter)\n letter.length==1 && (\"a\"..\"z\").include?(letter)\n end",
"def check_word(word)\n if self.player.word_list.include?(word)\n puts \"Already found that one!\"\n elsif word.length < 4\n puts \"That word is too short. Words must be 4 letters or longer.\"\n elsif word.chars.include?(self.board.inner_letter) == false\n puts \"Missing center letter.\"\n elsif self.board.word_list.include?(word)\n #get points total for word\n points = self.board.get_word_value(word)\n self.player.add_points(points)\n #adds word to wordlist\n self.player.add_word(word)\n if self.board.pangram?(word)\n puts \"🐝 PANGRAM FOUND 🐝\"\n puts \"The bees are pleased. #{points} added to your score.\"\n else\n puts \"#{self.nice_messages.sample} #{points} point#{\"s\" if points > 1} added to your score.\"\n end\n self.player.display_total\n else\n puts \"Not in word list :(\"\n end\n end",
"def cap?(word)\n\t\treturn true if !$dont_cap.include?(word)\n\tend",
"def check_letter(user_guess)\n @letter = user_guess.length == 1\n end",
"def preposition?(word)\n word.size == PREPOSITION_SIZE && # exactly 5 chars\n !FOO_LETTERS.include?(word[4]) && # The last letter should be included in BAR LETTER group\n !word.include?(\"l\") # The word can't include the letter \"l\"\n end",
"def words_the_same?(word_to_test)\n word_to_test.downcase == @word.downcase\n end",
"def letter_check(letter)\n @word.chars.each_with_index do |letter_in_word, index|\n if letter == letter_in_word\n @result_str[index] = letter\n end\n end\n if !@word.include?(letter)\n puts \"Sorry try again\"\n end\n @result_str\n end",
"def guessed_word(word)\n\t\tif @ans_word == word\n\t\t\tputs \"You are a genious\"\n\t\telse\n\t\t\tputs \"guess again\"\n\t\t\t@guess_word.pop\n\t\tend\n\tend",
"def is_good?(letter)\n @letters.include?(letter)\n end",
"def check_word(guess)\r\n\r\n\t\tif @secret_word.include? (guess)\r\n\t\t\t@word_include = true \r\n\t\t\tif @word_include == true \r\n\t\t\t @secret_word.each_index do |idx|\r\n\t\t\t\t if @secret_word[idx] == guess \r\n\t\t\t\t\t @guess_word[idx] = guess \r\n\t\t\t\t\tend \r\n\t\t\t\tend\r\n\t\t\t\tanswer_update\r\n\t\t\t\tcheck_win \r\n \tend \t\t\r\n\t\telse \r\n\t\t\tfalse \r\n\t\t\t@num_guess -= 1 \r\n\t\t\tputs \"Wrong guess. Try again!\"\r\n\t\tend \r\n\tend",
"def guess_letter(a_letter)\n p a_letter.downcase\n @word.split(\"\").each_with_index do |another_letter, index|\n if a_letter == another_letter\n @input_word[index] = a_letter\n puts \"Correct! Here are your guesses so far\"\n p @input_word\n end\n if !@word.include? (a_letter)\n end\n end\n end",
"def is_word?(word)\r\n word = word.downcase\r\n word.each_char { |c| return false if not is_letter?(c) }\r\n !word.empty?\r\n end",
"def valid_word?(word)\n # Cleaner implementation, but less readable\n # (word.empty? && @is_complete_word) || (@sub_tries.key?(word[0]) &&\n # @sub_tries[word[0]].valid_word?(word[1..-1]))\n\n # TODO: Find a way to refactor this such that it looks cleaner while remaining readable\n if word.empty?\n @is_complete_word\n elsif @sub_tries.key?(word[0])\n @sub_tries[word[0]].valid_word?(word[1..-1])\n else\n false\n end\n end",
"def guess(input,dead_man)\n input.upcase!\n if input.length == 1\n letter_guess(input,dead_man) \n else\n whole_word_guess(input,dead_man)\n end\n end",
"def win?\n\t\t@placeholder == @secret_word\n\tend",
"def valid_guess?(letter_guess)\n (letter_guess.length == 1 && !letter_guess.match(/[^A-Za-z]/) && !@guesses.include?(letter_guess)) ? true : false\n end",
"def guess_letter(letter)\n won = false\n failed_guess = feedback(letter)\n if failed_guess\n @tries_left -= 1\n else\n won = won?(@display_word.split(\" \").join(\"\"))\n end\n won\n end",
"def is_repeated?(test)\n flag = false\n @guesses == test || @wrong_guesses == test ? flag = true : flag = false\n #puts \"@guesses == test || @wrong_guesses == test #{@guesses == test || @wrong_guesses == test}\"\n\n if flag\n return flag\n else\n #puts @word\n word = @word.split(\"\")\n #puts word\n guessChar = @guesses.split(\"\")\n word.each { |x|\n if word.include?(guessChar)\n flag = true\n return flag\n end\n }\n\n end\n return flag\n end"
] | [
"0.7235492",
"0.71536624",
"0.70810634",
"0.70719945",
"0.6917247",
"0.6909202",
"0.68957025",
"0.6866008",
"0.6855387",
"0.6817434",
"0.68087834",
"0.68041897",
"0.67244977",
"0.6707401",
"0.666795",
"0.6667471",
"0.666238",
"0.6646481",
"0.66432536",
"0.66403455",
"0.66262984",
"0.6615949",
"0.66017264",
"0.65989137",
"0.65989137",
"0.65955216",
"0.6585235",
"0.65752167",
"0.65704006",
"0.6556453",
"0.655436",
"0.6549909",
"0.65373814",
"0.6537003",
"0.65156865",
"0.65028983",
"0.649979",
"0.6493455",
"0.6473161",
"0.64615506",
"0.64599806",
"0.6458633",
"0.64271635",
"0.6424761",
"0.6418751",
"0.6416015",
"0.6400166",
"0.639763",
"0.63952786",
"0.6394918",
"0.63934284",
"0.63930005",
"0.6364271",
"0.6357932",
"0.6357276",
"0.6347878",
"0.63407964",
"0.63331276",
"0.6332883",
"0.632638",
"0.6312782",
"0.63126266",
"0.63036597",
"0.6302036",
"0.629188",
"0.6284181",
"0.62835836",
"0.62761647",
"0.62642324",
"0.62619925",
"0.6257345",
"0.62569314",
"0.6238435",
"0.6238136",
"0.62373304",
"0.6237211",
"0.62291074",
"0.6224409",
"0.62205863",
"0.6217582",
"0.62168354",
"0.6210397",
"0.6209959",
"0.62084764",
"0.62058216",
"0.62054104",
"0.62029064",
"0.62025195",
"0.6191822",
"0.6190769",
"0.61883354",
"0.61845034",
"0.6183227",
"0.61819565",
"0.61813706",
"0.6178306",
"0.6173297",
"0.61712784",
"0.61701363",
"0.6166448"
] | 0.7721092 | 0 |
Sending request using OAuth2 + Faraday connection. All credentials are automatically added. | def request(word, path, params, repeat=1)
if BeaconClient.config.debug?
BeaconClient.logger.debug("Path: #{path.inspect}")
BeaconClient.logger.debug("Params: #{params.inspect}")
end
response = connection.send(word, path, params: params)
if BeaconClient.config.debug?
BeaconClient.logger.debug("Params: #{response.inspect}")
end
response
rescue OAuth2::Error => error
BeaconClient.logger.error(error.message)
error.response
rescue
refresh!
repeat-=1
retry if repeat >= 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client\n Faraday.new(url: URL) do |c|\n c.token_auth self.auth_token\n c.request :url_encoded # form-encode POST params\n c.adapter Faraday.default_adapter # Net::HTTP\n end\n end",
"def send_auth_request \n request = AuthorizeRequest.new(:get, action_to_call) do |req|\n req.request_params = params\n end\n request.send_request(Config.url)\n end",
"def establish_connection(url, token)\n Faraday.new(url: url) do |faraday|\n faraday.request :json\n faraday.headers[\"Authorization\"] = token\n faraday.headers['Accept'] = 'application/json'\n faraday.response :json\n faraday.response :raise_error\n faraday.options.open_timeout = 2\n faraday.options.timeout = 100\n faraday.adapter Faraday.default_adapter\n end\n end",
"def setup_http_connection(host, opt)\n conn = Faraday.new(url: host) do |client|\n client.request :url_encoded\n client.request :oauth, opt\n client.adapter Faraday.default_adapter\n end\n conn\n end",
"def request\n req = connection\n \n req.body = with if (with && req.request_body_permitted?)\n if (credentials)\n if (credentials.is_a?(OAuth::AccessToken))\n credentials.sign!(req)\n else\n req.basic_auth(credentials[:username], credentials[:password])\n end\n end\n \n headers.each_pair {|key,value| req[key] = value } if headers\n \n req\n end",
"def request_token\n username = @credentials['username']\n password = @credentials['password']\n # app_name = @credentials['app_name']\n app_name = @credentials['app_name']\n vendor_name = @credentials['vendor_name']\n bus_num = @credentials['bus_num']\n scope = @credentials['scope']\n\n payload_hash = {\n 'grant_type' => 'password',\n 'username' => username,\n 'password' => password,\n 'scope' => scope\n }\n\n # The user name for inContact's API takes the form\n # app_api_name = \"#{app_name}\" + \"@\" + \"#{vendor_name}\" + \":\" + \"#{bus_num}\"\n api_app_name = \"#{app_name}\" + \"@\" + \"#{vendor_name}\"\n\n puts \"Authorizing... \\n\"\n\n # Specify token URL.\n url = URI('https://api.incontact.com/InContactAuthorizationServer/Token')\n # url = URI('https://api-c71.nice-incontact.com/InContactAuthorizationServer/Token')\n\n # Create connection object\n connection = Net::HTTP.new(url.host, url.port)\n # At *work*:\n # connection = Net::HTTP.new(url.host, url.port, 'asqproxy.vzbi.com', 80)\n # For *Fiddler*\n # connection = Net::HTTP.new(url.host, url.port, '127.0.0.1', 8888)\n\n connection.use_ssl = true\n # Uncomment the following line to tell Ruby to ignore invalid security certs.\n # connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # Create post object\n post = Net::HTTP::Post.new(url)\n\n # OAuth 2 token requests are usually the 'user' + 'pass' base64 encoded\n post.basic_auth(api_app_name, bus_num)\n\n # get the POST post _fileheaders\n # post['Content-Type'] = 'audio/flac'\n post['Content-Type'] = 'application/json; charset=UTF-8'\n post['Accept'] = 'application/json'\n # \"Accept-Encoding\" => \"gzip, deflate, sdch, br\",\n post['Accept-Encoding'] = 'none'\n post['Connection'] = 'keep-alive'\n\n # Prepare the HTTP message body to be posted with the request.\n # Convert the payload_hash hash to a json string.\n payload = payload_hash.to_json\n # It will be the message body (payload) of the HTTP post.\n post.body = payload\n\n # Make the HTTP post request and store the response.\n # The 'begin' & 'rescue' is an aborted attempt to put\n # error/exception handling around the http post\n # *begin*\n # *rescue* StandardError\n # *end*\n response = connection.request(post)\n\n # http_status_code = response.code.to_i\n http_status_code = response.code.strip\n if http_status_code.chr != '2'\n # Show me http status code\n puts \"/n http_status_code: #{http_status_code}\"\n end\n\n if response.is_a?(Net::HTTPSuccess)\n puts \"response is a Net::HTTPSuccess object\"\n # if response is OK then parese it to a Ruby data structure\n access_token_hash = JSON.parse(response.body)\n # access_token = access_token_hash['access_token']\n end\n\n access_token_hash\n end",
"def http\n Faraday.new(url: URL) do |c|\n c.token_auth self.auth_token\n c.request http_config[:request_encoding]\n c.response :json, :content_type => /\\bjson$/ # parse responses to JSON\n c.adapter http_config[:http_adapter]\n end\n end",
"def access_token_connection\n Faraday.new(access_token_url, headers: headers) do |conn|\n conn.use :breakers\n conn.response :json, content_type: /\\bjson$/\n conn.adapter Faraday.default_adapter\n end\n end",
"def request(post_body, headers)\n request = Net::HTTP::Post.new(endpoint_uri.path, headers)\n authenticate(request) if username\n request.body = post_body\n response = @client.request(request)\n { status: response.code.to_i, body: response.body, content_type: response.content_type }\n end",
"def connection(response_type = :json)\n @connection ||= Faraday.new(url: 'http://api.mendeley.com') do |connection|\n connection.request :url_encoded\n connection.request :oauth, oauth_data\n connection.response :json, content_type: //\n connection.adapter *Faraday.default_adapter\n end\n end",
"def access_token_connection\n Faraday.new(access_token_url) do |conn|\n conn.use :breakers\n conn.response :json, content_type: /\\bjson$/\n conn.adapter Faraday.default_adapter\n end\n end",
"def auth2_request(url, data)\r\n byte_array = data.encode('UTF-8')\r\n headers = {\r\n 'Content-Type' => 'application/x-www-form-urlencoded',\r\n }\r\n response = connection.post(url, byte_array, headers)\r\n json_response = JSON.parse(response.body)\r\n json_to_oauth2request(json_response)\r\n end",
"def request_post\n url = \"https://accounts.spotify.com/api/token\"\n\n options = {\n headers: {\n \"Authorization\" => encoding,\n },\n body: {\n \"grant_type\" => 'client_credentials',\n }\n }\n\n return my_request = HTTParty.post(url, options)\nend",
"def connection\n params = {}\n params[:oauth_token] = @access_token if @access_token\n @connection ||= Faraday.new(:url => api_url, :params => params, :headers => default_headers) do |builder|\n builder.use Faraday::Request::UrlEncoded\n builder.use Faraday::Response::Mashify\n builder.use Faraday::Response::ParseJson\n builder.adapter Faraday.default_adapter\n end\n end",
"def oauth_request(params)\n logger.verbose('Resorting to OAuth to fulfill token request.')\n OAuthRequest.new(@authority.token_endpoint, params)\n end",
"def send_request\n request = HTTPI::Request.new\n request.url = api_url\n request.auth.basic(email, key)\n request.auth.ssl.ca_cert_file = ca_cert_file\n request.auth.ssl.verify_mode = :peer\n request.open_timeout = 30\n request.headers['Content-Type'] = 'application/json'\n request.headers['Accept-Encoding'] = 'gzip, deflate, identity'\n request.body = @parameters.to_json\n \n HTTPI.post(request)\n rescue\n raise ConnectionError\n end",
"def connection(base='https://api.groupme.com/')\n Faraday.new base do |f|\n f.request :multipart\n f.request :json\n f.headers[:user_agent] = GroupMe::USER_AGENT\n f.headers[\"X-Access-Token\"] = @token\n\n # f.response :logger\n f.response :mashify\n f.response :json, :content_type => /\\bjson$/\n\n f.adapter Faraday.default_adapter\n end\n end",
"def client\n @client ||= Faraday.new(api_host) do |faraday|\n faraday.headers[\"Authorization\"] = \"Bearer #{access_token}\"\n faraday.response :logger if Rails.env.test?\n faraday.adapter Faraday.default_adapter\n end\n end",
"def create\n\t\tresp = Faraday.get(\"https://foursquare.com/oauth2/access_token\") do |req|\n\t\t\treq.params['client_id'] = ENV['DOHRFWJ4ADKXBXEPFGYU0VMZUWX0135GA3GG1EP0Z5JM0HVS']\n\t\t\treq.params['client_secret'] = ENV['UARMZQVBWT1EHSMRGR52U4TZLEYQISFC0SSBGHUYY3FQ0D1X']\n\t req.params['grant_type'] = 'authorization_code'\n\t req.params['redirect_uri'] = \"http://localhost:3000/auth\"\n req.params['code'] = params[:code]\n end\n\n body = JSON.parse(resp.body)\n session[:token] = body[\"access_token\"]\n redirect_to root_path\n end",
"def connection\n @connection ||= Faraday.new(api_endpoint) do |http|\n http.headers[:accept] = \"application/json, */*\"\n http.headers[:user_agent] = user_agent\n\n http.request :authorization, :Bearer, -> { token_store.get_token }\n http.request :json\n\n http.use Keap::REST::Response::RaiseError\n\n http.response :dates\n http.response :json, content_type: \"application/json\"\n # http.response :logger do |logger|\n # logger.filter(/(Bearer) (\\w+)/, '\\1 [FILTERED]')\n # end\n\n http.adapter adapter, @stubs\n end\n end",
"def request_token(params)\n header = {}\n\n if @endpoint_auth == :basic\n header = { authorization: 'Basic ' + Base64.encode64(\"#{@client_id}:#{@client_secret}\") }\n else\n params[:client_id] = @client_id\n params[:client_secret] = @client_secret\n end\n\n request = Net::HTTP::Post.new(@token_endpoint, header)\n request.form_data = params\n Net::HTTP.start(@host.hostname, @host.port, use_ssl: true) { |http| http.request(request) }\n end",
"def api_http_request!(consumer_token, access_token, path, parameters = {})\n base_url = Withings::Api::Defaults::API_BASE_URL\n host = URI.parse(base_url).host\n\n parameters = parameters.merge(:path => path, :oauth_options => {:site => base_url})\n\n request = create_signed_request(consumer_token, access_token, parameters)\n Net::HTTP.new(host).request(request)\n end",
"def authenticate\n RestClient::Request.execute(:method => :post,\n :url => @oauth_request,\n :headers => {\n \"Content-Type\" => \"application/json; charset=UTF8\",\n \"X-Accept\" => \"application/json\"\n },\n :payload => {\n :consumer_key => ENV['POCKET_CONSUMER_KEY'],\n :redirect_uri => ENV['REDIRECT_URI']\n })\n end",
"def connection(options = {})\n default_options = {\n :headers => {\n :accept => 'application/json',\n :user_agent => user_agent,\n :host => EdgeCast::Config::DEFAULT_HOST\n },\n :ssl => { :verify => false },\n :url => endpoint,\n }\n\n @connection ||= Faraday.new(default_options.merge(connection_options)) do |builder|\n builder.request :auth, api_token\n builder.request :json\n builder.request :multipart\n builder.request :url_encoded\n\n builder.response :client_error\n builder.response :json\n builder.response :server_error\n\n builder.adapter(adapter)\n end\n end",
"def request_token\n url = \"#{root_url}/oauth/authenticate\"\n body = {\n username: IdentityConfig.store.usps_ipp_username,\n password: IdentityConfig.store.usps_ipp_password,\n grant_type: 'implicit',\n response_type: 'token',\n client_id: IdentityConfig.store.usps_ipp_client_id,\n scope: 'ivs.ippaas.apis',\n }\n\n faraday.post(url, body) do |req|\n req.options.context = { service_name: 'usps_token' }\n end.body\n end",
"def request_api_token(client_id, client_secret, options = {})\n options.merge!({\n body: {\n grant_type: 'client_credentials',\n client_id: client_id,\n client_secret: client_secret,\n scope: 'alexa::proactive_events'\n }\n })\n\n HTTParty.post(ACCESS_TOKEN_REQUEST_URL, options)\n end",
"def authenticate!\n response = connection.post '/oauth2/v1/tokens/bearer' do |req|\n req.headers['Authorization'] = 'Basic ' + Base64.strict_encode64(@options[:client_id] + \":\" + @options[:client_secret])\n req.body = encode_www_form(params)\n end\n\n if response.status >= 500\n raise QuickbooksOnlineRuby::ServerError, error_message(response)\n elsif response.status != 200\n raise QuickbooksOnlineRuby::AuthenticationError, error_message(response)\n end\n\n @options[:access_token] = response.body['access_token']\n @options[:refresh_token] = response.body['refresh_token']\n\n if @options[:authentication_callback]\n @options[:authentication_callback].call(response.body)\n end\n\n response.body\n end",
"def connection\n @connection ||= Faraday.new(\"#{URL_PREFIX}\", connection_options) do |conn|\n conn.basic_auth(api_key, nil)\n end\n end",
"def request(method, path, opts)\n response = connection.send(method) do |request|\n request.url(path, opts)\n request.options[:timeout] = timeout\n request.options[:open_timeout] = open_timeout\n\n unless client_id.nil?\n request.headers['Authorization'] = \"Client #{client_id}\"\n end\n end\n\n response.body\n end",
"def create\n\t\t# when you authorize Foursquare, it send back to /auth with the :code in the params \n\t\tresp = Faraday.get('https://foursquare.com/oauth2/access_token') do |req|\n\t\t\treq.params['client_id'] = ENV['FOURSQUARE_CLIENT_ID']\n\t\t req.params['client_secret'] = ENV['FOURSQUARE_SECRET']\n\t\t req.params['grant_type'] = 'authorization_code'\n\t\t req.params['redirect_uri'] = \"http://localhost:3000/auth\"\n\t\t req.params['code'] = params[:code]\n\t\tend\n\t\tbody = JSON.parse(resp.body)\n\t\tsession[:token] = body[\"access_token\"]\n\t\tredirect_to root_path\n\tend",
"def connection\n self.faraday_connection ||= Faraday.new(configuration.faraday_options) do |f|\n if configuration.authenticated?\n f.request :authorization, :basic, configuration.username, configuration.password\n end\n f.request :multipart\n f.request :url_encoded\n unless options[:raw]\n f.response :mashify\n f.response :json\n end\n\n f.response :raise_error\n f.adapter configuration.adapter\n end\n end",
"def conn\n @conn ||= Faraday.new(url: authentication_uri.to_s) do |builder|\n builder.adapter Faraday.default_adapter\n end\n end",
"def gamebus_connection\n connection = Faraday.new url: Rails.application.secrets.gamebus_url do |faraday|\n faraday.request :url_encoded # form-encode POST params\n faraday.response :logger if Rails.env.development? || ENV['DEBUG_FARADAY'] # log requests to STDOUT\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n connection.headers['Authorization'] = \"Bearer #{gamebus_key}\"\n connection.headers['Content-Type'] = 'application/json'\n return connection\n end",
"def set_auth(uri, username = nil, password = nil)\n connection = Faraday.new url: uri, ssl: {verify: false} do |faraday|\n faraday.adapter http_engine\n faraday.proxy(ENV['http_proxy']) if ENV['http_proxy']\n end\n set_username_and_password connection, username, password if username\n connection\n end",
"def rvs_connection\n connection = Faraday.new url: Rails.application.secrets.rvs_url do |faraday|\n faraday.request :url_encoded # form-encode POST params\n faraday.response :logger if Rails.env.development? || ENV['DEBUG_FARADAY'] # log requests to STDOUT\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n connection.headers['Authorization'] = \"Token #{rvs_key}\" if rvs_key\n return connection\n end",
"def client(url, body, headers)\n self.class.post(\n url,\n body: body,\n headers: headers,\n basic_auth: @authorization\n )\n end",
"def authenticate\n callback = qbo_oauth_callback_url\n token = Qbo.get_oauth_consumer.get_request_token(:oauth_callback => callback)\n session[:qb_request_token] = Marshal.dump(token)\n redirect_to(\"https://appcenter.intuit.com/Connect/Begin?oauth_token=#{token.token}\") and return\n end",
"def connection\n Faraday.new(url: self.configuration.base_url) do |f|\n f.response :xml, :content_type => /\\bxml$/\n f.adapter :net_http\n f.basic_auth self.configuration.username, self.configuration.password\n end\n end",
"def request(path, params={}, &block)\n puts \"Requesting: #{path} | #{params.inspect}\"\n\n params.update :oauth_token => access_token\n http = EventMachine::HttpRequest.new(\"https://api.foursquare.com/v2\" + path).get(:query => params)\n http.callback do\n block.call JSON.parse(http.response)[\"response\"]\n end\n end",
"def request(path, options={})\n response = @connection.get do |req|\n req.url path\n req.params[:api_key] = @access_token\n options.each do |key, val|\n req.params[key] = val\n end\n end\n response.body\n end",
"def request(options)\n raise HyvesException, 'You need an access token to make requests' if access_token.nil?\n options = default_request_options.merge(options)\n access_token.post('/', options)\n end",
"def faraday\n mutex.synchronize do\n @faraday ||= create_faraday\n end\n end",
"def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.request :basic_auth, user, password\n faraday.params = datasource_params\n faraday.adapter :net_http\n end\n end",
"def call(opts={})\n server = WEBrick::HTTPServer.new(Port: @port)\n auth_details = {}\n\n server.mount_proc('/') do |req, res|\n res.body = js_template\n end\n\n server.mount_proc('/send_token') do |req, res|\n auth_details = JSON.parse(req.body)\n res.body = 'token sent'\n\n server.shutdown # server will shutdown after completing the request\n end\n\n trap \"INT\" do server.shutdown end\n\n Launchy.open(\"#{@auth_host}#{OAUTH_ENDPOINT}?#{oauth_query_string}\")\n server.start\n\n merged_options = opts.merge(auth_details).merge(client_id: @client_id, api_version: '39.0').inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n merged_options[:oauth_token] = merged_options[:access_token] if merged_options[:access_token]\n @client.call(merged_options)\n end",
"def authenticate\n if @client_id.length < 1 || @client_secret.length < 1\n raise SdkException.new('missing parameters: client_id, client_secret')\n end\n url_with_params = @@auth_endpoint + '?grant_type=client_credentials&scope=data'\n response = RestClient::Request.execute(\n url: url_with_params,\n user: @client_id,\n password: @client_secret,\n method: :post\n )\n body = JSON.parse(response.body)\n @access_token = body['access_token']\n self\n end",
"def connection\n Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.request :json\n\n faraday.response :raise_error, error_prefix: service_name\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end",
"def send_request(uri, params, user, password)\n request = Net::HTTP::Get.new(uri)\n request.basic_auth(user, password)\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n params.each_pair do |key, val|\n request[key] = val\n end\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n return JSON.parse(response.body)\nend",
"def connection\n Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.request :json\n\n faraday.response :raise_error, error_prefix: service_name\n faraday.response :caseflow_errors\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end",
"def authenticate\n @discogs = Discogs::Wrapper.new(\"Test OAuth\")\n request_data = @discogs.get_request_token(DISCOGS_API_KEY, DISCOGS_API_SECRET, \"http://127.0.0.1:3000/callback\")\n \n session[:request_token] = request_data[:request_token]\n \n redirect_to request_data[:authorize_url]\n end",
"def connection(address)\n service_connection = Faraday.new(:url => \"#{address}\") do |faraday|\n faraday.request :url_encoded # form-encode POST params\n #faraday.response :logger # log requests to STDOUT\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n return service_connection\nend",
"def initialize(options = {})\n\n @conn = Faraday.new do |f|\n f.use Middleware, self\n f.response :logger\n f.request :multipart\n f.request :url_encoded\n f.adapter Faraday.default_adapter\n end\n @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)\n [:username, :password, :client_id, :client_secret, :auth_code, :access_token, :refresh_token, :ttl, :rest_url, :rest_token, :auth_host, :rest_host].each do |opt|\n self.send \"#{opt}=\", options[opt] if options[opt]\n end\n\n end",
"def make_request(path, params, method, body)\n uri = build_uri(path, params)\n formatted = \"#{uri.path}?#{uri.query}\"\n output_format = params.fetch(:f, \"json\")\n headers = {\"Accept\" => \"application/#{output_format}\",\n \"Accept-Encoding\" => \"gzip,deflate\",\n \"User-Agent\" => @app_name}\n\n if authenticated?\n if [:post, :put].include?(method)\n headers[\"Content-Type\"] = \"application/json\"\n @access_token.send(method, formatted, JSON(body), headers)\n else\n @access_token.send(method, formatted, headers)\n end\n else\n # All non-authenticated endpoints are GET.\n request = Net::HTTP::Get.new(formatted)\n\n headers.each do |h, v|\n request.add_field(h, v)\n end\n\n Net::HTTP.new(uri.host).start do |http|\n http.request(request)\n end\n end\n end",
"def connect\n require 'restforce' unless defined?(::Restforce)\n username = additional_params[:username] || \"\"\n password = additional_params[:password] || \"\"\n security_token = additional_params[:security_token] || \"\"\n client_id = additional_params[:client_id] || \"\"\n client_secret = additional_params[:client_secret] || \"\"\n instance_url = additional_params[:instance_url] || \"\"\n\n @client = Restforce.new(\n username: username,\n password: password,\n security_token: security_token,\n client_id: client_id,\n client_secret: client_secret,\n instance_url: instance_url\n )\n\n @oauth = @client.authenticate!\n super\n end",
"def connection\n return unless @url\n\n @connection ||= Faraday::Connection.new(@url) do |b|\n middleware.each { |m, opts| b.use(m, opts) }\n b.request :url_encoded\n b.adapter :net_http\n end\n \n @connection.basic_auth(*@basic_auth) if @basic_auth\n @connection.token_auth(*@token_auth) if @token_auth\n @connection.authorization(*@authorization) if @authorization\n @connection\n end",
"def request_auth(from, to, message)\n #handeled by send_im\n return send_im(from, to, message)\nend",
"def connection\n @connection ||= Faraday.new @url do |c|\n c.headers[\"X-Api-Token\"] = @token\n c.use FaradayMiddleware::ParseJson, content_type: \"application/json\"\n #c.use Faraday::Response::Logger, Logger.new(\"tmp/faraday.log\")\n c.use FaradayMiddleware::FollowRedirects, limit: 3\n c.use Faraday::Response::RaiseError # raise exceptions on 40x, 50x responses\n c.use Faraday::Adapter::NetHttp\n end\n end",
"def request_oauth_token\n request_token_hash = {\n \"oauth_consumer_key\" => \"#{@consumer_key}\",\n \"oauth_signature_method\" => \"HMAC-SHA1\",\n \"oauth_timestamp\" => timestamp,\n \"oauth_nonce\" => nonce,\n \"oauth_version\" => \"1.0\",\n \"oauth_callback\" => \"oob\",\n }\n\n # set signature\n request_token_hash[\"oauth_signature\"] = generate_oauth_signature(generate_signature_base_string(\"POST\", @request_token_url, request_token_hash))\n\n # post with auth header\n result = MyHttp.post(@request_token_url, nil, {\n \"Authorization\" => \"OAuth #{generate_auth_header(request_token_hash)}\",\n })\n\n auth_token_string = result.body.strip\n if result.is_a? Net::HTTPSuccess\n return string_param_to_hash(auth_token_string)\n else\n status = result.code\n return nil\n end\n end",
"def send_request method, params = {}\n uri = URI.parse(@api_url)\n if Time.now.to_i > @exp + 3600\n get_acces_token\n @exp = Time.now.to_i\n end\n required = { 'access_token' => @access_token, 'method' => method }\n params = required.merge(params)\n params = URI.escape(params.collect{ |k,v| \"#{k}=#{v}\"}.join('&'))\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.request_uri)\n req['User-Agent'] = \"zhzhussupovkz pleer.com-ruby-api\"\n req.body = params\n res = http.request(req)\n if res.code == \"200\"\n data = res.body\n result = JSON.parse(data)\n else\n puts \"Invalid getting data from server\"\n exit\n end\n end",
"def send\n post_params = {}\n self.parameters.each { |key, value|\n if value.is_a? Array\n i = 0\n value.each { |value_value|\n post_params[key.to_s + '[' + i.to_s + ']'] = value_value.to_s\n i += 1\n }\n elsif value.is_a? Hash\n value.each { |value_key, value_value|\n post_params[key.to_s + '[' + value_key.to_s + ']'] = value_value.to_s\n }\n else\n post_params[key.to_s] = value.to_s\n end\n }\n\n url = URI.parse(@@API_URL)\n http_request = Net::HTTP::Post.new(url.path)\n http_request.form_data = post_params\n http_request.basic_auth url.user, url.password if url.user\n\n response = Spree::PAYONE::Proxy::Response.new\n connection = Net::HTTP.new(url.host, url.port)\n load_ca_file connection\n connection.use_ssl = true\n connection.start { |http|\n http_response = http.request(http_request)\n response.response_body= http_response.body\n }\n\n response\n end",
"def faraday(options = {})\n @faraday ||= Faraday.new(DEFAULT_FARADAY_OPTIONS.merge(options)) do |builder|\n\n builder.request :basic_auth, login, password\n builder.request :json\n builder.request :xml_serialize\n\n builder.response :json, :content_type => /\\bjson$/\n builder.response :xml, :content_type => /\\bxml$/\n\n # builder.response :body_logger # log requests to STDOUT\n yield builder if block_given?\n # add default Faraday.default_adapter if none present\n adapter_handler = builder.builder.handlers.find {|h| h.klass < Faraday::Adapter }\n builder.adapter Faraday.default_adapter if adapter_handler.nil?\n end\n end",
"def request_token\n request = { query: { code: ENV['GOOGL_CODE'], \n client_id: ENV['GOOGL_CLIENT_ID'], \n client_secret: ENV['GOOGL_CLIENT_SECRET'],\n redirect_uri: ENV['GOOGL_REDIRECT_URI'],\n grant_type: \"authorization_code\" } }\n\n result = self.class.post(\"/oauth2/v3/token\", request)\n\n result.parsed_response\n end",
"def build_auth_url\n URI.parse(\"https://www.dropbox.com/oauth2/authorize\").tap do |uri|\n uri.query = URI.encode_www_form(\n client_id: DROPBOX_APP_KEY,\n redirect_uri: SHOTTY_CALLBACK_URL,\n response_type: :code,\n state: csrf_token,\n )\n end\nend",
"def create_connection\n\t\t@connection = Faraday.new(:url => @base_url) do |faraday|\n\t\t\tfaraday.headers['Accept'] = 'application/json'\n\t\t\tfaraday.adapter Faraday.default_adapter\n\t\tend\n\tend",
"def configure\n @mauth_client = ::MAuth::Client.new(mauth_config)\n\n @connection = Faraday.new do |builder|\n builder.use MAuth::Faraday::MAuthClientUserAgent, \"MediTAF Mauth Client Adapter\"\n builder.use MAuth::Faraday::RequestSigner, :mauth_client => @mauth_client\n builder.use MAuth::Faraday::ResponseAuthenticator, :mauth_client => @mauth_client if mauth_config[:authenticate_response]\n builder.use FaradayMiddleware::ParseJson, content_type: /\\bjson$/\n builder.use FaradayMiddleware::ParseXml, content_type: /\\bxml$/\n builder.adapter Faraday.default_adapter\n end\n end",
"def http_connect(body = nil, require_auth = true, service = :rest, &block)\n \trequire_block(block_given?)\n \tconnection = create_http_connection(service)\n \tconnection.start do |connection|\n \t\trequest = yield connection if block_given?\n \t\trequest.basic_auth(@login, @password) if require_auth\n \t\tresponse = connection.request(request, body)\n \t\thandle_rest_response(response)\n \t\tresponse\n end\n end",
"def generate_authenticated_request options = {}\n options = deep_hash_normalize options\n\n raise ArgumentError, \"Missing access token.\" if access_token.nil?\n options = {\n realm: nil\n }.merge(options)\n\n if options[:request].is_a? Faraday::Request\n request = options[:request]\n else\n if options[:request].is_a? Array\n method, uri, headers, body = options[:request]\n else\n method = options[:method] || :get\n uri = options[:uri]\n headers = options[:headers] || []\n body = options[:body] || \"\"\n end\n headers = headers.to_a if headers.is_a? Hash\n request_components = {\n method: method,\n uri: uri,\n headers: headers,\n body: body\n }\n # Verify that we have all pieces required to return an HTTP request\n request_components.each do |(key, value)|\n raise ArgumentError, \"Missing :#{key} parameter.\" unless value\n end\n method = method.to_s.downcase.to_sym\n request = options[:connection].build_request method.to_s.downcase.to_sym do |req|\n req.url Addressable::URI.parse(uri).normalize.to_s\n req.headers = Faraday::Utils::Headers.new headers\n req.body = body\n end\n end\n\n request[\"Authorization\"] = ::Signet::OAuth2.generate_bearer_authorization_header(\n access_token,\n options[:realm] ? [[\"realm\", options[:realm]]] : nil\n )\n request[\"Cache-Control\"] = \"no-store\"\n request\n end",
"def make_request(method, uri, client_key, oauth_token, oauth_token_secret, client_secret)\n\t access_token = oauth_token_secret\n\t params = params(client_key, oauth_token, generate_nonce)\n\t params['oauth_consumer_key'] = client_key\n\t params['oauth_token'] = oauth_token\n\t params['oauth_nonce'] = generate_nonce\n\t signing_key = client_secret + '&' + access_token\n\t# create this for the oauth_signature\n\t signature_base_string = signature_base_string(method, uri, params)\n\t params['oauth_signature'] = url_encode(sign(signing_key, signature_base_string))\n\t header_string = header(params)\n\t return header_string\n\tend",
"def connect!\n @connection = user ? connection_for_user : connection_for_application\n @auth_token = @connection.token\n BeaconClient.logger.debug(\"Client token: #{@auth_token}\") if BeaconClient.config.debug?\n @auth_token\n rescue OAuth2::Error => error\n BeaconClient.logger.error(error.message)\n BeaconClient.logger.error(error.backtrace.join(\"\\n\"))\n end",
"def initialize(from, to, client_secret)\n @from = from\n @to = to\n @client_secret = client_secret\n @access_token = fetch_access_token\n end",
"def faraday\n @faraday ||= Faraday.new ssl: { verify: ssl_verify } do |faraday|\n authenticate!(faraday)\n\n faraday.request(:retry, max: retries) if retries\n faraday.options.timeout = read_timeout if read_timeout\n faraday.options.open_timeout = open_timeout if open_timeout\n\n faraday.request :url_encoded # Form-encode POST params\n faraday.response :raise_error\n faraday.use :http_cache, store: http_cache, serializer: Marshal\n faraday.use Faraday::CacheHeaders\n faraday.response :json, content_type: /\\bjson$/\n faraday.adapter :excon\n end\n end",
"def create_authentication(body)\r\n # Prepare query url.\r\n _path_url = '/oauth/token'\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 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\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 OAuthResponse.from_hash(decoded)\r\n end",
"def initialize(client_id, client_secret, opts={})\n self.options = opts.dup\n self.token_method = self.options.delete(:access_token_method) || :post\n adapter = self.options.delete(:adapter)\n ssl_opts = self.options.delete(:ssl) || {}\n connection_opts = ssl_opts ? {:ssl => ssl_opts} : {}\n self.id = client_id\n self.secret = client_secret\n self.site = self.options.delete(:site) if self.options[:site]\n self.connection = Faraday::Connection.new(site, connection_opts)\n self.json = self.options.delete(:parse_json)\n self.raise_errors = !(self.options.delete(:raise_errors) == false)\n\n if adapter && adapter != :test\n connection.build do |b|\n b.adapter(*[adapter].flatten)\n end\n end\n end",
"def connection\n Faraday.new(base_path, headers: base_request_headers, request: request_options, ssl: ssl_options) do |conn|\n conn.use :breakers\n conn.request :soap_headers\n\n conn.response :soap_parser\n conn.response :betamocks if Settings.emis.mock\n conn.adapter Faraday.default_adapter\n end\n end",
"def connection\n @connection ||= Faraday.new(@server_uri, :ssl => {:verify => false}) do |builder|\n builder.request :url_encoded # Encode request parameters as \"www-form-urlencoded\"\n builder.response :logger # Log request and response to STDOUT\n builder.adapter :net_http # Perform requests with Net::HTTP\n end\n end",
"def connection\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"base_url=#{base_url}\",\n \"username=#{username}\",\n # \"password=#{password}\",\n \"\" ], bold_puts: debug_verbose_puts if debug_verbose\n rv = Faraday.new(url: base_url) do |c|\n c.basic_auth(username, password)\n c.adapter(Faraday.default_adapter)\n end\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"rv=#{rv}\",\n \"\" ], bold_puts: debug_verbose_puts if debug_verbose\n return rv\n end",
"def oauth\n teapot_q\n end",
"def request(verb, params)\n params = build_url(params)\n\n if access_token\n params.merge!(:access_token => access_token)\n end\n\n Connection.new(verb, params).fetch\n end",
"def http_send url, form_data, headers, &block\n if form_data['action'] == 'query'\n log.debug(\"GET: #{form_data.inspect}, #{@cookies.inspect}\")\n headers[:params] = form_data\n RestClient.get url, headers, &block\n else\n log.debug(\"POST: #{form_data.inspect}, #{@cookies.inspect}\")\n RestClient.post url, form_data, headers, &block\n end\n end",
"def do_auth data_hash\n url = \"#{@@oauth_info[:oauth_url]}/access_token\"\n ssl = @@ssl\n headers = {:content_type => \"application/x-www-form-urlencoded;charset=UTF-8\"}\n\n conn = Faraday.new(:url => url, :ssl => ssl) do |faraday|\n faraday.request :url_encoded\n faraday.adapter Faraday.default_adapter\n faraday.response :logger\n end\n\n response = conn.post url, data_hash, headers\n if response.status == 200\n res_hash = JSON.parse response.body\n @access_token = res_hash[\"access_token\"]\n @refresh_token = res_hash[\"refresh_token\"]\n @expires_at = res_hash[\"expires_in\"].seconds.from_now\n return true\n else\n return false\n end\n end",
"def retrieve_auth_token\n http = Net::HTTP.new(auth_endpoint.host, auth_endpoint.port)\n\n request = Net::HTTP::Post.new(auth_endpoint.request_uri)\n\n request.basic_auth(\n TodoableApi.configuration.username,\n TodoableApi.configuration.password\n )\n\n handle_auth_response(http.request(request))\n end",
"def request(method, path, params = {}, options = {})\n\n raise AirbrakeError.new('API Token cannot be nil') if @auth_token.nil?\n raise AirbrakeError.new('Account cannot be nil') if @account.nil?\n\n response = connection(options).run_request(method, nil, nil, nil) do |request|\n case method\n when :delete, :get\n request.url(path, params.merge(:auth_token => @auth_token))\n when :post, :put\n request.url(path, :auth_token => @auth_token)\n request.body = params unless params.empty?\n end\n end\n response.body\n end",
"def authenticate\n response = post('login')\n @access_token = response['access-token']\n @client_id = response['client-id']\n end",
"def connection\n options = { url: api_url, ssl: { verify: false } }\n\n connection = Faraday.new(options) do |conn|\n conn.response :readmill_errors\n conn.response :mashify\n conn.response :json\n\n conn.adapter adapter\n end\n\n connection\n end",
"def build_connection\n connection = Faraday.new(url: base_url)\n connection.adapter *connection_adapter\n end",
"def authenticate!(client_id, client_secret, code)\n response = Faraday.post \"https://github.com/login/oauth/access_token\", {client_id: client_id, client_secret: client_secret, code: code}, {'Accept' => 'application/json'}\n\n @access_token = JSON.parse(response.body)[\"access_token\"]\n\n end",
"def endpoint_connection\n @conn ||= Faraday.new(url: ENDPOINT_URL) do |faraday|\n faraday.adapter :net_http\n end\n rsp = @conn.get do |request|\n request.params = data_params\n end\n end",
"def generate_request(username = nil)\r\n assertion = build_assertion(username)\r\n data = \"grant_type=#{GRANT_TYPE}&assertion_type=#{ASSERTION_TYPE}&assertion=#{assertion}\"\r\n auth2_request(OAUTH_URL, data)\r\n end",
"def conn\n Faraday.new(:url => @config.url) do |c|\n c.adapter Faraday.default_adapter\n c.headers['User-Agent'] = @config.usr_agent\n c.params = self.options\n end\n end",
"def get_access(params: nil, host: nil)\n form = { grant_type: \"authorization\",\n code: params[:code],\n redirect_uri: url_helpers.authorisation_identities_url(host: host)\n }\n Faraday.new do |c|\n c.use Faraday::Request::BasicAuthentication\n end\n conn = Faraday.new(url: Setting.oauth[\"id_token_service_url\"])\n conn.params = form\n conn.basic_auth Setting.oauth[\"client_id\"], Setting.oauth[\"client_secret\"]\n resp = conn.post\n raise if resp.status >= 300\n @access_token = JSON.parse(resp.body)\n validate_id_token(id_token: @access_token[\"id_token\"])\n @user_proxy = UserProxy.set_up_user(access_token: @access_token, id_token: @id_token)\n if @user_proxy.has_a_kiwi?\n @user_proxy.kiwi.check_party\n publish(:valid_authorisation, @user_proxy)\n else\n publish(:create_a_kiwi, @user_proxy)\n end\n end",
"def exchange_oauth_tokens\n end",
"def oauth_access\n client = Fitgem::Client.new({:consumer_key => @consumer_key, :consumer_secret => @consumer_secret})\n\n request_token = client.request_token\n token = request_token.token\n secret = request_token.secret\n\n puts \"Go to http://www.fitbit.com/oauth/authorize?oauth_token=#{token} and then enter the verifier code below and hit Enter\"\n verifier = gets.chomp\n\n access_token = client.authorize(token, secret, { :oauth_verifier => verifier })\n\n puts \"Verifier is: \"+verifier\n puts \"Token is: \"+access_token.token\n puts \"Secret is: \"+access_token.secret\n\n token = access_token.token\n secret = access_token.secret\n user_id = '3B8C8S'\n\n client = Fitgem::Client.new({:consumer_key => @consumer_key, :consumer_secret => @consumer_secret, :token => token, :secret => secret, :user_id => user_id})\n access_token = client.reconnect(token, secret)\n # Pass client to runner here\n client\n end",
"def request(code:, redirect_uri: Keap::REST.redirect_uri)\n body = {\n client_id: Keap::REST.client_id,\n client_secret: Keap::REST.client_secret,\n code: code,\n grant_type: \"authorization_code\",\n redirect_uri: redirect_uri\n }\n\n response = connection.post do |req|\n req.body = body\n end\n\n new(response.body)\n end",
"def oauth\n {\n consumer_key: @consumer_key,\n consumer_secret: @consumer_secret,\n token: @token,\n token_secret: @token_secret\n }\n end",
"def login\n params = {\n :head => { 'authorization' => [@username, @password] },\n :body => {}\n }\n params[:body]['client_id'] = @client_id if @client_id\n params[:body]['client_secret'] = @client_secret if @client_secret\n http = EM::HttpRequest.new(API_OAUTH_URL).post(params)\n\n http.errback do |http|\n fail(http.error, *@deferrable_args)\n end\n\n http.callback do |http|\n if http.response_header.status != 200\n fail(http.response, *@deferrable_args)\n next\n end\n\n @access_token = http.response\n if @access_token.nil?\n fail('OAuth request did not return an access token', *@deferrable_args)\n next\n else\n yield if block_given?\n end\n end\n end",
"def authorize\n\t\t\n\t\tcsrf_token = SecureRandom.base64(18).tr('+/','-_').gsub(/=*$/, '')\n\t\tsession[:csrf] = csrf_token\n\t\t\n\t\toauthUrl = Dropbox.build_uri(__method__) + \"/oauth2/authorize\" #build the proper url\n\t\t\n\t\t#\tPrepare and send the authorization request\n\t\tparams = {\n\t\t :client_id => ENV['DROPBOX_KEY'],\n\t\t :response_type => :code,\n\t\t :redirect_uri => \"http://localhost:3000/dropbox/get_token\",\n\t\t :state => csrf_token\n\t\t}\n\t\tquery = params.map{|k,v| \"#{k.to_s}=#{URI.escape(v.to_s)}\"}.join '&'\n\t\tredirect_to \"#{oauthUrl}?#{query}\"\n\t\t\n\t end",
"def oauth_client\n @oauth_client ||= OAuth2::Client.new @app_key, @app_secret, site: @workxp_site do |stack|\n stack.request :multipart\n stack.request :url_encoded\n stack.adapter :net_http\n end\n end",
"def perform_access(user, nonce)\n formatted_data = user\n outgoing_request_body = {\n \"profiles\": [{\n \"profileId\": user[:id],\n \"profileData\": formatted_data,\n }],\n }\n\n # Signal that it has been completed.\n # TODO: make x-sombra-authorization optional in this example\n resp = Faraday.post($DATA_SILO_PATH) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.headers['accept'] = 'application/json'\n req.headers['Authorization'] = 'Bearer ' + $TRANSCEND_API_KEY\n req.headers['x-sombra-authorization'] = $SOMBRA_API_KEY ? 'Bearer ' + $SOMBRA_API_KEY : nil\n req.headers['x-transcend-nonce'] = nonce\n req.body = outgoing_request_body.to_json\n end\n\nend",
"def useToken(subdomain, oauth_token)\n\tpayload = {ticket: {\n subject: \"Ruby OAuth Authenticated Ticket\", \n comment: {\n \tbody: \"Ticket Created!\"\n }\n }\n }\n header = {'Content-Type': 'application/json', 'Authorization': 'BEARER ' + oauth_token}\n puts header\n\turi = URI.parse(\"https://\"+subdomain+\".zendesk.com/api/v2/tickets.json\")\n\thttp = Net::HTTP.new(uri.host, uri.port)\n\thttp.use_ssl = true\n\trequest = Net::HTTP::Post.new(uri.request_uri, header)\n\trequest.body = payload.to_json\n\tputs \"Making authenticated request\"\n\tresponse = http.request(request)\n\tdata = JSON.parse(response.body)\n\tputs data\n\tputs \"Success!\"\n\nend",
"def connection\n Faraday.new(api_url, ssl: { verify: true }) do |conn|\n conn.adapter Faraday.default_adapter\n end\n end",
"def send_credentials\n dputs __method__.to_s\n login_req = setup_http_request($ident, @cookie, {:arg => [$CONF['user'], CGI.escape($CONF['pass'])]})\n res = @http.request(login_req)\n get_cookie(res)\n end",
"def make_request\n create_authorization\n\n options = {}\n options[:header] = authorization.headers.merge(\n 'Authorization' => authorization.authorization_header\n )\n options[:query] = query if query.any?\n options[:body] = form_body if body\n\n http_response = @httpclient.request(method, url, options)\n @response = AwsResponse.new(self, http_response)\n\n freeze\n\n @response\n end"
] | [
"0.6997332",
"0.68359137",
"0.6742062",
"0.6471984",
"0.6444603",
"0.6423",
"0.63679844",
"0.62900496",
"0.62185377",
"0.61797994",
"0.61231816",
"0.60815585",
"0.60598445",
"0.6046625",
"0.603964",
"0.6033901",
"0.60203284",
"0.60081655",
"0.59914744",
"0.59409106",
"0.59332925",
"0.5928816",
"0.5873102",
"0.587045",
"0.5820183",
"0.5793417",
"0.57684046",
"0.57509804",
"0.57483137",
"0.5735563",
"0.57311577",
"0.5723028",
"0.571412",
"0.57138926",
"0.56980294",
"0.5691213",
"0.5686627",
"0.5685817",
"0.56786036",
"0.56672513",
"0.5660792",
"0.56467617",
"0.5643953",
"0.56372523",
"0.5634769",
"0.5618443",
"0.5616074",
"0.5593107",
"0.5591209",
"0.5588583",
"0.5576363",
"0.55640197",
"0.5558759",
"0.55533874",
"0.55480486",
"0.5540326",
"0.55359757",
"0.55294937",
"0.5526601",
"0.55254656",
"0.55223125",
"0.55184937",
"0.5517493",
"0.55123544",
"0.5511933",
"0.5502153",
"0.5490557",
"0.54855895",
"0.5480599",
"0.54805267",
"0.54783535",
"0.5473717",
"0.5473197",
"0.5464882",
"0.54532933",
"0.5451509",
"0.5451313",
"0.54504925",
"0.5447437",
"0.54422283",
"0.5437308",
"0.5435494",
"0.54347396",
"0.5434382",
"0.5432125",
"0.5431846",
"0.54279757",
"0.542481",
"0.54232866",
"0.5422498",
"0.54196656",
"0.5400611",
"0.53864884",
"0.53862315",
"0.5381898",
"0.5380783",
"0.5378304",
"0.53765637",
"0.53683156",
"0.5366081",
"0.53640634"
] | 0.0 | -1 |
Create new connection between BeaconCtrl and BeaconClient New oauth token should be returned by server. | def connect!
@connection = user ? connection_for_user : connection_for_application
@auth_token = @connection.token
BeaconClient.logger.debug("Client token: #{@auth_token}") if BeaconClient.config.debug?
@auth_token
rescue OAuth2::Error => error
BeaconClient.logger.error(error.message)
BeaconClient.logger.error(error.backtrace.join("\n"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def oauth2_client(token, params = {})\n @oauth2_client = RubyLokaliseApi::OAuth2Client.new token, params\n end",
"def init\n\t\tuser_credentials = {\n\t\t\t:access_token => access_token,\n\t\t\t:refresh_token => refresh_token,\n\t\t\t:expires_at => Time.now + expires_in\n\t\t}\n\n client_id = '694fc2f618facf30b3b41726ee6d0ac04c650669ca3d114cb0bae4223cecade3'\n client_secret = '3e7cfd07d829211ac50dd6486fe677ca76e965f25ad7d68e67e845e0d4a213e7'\n\t\tCoinbase::OAuthClient.new(client_id, client_secret, user_credentials)\n\tend",
"def connect!\n retrieve_auth_token unless connected?\n auth_token[:token]\n end",
"def connection_for_user\n BeaconClient.logger.debug([user.email.inspect, user.password.inspect].join(' : '))\n oauth_client.password.get_token(\n user.email, user.password,\n email: user.email\n )\n end",
"def new\n gon.client_token = generate_client_token\n end",
"def new_client_application\n OAuth2::Client.new(caller_service.client_id, caller_service.client_secret, :site => authorizator_service.site, :raise_errors => false)\n end",
"def new_connection; end",
"def create_connection\n\t\t@connection = Faraday.new(:url => @base_url) do |faraday|\n\t\t\tfaraday.headers['Accept'] = 'application/json'\n\t\t\tfaraday.adapter Faraday.default_adapter\n\t\tend\n\tend",
"def initialize(options= {})\n @login = options[:login] || ENV['VZAAR_LOGIN'] || ''\n application_token = options[:application_token] || ENV['VZAAR_APPLICATION_TOKEN'] || ''\n server = options[:server] || ENV['VZAAR_SERVER'] || VZAAR_LIVE_SERVER\n @logger = options[:logger] || Logger.new(STDOUT)\n\n server.gsub! 'http://', ''\n server.gsub! 'https://', ''\n consumer = OAuth::Consumer.new '', '', { :site => \"http://#{server}\" }\n @public_connection = OAuth::AccessToken.new consumer, '', ''\n consumer = OAuth::Consumer.new '', '', { :site => \"https://#{server}\" }\n if @login.length > 0 and application_token.length > 0\n @auth_connection = OAuth::AccessToken.new consumer, @login, application_token\n else\n # Authenticated requests won't be possible\n @auth_connection = nil\n log_info \"Authenticated calls won't be possible\"\n end\n end",
"def connection_for_application\n oauth_client.client_credentials.get_token\n end",
"def client\n @client ||= ::OAuth2::Client.new(\n @consumer_token,\n @consumer_secret,\n :site => 'https://api-ssl.bitly.com',\n :token_url => '/oauth/access_token'\n )\n end",
"def connection\n params = {}\n params[:oauth_token] = @access_token if @access_token\n @connection ||= Faraday.new(:url => api_url, :params => params, :headers => default_headers) do |builder|\n builder.use Faraday::Request::UrlEncoded\n builder.use Faraday::Response::Mashify\n builder.use Faraday::Response::ParseJson\n builder.adapter Faraday.default_adapter\n end\n end",
"def initialize(tokens_and_secrets = {})\n @oauth = KynetxAmApi::Oauth.new(tokens_and_secrets)\n end",
"def establish_connection(url, token)\n Faraday.new(url: url) do |faraday|\n faraday.request :json\n faraday.headers[\"Authorization\"] = token\n faraday.headers['Accept'] = 'application/json'\n faraday.response :json\n faraday.response :raise_error\n faraday.options.open_timeout = 2\n faraday.options.timeout = 100\n faraday.adapter Faraday.default_adapter\n end\n end",
"def connection(&blk)\n @connection ||= Connection.build endpoint.secret, &blk\n end",
"def connect\n consumer = OAuth::Consumer.new(@c_key, @c_sec,\n { :site => \"https://api.twitter.com\",\n :scheme => :header\n })\n\n token_hash = { :oauth_token => @a_tok,\n :oauth_token_secret => @a_sec\n }\n\n @access_token = OAuth::AccessToken.from_hash(consumer, token_hash)\n end",
"def create_new_persistent_connection\n app_name = if @data[:options][:connection_ca_file] ||\n @data[:credentials][:cert] ||\n @data[:credentials][:key]\n 'right_cloud_api_gem_%s' % Utils::generate_token\n else\n 'right_cloud_api_gem'\n end\n connection = Net::HTTP::Persistent.new(app_name)\n set_persistent_connection_options!(connection)\n # Register a callback to close current connection\n @data[:callbacks][:close_current_connection] = Proc::new do |reason|\n connection.shutdown\n log \"Current connection closed: #{reason}\"\n end\n connection\n end",
"def initialize(client_id: nil, access_token: nil, with_raw: false)\n if client_id.nil? && access_token.nil?\n raise \"An identifier token (client ID or bearer token) is required\"\n elsif !!client_id && !!access_token\n warn(%{WARNING:\nIt is recommended that only one identifier token is specified.\nUnpredictable behavior may follow.})\n end\n\n headers = {\n \"User-Agent\": \"twitch-api ruby client #{Twitch::VERSION}\"\n }\n unless client_id.nil?\n headers[\"Client-ID\"] = client_id\n end\n unless access_token.nil?\n access_token = access_token.gsub(/^Bearer /, \"\")\n headers[\"Authorization\"] = \"Bearer #{access_token}\"\n end\n \n @conn = Faraday.new(API_ENDPOINT, { headers: headers }) do |faraday|\n faraday.request :json\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n\n @with_raw = with_raw\n end",
"def create_client(oauth)\n\t\t@client = Twitter::REST::Client.new(\n\t\t\tconsumer_key: oauth[\"consumer_key\"],\n\t\t\tconsumer_secret: oauth[\"consumer_secret\"],\n\t\t\taccess_token: oauth[\"access_token\"],\n\t\t\taccess_token_secret: oauth[\"access_token_secret\"]\n\t\t\t)\n\tend",
"def initialize\n self.http_client = HTTPClient.new(:base_url => Rdioid::BASE_URL, :force_basic_auth => true)\n\n http_client.set_auth(Rdioid::OAUTH_TOKEN_ENDPOINT, Rdioid.config.client_id, Rdioid.config.client_secret)\n end",
"def initialize(from, to, client_secret)\n @from = from\n @to = to\n @client_secret = client_secret\n @access_token = fetch_access_token\n end",
"def create_request_token(params={})\n RequestToken.create :client_application => self, :callback_url=>self.token_callback_url\n end",
"def init_client; end",
"def create\n name = shift_argument\n url = shift_argument\n\n unless name && url\n raise(Heroku::Command::CommandFailed, \"Usage: clients:register [NAME] [CALLBACK_URL]\")\n end\n\n validate!(url)\n client = request do\n api.request(\n :body => encode_json(\n { :name => name, :redirect_uri => url }),\n :expects => 201,\n :headers => headers,\n :method => :post,\n :path => \"/oauth/clients\"\n ).body\n end\n\n if options[:shell]\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Registered client \"#{name}\".})\n styled_hash(client)\n end\n end",
"def create\n\t\tresp = Faraday.get(\"https://foursquare.com/oauth2/access_token\") do |req|\n\t\t\treq.params['client_id'] = ENV['DOHRFWJ4ADKXBXEPFGYU0VMZUWX0135GA3GG1EP0Z5JM0HVS']\n\t\t\treq.params['client_secret'] = ENV['UARMZQVBWT1EHSMRGR52U4TZLEYQISFC0SSBGHUYY3FQ0D1X']\n\t req.params['grant_type'] = 'authorization_code'\n\t req.params['redirect_uri'] = \"http://localhost:3000/auth\"\n req.params['code'] = params[:code]\n end\n\n body = JSON.parse(resp.body)\n session[:token] = body[\"access_token\"]\n redirect_to root_path\n end",
"def access_token_connection\n Faraday.new(access_token_url, headers: headers) do |conn|\n conn.use :breakers\n conn.response :json, content_type: /\\bjson$/\n conn.adapter Faraday.default_adapter\n end\n end",
"def create_client(oauth)\n\t\t@client = Twitter::Client.new(\n\t\t\t consumer_key: oauth[\"consumer_key\"],\n\t\t\t consumer_secret: oauth[\"consumer_secret\"],\n\t\t\t oauth_token: oauth[\"oauth_token\"],\n\t\t\t oauth_token_secret: oauth[\"oauth_token_secret\"]\n\t\t)\n\tend",
"def connect\n require 'restforce' unless defined?(::Restforce)\n username = additional_params[:username] || \"\"\n password = additional_params[:password] || \"\"\n security_token = additional_params[:security_token] || \"\"\n client_id = additional_params[:client_id] || \"\"\n client_secret = additional_params[:client_secret] || \"\"\n instance_url = additional_params[:instance_url] || \"\"\n\n @client = Restforce.new(\n username: username,\n password: password,\n security_token: security_token,\n client_id: client_id,\n client_secret: client_secret,\n instance_url: instance_url\n )\n\n @oauth = @client.authenticate!\n super\n end",
"def initialize(client_id:, client_secret:, token:, refresh_token:, expires_at:)\n @basic_token = Base64.strict_encode64(\"#{client_id}:#{client_secret}\")\n\n @oauth2_client = OAuth2::Client.new(client_id, client_secret,\n authorize_url: 'https://www.fitbit.com/oauth2/authorize',\n token_url: 'https://api.fitbit.com/oauth2/token')\n\n opts = { refresh_token: refresh_token,\n expires_at: expires_at }\n @access_token = OAuth2::AccessToken.new(@oauth2_client, token, opts)\n end",
"def create_sesame_con\n @os_conn = EventMachine::HttpRequest.new($open_sesame_url)\n end",
"def initialize(consumer_key, consumer_secret, token, token_secret)\n @consumer = OAuth::Consumer.new(consumer_key, consumer_secret, {:site => API_HOST})\n @access_token = OAuth::AccessToken.new(@consumer, token, token_secret)\n end",
"def create_request_token(params={})\n\t\tRequestToken.create :client_application => self, :callback_url=>self.token_callback_url\n\tend",
"def oauth_client\n if @oauth_client\n @oauth_client\n else\n conn ||= Faraday::Connection.new \\\n :url => \"https://api.gowalla.com\",\n :headers => default_headers\n\n oauth= OAuth2::Client.new(api_key, api_secret, oauth_options = {\n :site => 'https://api.gowalla.com',\n :authorize_url => 'https://gowalla.com/api/oauth/new',\n :access_token_url => 'https://gowalla.com/api/oauth/token'\n })\n oauth.connection = conn\n oauth\n end\n end",
"def initialize(client_id=nil,client_secret=nil)\n @client_id = client_id\n @client_secret = client_secret\n req1 = RestClient.post(\"https://services.rdio.com/oauth2/token\",\n \"grant_type=client_credentials&client_id=#{@client_id}&client_secret=#{@client_secret}\")\n @access_token = JSON.parse(req1)[\"access_token\"]\n end",
"def oauth\n {\n consumer_key: @consumer_key,\n consumer_secret: @consumer_secret,\n token: @token,\n token_secret: @token_secret\n }\n end",
"def intialize_digital_ocean_api_connection\n if self.application_token.nil?\n raise \"Please assign opstime an application token. You can get an application token from https://cloud.digitalocean.com/settings/applications\"\n else\n self.do_client = DropletKit::Client.new(:access_token => self.application_token)\n end\n end",
"def special_client\n @special_client ||= Twitter::REST::Client.new do |c|\n c.consumer_key = configure[:consumer_key]\n c.consumer_secret = configure[:consumer_secret]\n c.access_token = configure[:access_token]\n c.access_token_secret = configure[:access_token_secret]\n end\n end",
"def create_connection(body)\n raise Auth0::InvalidParameter, 'Must specify a body to create a connection' if body.to_s.empty?\n request_params = body\n post(connections_path, request_params)\n end",
"def initialize(oauth_token_key, oauth_token_secret, params = {})\n @http_logger = params[:logger]\n site = params[:site] || :prod\n @consumer = ::OAuth::Consumer.new(oauth_token_key,\n oauth_token_secret,\n :scheme => :query_string,\n # :scheme => :header,\n :http_method => :get,\n :site => OAUTH_SITES[site],\n :request_token_path => OAUTH_REQUEST_TOKEN_URL,\n :access_token_path => OAUTH_ACCESS_TOKEN_URL,\n :authorize_path => OAUTH_AUTHORIZATION_URL)\n\n if params[:application_type] == APPLICATION_TYPE_ONSITE\n @access_token = ::OAuth::AccessToken.new(@consumer, \"\", \"\")\n elsif params[:access_token]\n @access_token = ::OAuth::AccessToken.new(@consumer,\n params[:access_token],\n params[:access_token_secret])\n end\n if params[:request_token]\n @request_token = ::OAuth::RequestToken.new(@consumer,\n params[:request_token],\n params[:request_token_secret])\n end\n end",
"def access_token_connection\n Faraday.new(access_token_url) do |conn|\n conn.use :breakers\n conn.response :json, content_type: /\\bjson$/\n conn.adapter Faraday.default_adapter\n end\n end",
"def initialize(config)\n $LOG.i('initializing client')\n @config = config\n @epoint = Upwork::Api::DEFAULT_EPOINT\n\t@url_auth, @url_rtoken, @url_atoken = URI_AUTH, URI_RTOKEN, URI_ATOKEN\n @tenant_id = nil\n\n\t@oauth2_client = OAuth2::Client.new(\n @config.client_id,\n @config.client_secret,\n\t :site => Upwork::Api::BASE_HOST,\n\t :authorize_url => @url_auth,\n\t :token_url => @url_atoken,\n\t :connection_opts => { :headers => {'User-Agent' => 'Github Upwork API Ruby Client' }}\n\t)\n end",
"def initialize(client_id, client_secret, opts={})\n self.options = opts.dup\n self.token_method = self.options.delete(:access_token_method) || :post\n adapter = self.options.delete(:adapter)\n ssl_opts = self.options.delete(:ssl) || {}\n connection_opts = ssl_opts ? {:ssl => ssl_opts} : {}\n self.id = client_id\n self.secret = client_secret\n self.site = self.options.delete(:site) if self.options[:site]\n self.connection = Faraday::Connection.new(site, connection_opts)\n self.json = self.options.delete(:parse_json)\n self.raise_errors = !(self.options.delete(:raise_errors) == false)\n\n if adapter && adapter != :test\n connection.build do |b|\n b.adapter(*[adapter].flatten)\n end\n end\n end",
"def new\n @client = Client.new\n end",
"def new\n @client = Client.new\n end",
"def new\n @client = Client.new\n end",
"def create\n #request_token = @client.request_token(:oauth_callback => 'http://127.0.0.1:3000/twitter/new')\n #request_token = @client.request_token(:oauth_callback => 'https://gentle-snow-7462.herokuapp.com/twitter/new')\n request_token = @client.request_token(:oauth_callback => TWITTER_CALLBACK_URL)\n\n session['oauth_request_token_token'] = request_token.token\n session['oauth_request_token_secret'] = request_token.secret\n\n redirect_to request_token.authorize_url\n end",
"def connect\n @connection.create\n end",
"def connect_client(token)\n @client = Soundcloud.new(access_token: token)\n end",
"def init\n init_oauth_access_token\n end",
"def new\n build_client\n end",
"def initialize(api_key, secret_key, base_url='https://api.att.com')\n\t\t@api_key \t\t = api_key\n\t\t@secret_key = secret_key\n\t\t@base_url = base_url\n\t\t@grant_type = 'client_credentials'\n\t\t@scope = 'SPEECH'\n\t\t@access_token = ''\n\t\t@refresh_token = ''\n\t\t\n\t\tcreate_connection\n\t\tget_tokens\n\t\t\n\t\tself\n\tend",
"def connection(response_type = :json)\n @connection ||= Faraday.new(url: 'http://api.mendeley.com') do |connection|\n connection.request :url_encoded\n connection.request :oauth, oauth_data\n connection.response :json, content_type: //\n connection.adapter *Faraday.default_adapter\n end\n end",
"def new\n\t\t@client = Client.new\n\tend",
"def initialize\n get_enterprise_token\n initialize_client\n end",
"def set_oauth2_auth(client, secret, authorize_path, token_path, site = nil)\n FHIR.logger.info 'Configuring the client to use OpenID Connect OAuth2 authentication.'\n @use_oauth2_auth = true\n @use_basic_auth = false\n @security_headers = {}\n options = {\n site: site || @base_service_url,\n authorize_url: authorize_path,\n token_url: token_path,\n raise_errors: true\n }\n client = OAuth2::Client.new(client, secret, options)\n client.connection.proxy(proxy) unless proxy.nil?\n @client = client.client_credentials.get_token\n end",
"def oauth_client(options = {})\n @@linkedin_config ||= LinkedinBackup.load_config\n \n @key = @@linkedin_config['consumer_key']\n @secret = @@linkedin_config['consumer_secret']\n \n @client = Linkedin2::Consumer.new(@key, @secret,options )\n end",
"def establish_connection\n end",
"def client\n @client ||= EvernoteOAuth::Client.new token: auth_token\n end",
"def create_openstack_connection\n Ankus::Openstack.new @credentials[:os_auth_url], @credentials[:os_username], @credentials[:os_password], @credentials[:os_tenant], @log, @mock\n end",
"def client\n @client ||= OAuth2::Client.new( get_config('SMARTCAR_CLIENT_ID'),\n get_config('SMARTCAR_SECRET'),\n :site => OAUTH_PATH\n )\n end",
"def client\n @client ||= OAuth2::Client.new(\n client_id,\n client_secret,\n :site => site,\n :authorize_url => authorize_url,\n :token_url => token_url\n )\n end",
"def initialize(creds={})\n @configuration = {}\n RightSignature2013::Connection.oauth_keys.each do |key|\n @configuration[key] = creds[key].to_s\n end\n\n RightSignature2013::Connection.api_token_keys.each do |key|\n @configuration[key] = creds[key].to_s\n end\n\n @token_connection = RightSignature2013::TokenConnection.new(*RightSignature2013::Connection.api_token_keys.map{|k| @configuration[k]})\n @oauth_connection = RightSignature2013::OauthConnection.new(@configuration)\n\n @configuration\n end",
"def initialize(client_id, client_secret, version='v4', base='https://platform.pokitdok.com')\n @client_id = client_id\n @client_secret = client_secret\n @version = version\n\n @api_url = \"#{base}/api/#{version}\"\n @client = OAuth2::Client.new(@client_id, @client_secret,\n site: @api_url, token_url: '/oauth2/token')\n\n\n @scopes = {}\n @scopes['default'] = { scope: refresh_token }\n scope 'default'\n end",
"def create_api_token\n begin\n ApiToken.create(api_consumer: self)\n end\n end",
"def create_new_connection(options, &block)\n if @connection\n logger.debug(\"[Dokken] shutting previous connection #{@connection}\")\n @connection.close\n end\n\n @connection = Kitchen::Transport::Dokken::Connection.new(options, &block)\n end",
"def create\n puts \"MESSAGE 14 IN CREATE\"\n @auth = request.env['omniauth.auth']['credentials']\n # The following statement saves the tokens to the database\n Token.create(\n access_token: @auth['token'],\n refresh_token: @auth['refresh_token'],\n expires_at: Time.at(@auth['expires_at']).to_datetime)\n end",
"def initialize(application_id, secret, user_token, production = false)\n @connection = Connection.new(application_id, secret, user_token, production)\n end",
"def fire_eagle_request!\n client = FireEagle::Client.new(fire_eagle_config)\n client.get_request_token\n attribute_set(:fe_request_token, client.request_token.token)\n attribute_set(:fe_request_token_secret, client.request_token.secret)\n save\n client\n end",
"def oauth_client\n @oauth_client ||= OAuth2::Client.new @app_key, @app_secret, site: @workxp_site do |stack|\n stack.request :multipart\n stack.request :url_encoded\n stack.adapter :net_http\n end\n end",
"def create\n super\n \n if @access_token.client.uses_account_sid\n # Never expire this token. It will be expired when the user explicitly\n # ends their session (by logging out), and possibly after a configurable\n # amount of time, if the provider is using expiration scheduling\n # (see the sessions:expire rake task).\n @access_token.expires_at = Time.mktime(2100, 12, 31)\n end\n \n authorization_code = Oauth2Providable::AuthorizationCode.find_by_token(params[:code])\n @access_token.account_sid = authorization_code.account_sid\n @access_token.client_sid = params[:client_sid]\n @access_token.save\n end",
"def create\n\t\t# when you authorize Foursquare, it send back to /auth with the :code in the params \n\t\tresp = Faraday.get('https://foursquare.com/oauth2/access_token') do |req|\n\t\t\treq.params['client_id'] = ENV['FOURSQUARE_CLIENT_ID']\n\t\t req.params['client_secret'] = ENV['FOURSQUARE_SECRET']\n\t\t req.params['grant_type'] = 'authorization_code'\n\t\t req.params['redirect_uri'] = \"http://localhost:3000/auth\"\n\t\t req.params['code'] = params[:code]\n\t\tend\n\t\tbody = JSON.parse(resp.body)\n\t\tsession[:token] = body[\"access_token\"]\n\t\tredirect_to root_path\n\tend",
"def new_client(credentials)\n safely do\n return SBCClient.new(credentials.user, credentials.password)\n end\n end",
"def oauth_callback\n at = Marshal.load(session[:qb_request_token]).get_access_token(:oauth_verifier => params[:oauth_verifier])\n \n #There can only be one...\n Qbo.destroy_all\n\n # Save the authentication information \n qbo = Qbo.new\n qbo.qb_token = at.token\n qbo.qb_secret = at.secret\n qbo.token_expires_at = 6.months.from_now.utc\n qbo.reconnect_token_at = 5.months.from_now.utc\n qbo.company_id = params['realmId']\n if qbo.save!\n redirect_to qbo_sync_path, :flash => { :notice => \"Successfully connected to Quickbooks\" }\n else\n redirect_to plugin_settings_path(:redmine_qbo), :flash => { :error => \"Error\" }\n end\n end",
"def create\n client.authorization_code = params[:code]\n access_token = client.access_token!\n puts access_token\n end",
"def initialize\n @client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV['CONSUMER_KEY']\n config.consumer_secret = ENV['CONSUMER_SECRET']\n config.access_token = ENV['ACCESS_TOKEN']\n config.access_token_secret = ENV['ACCESS_TOKEN_SECRET']\n end\n end",
"def oauth2_token_client_credentials\n @token = Oauth2Token.create :client_application=>@client_application, :user=>@client_application.user, :scope=>params[:scope]\n render :json=>@token\n end",
"def oauth2_token_client_credentials\n @token = Oauth2Token.create :client_application=>@client_application, :user=>@client_application.user, :scope=>params[:scope]\n render :json=>@token\n end",
"def get_new_access_token\n now = Time.now\n params = {\n body: {\n grant_type: 'urn:ietf:params:oauth:grant-type:uma-ticket',\n ticket: retrieve_ticket,\n client_id: key_info['oxtrust_client_id'],\n client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',\n client_assertion: generate_json_web_token(now),\n scope: 'oxtrust-api-read oxtrust-api-write'\n }\n }\n req = HTTParty.post('https://localhost/oxauth/restv1/token', params)\n if req.code == 200\n token = req['access_token']\n save_access_token(token, now.to_i + 86_400)\n token\n else\n Puppet.err(\n \"Gluu API HTTP #{req.code}: #{req['error_description']}\",\n )\n end\n end",
"def new\n resource.uuid ||= current_admin.default_beacon_uuid\n @beacon = resource.decorate\n new!\n end",
"def initialize(params)\n\n @client_id = params[:client_id]\n @client_token_id = params[:client_token_id]\n @token_symbol = params[:token_symbol]\n\n end",
"def connection(refresh = false)\r\n @connection = TAMINO if @credentials.nil? && @connection.nil?\r\n @connection = TaminoApi.new(@credentials[:host], @credentials[:port], @credentials[:database], @credentials[:username], @credentials[:password]) if refresh || @connection.nil?\r\n @connection.setHttpRequestMethod(\"POST\")\r\n @connection.setCollection(@collection)\r\n @connection\r\n end",
"def new_client(id, env, private_key, secret)\n app_config = AppConfig.new(\n id: id,\n env: env,\n private_key: private_key,\n secret: secret\n )\n\n Client.new(config: app_config)\n end",
"def initialize( user_token = nil, user_secret = nil )\n\t\t@consumer = OAuth::Consumer.new(TWOAUTH_KEY, TWOAUTH_SECRET, { :site=> TWOAUTH_SITE })\n\t\t@access_token = OAuth::AccessToken.new( @consumer, user_token, user_secret ) if user_token && user_secret\n end",
"def conn\n @conn ||= Faraday.new(url: authentication_uri.to_s) do |builder|\n builder.adapter Faraday.default_adapter\n end\n end",
"def create_api_credentials\n ::ApiCredentials::Create.new({client_id:@client_id}).perform\n end",
"def initialize(options = {})\n client_id = options[:client_id]\n\n @oauth2_client = TwitchOAuth2::Client.new(\n client_id: client_id, **options.slice(:client_secret, :redirect_uri, :scopes)\n )\n\n @token_type = options.fetch(:token_type, :application)\n\n @tokens = @oauth2_client.check_tokens(\n **options.slice(:access_token, :refresh_token), token_type: @token_type\n )\n\n CONNECTION.headers['Client-ID'] = client_id\n\n renew_authorization_header if access_token\n end",
"def build_client(access_token)\n begin\n client = Octokit::Client.new(access_token: access_token)\n client.user.login\n rescue Octokit::Unauthorized\n raise 'Please enter valid Personal Auth Token'\n end\n client\n end",
"def initialize(connexion:, token:, secret:)\n @connexion = connexion\n @token = token\n @secret = secret\n end",
"def client\n # @client ||= MyService::Client.new(SinaToken.consumer.key, SinaToken.consumer.secret, token, secret)\n end",
"def oauth2_token_client_credentials\n @token = Oauth2Token.create(:client_application => @client_application, :scope=>params[:scope])\n render :json => @token\n end",
"def client\n Faraday.new(url: URL) do |c|\n c.token_auth self.auth_token\n c.request :url_encoded # form-encode POST params\n c.adapter Faraday.default_adapter # Net::HTTP\n end\n end",
"def initialize(token, url, params = {})\n super(token, url)\n @params = {\n grant_type: \"password\",\n client_id: ENV[\"SHOWOFF_CLIENT_ID\"],\n client_secret: ENV[\"SHOWOFF_CLIENT_SECRET\"],\n }.merge(params)\n @header = ShowoffHeader.new().perform\n end",
"def initialize(read_token:, write_token: nil)\n @read_client = create_http_client(read_token)\n @write_client = create_http_client(write_token) unless write_token.nil?\n end",
"def initialize(*args)\n raise ArgumentError, \"Requires at least the api_key and secret_key when instatiating\" if args.size == 0\n\n base_url = 'https://api.att.com'\n\n if args.size == 1 && args[0].instance_of?(Hash)\n args = args.shift\n @api_key = args[:api_key]\n @secret_key = args[:secret_key]\n @base_url = args[:base_url] || base_url\n set_ssl_verify args[:ssl_verify]\n else\n @api_key = args.shift\n @secret_key = args.shift\n @base_url = args.shift || base_url\n set_ssl_verify args.shift\n end\n\n @grant_type = 'client_credentials'\n @access_token = ''\n @refresh_token = ''\n\n create_connection 'application/json'\n\n get_tokens\n\n Actor.current\n end",
"def initialize\n api_key = ENV[\"TWITTER_API_KEY_ID\"]\n api_secret = ENV[\"TWITTER_API_SECRET\"]\n ##will be current_user.access_token\n access_token = ENV[\"TWITTER_ACCESS_TOKEN\"]\n access_token_secret = ENV[\"TWITTER_ACCESS_SECRET_TOKEN\"]\n\n @twitter_client = Twitter::REST::Client.new do |config|\n config.consumer_key = api_key\n config.consumer_secret = api_secret\n config.access_token = access_token\n config.access_token_secret = access_token_secret\n end\n\n end",
"def connect\n @client = @client_class.new\n @client.connect\n \n begin\n yield\n ensure\n @client.close\n ActiveRecord::Base.verify_active_connections!\n end\n end",
"def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend",
"def initialize(client_id, client_secret, refresh_token)\n merge!(\n {\n client_id: client_id,\n client_secret: client_secret,\n refresh_token: refresh_token,\n grant_type: \"refresh_token\"\n }\n )\n end",
"def generate_keys\n self.client_id = OAuth::Helper.generate_key(40)[0,40]\n self.client_secret_hash = OAuth::Helper.generate_key(40)[0,40]\n end",
"def initialize(instance, user: nil, password: nil, oauth_token: nil, client_id: nil, client_secret: nil, use_ssl: true)\n #instance example: https://dev99218.service-now.com\n instance_with_protocol = use_ssl ? \"https://#{instance}\" : \"http://#{instance}\"\n @instance = URI.parse(instance_with_protocol)\n @user = user\n @password = password\n if (client_id && client_secret && user && password)\n @oauth_token = get_token(client_id, client_secret)\n else\n @oauth_token = oauth_token\n end\n end"
] | [
"0.6380972",
"0.62495327",
"0.6106842",
"0.6075413",
"0.6040838",
"0.594724",
"0.5946612",
"0.59366834",
"0.5933798",
"0.58959275",
"0.58607024",
"0.583236",
"0.58179176",
"0.5784521",
"0.5774283",
"0.5768779",
"0.5752608",
"0.57318664",
"0.5723591",
"0.5723143",
"0.57165766",
"0.5707076",
"0.5688549",
"0.56802076",
"0.56646276",
"0.56641436",
"0.56607693",
"0.5652025",
"0.56516886",
"0.5643711",
"0.562531",
"0.5619091",
"0.5612645",
"0.55991703",
"0.55947393",
"0.55929935",
"0.5579322",
"0.55714107",
"0.55708236",
"0.5565338",
"0.55437654",
"0.55375445",
"0.55347234",
"0.55347234",
"0.55347234",
"0.55239725",
"0.5509687",
"0.55075634",
"0.5500865",
"0.549612",
"0.54817706",
"0.54783195",
"0.5477243",
"0.5476982",
"0.5461695",
"0.5453512",
"0.5452066",
"0.54276824",
"0.54239756",
"0.54239595",
"0.54140544",
"0.54091495",
"0.5404052",
"0.5403953",
"0.53981066",
"0.53947866",
"0.5384939",
"0.53832483",
"0.5378501",
"0.5370173",
"0.53690594",
"0.5367926",
"0.53670675",
"0.5358051",
"0.5346497",
"0.533309",
"0.533309",
"0.5331",
"0.53218067",
"0.53209543",
"0.53209317",
"0.531922",
"0.5316961",
"0.531603",
"0.53152907",
"0.5313187",
"0.5310243",
"0.5309241",
"0.530802",
"0.53076744",
"0.53064555",
"0.5299329",
"0.52958095",
"0.5295",
"0.52924794",
"0.5289279",
"0.5289067",
"0.5287615",
"0.52873147",
"0.5287258"
] | 0.7369405 | 0 |
Connect as an application No user credentials are required Not recommended and poorly supported Require ApplicationID and ApplicationSecret | def connection_for_application
oauth_client.client_credentials.get_token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_application(application_name)\n if application_name.nil? || application_name == ''\n throw 'Bad application name'\n end\n res = nil\n applicaiton_init_uri = URI(@url + \"sys/auth/#{application_name}\")\n req = Net::HTTP::Post.new(applicaiton_init_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_init_uri.hostname, applicaiton_init_uri.port) do |http|\n req.body = { 'type' => 'app-id' }.to_json\n http.request(req)\n end\n res.code.to_i\n end",
"def as_app(key = client_id, secret = client_secret, &block)\n if key.to_s.empty? || secret.to_s.empty?\n raise ApplicationCredentialsRequired, \"client_id and client_secret required\"\n end\n app_client = self.dup\n app_client.client_id = app_client.client_secret = nil\n app_client.login = key\n app_client.password = secret\n\n yield app_client if block_given?\n end",
"def connect\n\t\tif params['dropbox_app_key'] == '' or params['dropbox_app_secret'] == ''\n\t\t\tredirect_to :back, flash: { error: 'Please do provide some actual values.' } and return\n\t\tend\n\n\t\tSettings['dropbox.app_key'] = params['dropbox_app_key']\n\t\tSettings['dropbox.app_secret'] = params['dropbox_app_secret']\n\t\tdropbox = DropboxConnection.new\n\t\tredirect_to dropbox.create_session(dropbox_oauth_url)\n\tend",
"def app_credentials\n {user: @config['mysql_app_user'], pass: @config['mysql_app_password']}\n end",
"def initialize\n @app_name = ENV[\"app_name\"]\n @app_password = ENV[\"app_password\"]\n @app_username = ENV[\"app_username\"]\n @faraday_adapter = Faraday.default_adapter\n end",
"def initialize(app_id, app_secret, api_key, email, password)\n\n merge!(\n {\n applicationCredentials: {\n applicationId: app_id,\n applicationSecret: app_secret\n },\n userCredentials: {\n apiKey: api_key,\n email: email,\n password: password \n }\n }\n )\n end",
"def initialize(application_id, secret, user_token, production = false)\n @connection = Connection.new(application_id, secret, user_token, production)\n end",
"def setupApp(pia_url, app_key, app_secret)\n token = getToken(pia_url, app_key, app_secret)\n { \"url\" => pia_url,\n \"app_key\" => app_key,\n \"app_secret\" => app_secret,\n \"token\" => token }\nend",
"def connect!\n @connection = user ? connection_for_user : connection_for_application\n @auth_token = @connection.token\n BeaconClient.logger.debug(\"Client token: #{@auth_token}\") if BeaconClient.config.debug?\n @auth_token\n rescue OAuth2::Error => error\n BeaconClient.logger.error(error.message)\n BeaconClient.logger.error(error.backtrace.join(\"\\n\"))\n end",
"def initialize(username, password, application)\n @name = username\n @application = application\n @password = password\n end",
"def initialize(app_id, app_secret)\n @app_id = app_id\n @app_secret = app_secret\n end",
"def set_oauth_application\n @oauth_application = Doorkeeper::Application.find(params[:oauth_application_id])\n end",
"def client\n ::DelegatedAuthentication.new(options[:app_id], options[:app_secret], nil, nil, options[:privacy_url], callback_url)\n end",
"def third_party_apps\n # Displays the user's 3rd party applications profile page\n authorize ::User\n\n @identifier_schemes = IdentifierScheme.for_users.order(:name)\n @tokens = current_user.access_tokens.select { |token| token.revoked_at.nil? }\n end",
"def connect\n require 'restforce' unless defined?(::Restforce)\n username = additional_params[:username] || \"\"\n password = additional_params[:password] || \"\"\n security_token = additional_params[:security_token] || \"\"\n client_id = additional_params[:client_id] || \"\"\n client_secret = additional_params[:client_secret] || \"\"\n instance_url = additional_params[:instance_url] || \"\"\n\n @client = Restforce.new(\n username: username,\n password: password,\n security_token: security_token,\n client_id: client_id,\n client_secret: client_secret,\n instance_url: instance_url\n )\n\n @oauth = @client.authenticate!\n super\n end",
"def new_client_application\n OAuth2::Client.new(caller_service.client_id, caller_service.client_secret, :site => authorizator_service.site, :raise_errors => false)\n end",
"def connect(options)\n # @api_client = establish_remote_appliance_connection(options)\n @api_client = establish_remote_appliance_connection(options.merge({:skip_verify_access_token => true, :skip_login => true}))\n @whoami_interface = @api_client.whoami\n end",
"def connect(options)\n @api_client = establish_remote_appliance_connection(options.merge({:no_prompt => true, :skip_verify_access_token => true, :skip_login => true}))\n # automatically get @appliance_name, @appliance_url, @wallet\n if !@appliance_name\n raise_command_error \"#{command_name} requires a remote to be specified, use -r [remote] or set the active remote with `remote use`\"\n end\n if !@appliance_url\n unless options[:quiet]\n print red,\"Unable to determine remote appliance url. Review your remote configuration.#{reset}\\n\"\n end\n return 1\n end\n #@wallet = Morpheus::Cli::Credentials.new(@appliance_name, @appliance_url).load_saved_credentials()\n if @wallet.nil? || @wallet['access_token'].nil?\n unless options[:quiet]\n print_error yellow,\"You are not currently logged in to #{display_appliance(@appliance_name, @appliance_url)}\",reset,\"\\n\"\n print_error yellow,\"Use `login` to authenticate or try passing the --username option.\",reset,\"\\n\"\n end\n return 1\n end\n return 0\n end",
"def establish_connection!\n return if [app_path, username, password].select{|f| f.blank? }.length > 0\n Basecamp.establish_connection!(app_path, username, password, true) unless @connection_established\n @connection_established = true\n end",
"def authenticate_app\n payload = {\n # The time that this JWT was issued, _i.e._ now.\n iat: Time.now.to_i,\n\n # JWT expiration time (10 minute maximum)\n exp: Time.now.to_i + (10 * 60),\n\n # Your GitHub App's identifier number\n iss: APP_IDENTIFIER\n }\n logger.debug \"JWT payload: #{payload}\"\n\n # Cryptographically sign the JWT.\n jwt = JWT.encode(payload, PRIVATE_KEY, 'RS256')\n\n # Create the Octokit client, using the JWT as the auth token.\n @app_client ||= Octokit::Client.new(bearer_token: jwt)\n end",
"def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end",
"def call(env)\n @app.call(env)\n rescue QuickbooksOnlineRuby::UnauthorizedError\n authenticate!\n raise\n end",
"def seed_api_key\n\t\t\tDoorkeeper::Application.create(name: \"sample app\", \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t uid: \"836ec399a145ffafbd7774c57e06960397b77a53bb1ccc03d4e45d95d0c31a3d\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t secret: \"cf8dc84d17c69e17a8b9d74ec971bdb636f231d3ba7d2ad2ebfca45bdc8ae3c9\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t redirect_uri: \"urn:ietf:wg:oauth:2.0:oob\")\n\t\tend",
"def set_application\n @application = current_user.oauth_applications.find(params[:id])\n end",
"def oauth_application(token)\n request(\n __method__,\n :get,\n \"#{api_base}/oauth2/applications/@me\",\n Authorization: token\n )\n end",
"def authenticate\n raise \"client_id and client_secret required\" unless application_credentials?\n\n set_access_token_from_params(nil)\n without_authentication do\n post('/login', {}, :query => application_credentials)\n raise \"login failure #{last_response.status}\" unless last_response.status == 200\n set_access_token_from_params(last_response.data)\n end\n end",
"def initialize(appid=nil, secret=nil, securityalgorithm=nil)\n self.appid = appid if appid\n self.secret = secret if secret\n self.securityalgorithm = securityalgorithm if securityalgorithm\n end",
"def app\n BatchConnect::App.from_token(self.token)\n end",
"def connect!(in_user, in_password, in_host)\n begin\n @sa_connection=OpswareClient\n @sa_connection.connect(\"https\".to_java, in_host, port, in_user, in_password, true)\n require 'sasync/hpsa_tools/hpsa_tools'\n extend Sasync::HpsaTools\n rescue NativeException => e\n puts \"Error during connection with error: #{e}\"\n return\n end\n\n self.initialize_framework\n #puts @sa_connection.isConnected\n #puts connection_info\n end",
"def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end",
"def authorize_application\n # init auth state and oauth url..enter wormhole\n oauth = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, GIFT_AUTH_CALLBACK)\n encoded_auth_state = create_auth_state\n oauth_url = create_oauth_url(oauth.oauth_callback_url, encoded_auth_state)\n redirect_to(:action => \"exit_portal\", :url => oauth_url) and return\n end",
"def openid_client_secret=(_arg0); end",
"def add_client_app\n @client = Strava::OAuth::Client.new(\n client_id: ENV['STRAVA_CLIENT_ID'],\n client_secret: ENV['STRAVA_CLIENT_SECRET']\n )\n end",
"def openid_client_secret; end",
"def authenticate_client_app!\n returned_app = nil\n \n @group_id = params.delete(:group_id)\n logger.info(\"INSPECT: group_id => #{@group_id}\")\n \n if params[:noauth]\n @app_instance = App.first\n return true\n end\n \n authenticate_with_http_basic do |app_id, api_token|\n creds = { id: app_id, key: api_token}\n logger.info(\"INSPECT: credentials => #{creds}\")\n \n @app_instance = App.identify(app_id,api_token,@group_id)\n end\n \n if request.env[\"HTTP_AUTHORIZATION\"].blank?\n logger.info(\"INSPECT: credentials => none\")\n end\n \n unless @app_instance\n render json: { errors: process_errors([\"Unauthorized Access\"], 401) }, status: :unauthorized\n return false\n end\n \n true\n end",
"def authenticate_client_app!\n returned_app = nil\n \n @group_id = params.delete(:group_id)\n logger.info(\"INSPECT: group_id => #{@group_id}\")\n \n if params[:noauth]\n @app_instance = App.first\n return true\n end\n \n authenticate_with_http_basic do |app_id, api_token|\n creds = { id: app_id, key: api_token}\n logger.info(\"INSPECT: credentials => #{creds}\")\n \n @app_instance = App.identify(app_id,api_token,@group_id)\n end\n \n if request.env[\"HTTP_AUTHORIZATION\"].blank?\n logger.info(\"INSPECT: credentials => none\")\n end\n \n unless @app_instance\n render json: { errors: process_errors([\"Unauthorized Access\"], 401) }, status: :unauthorized\n return false\n end\n \n true\n end",
"def create\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n respond_with( :oauth, @application, location: oauth_application_url( @application ) )\n else\n render :new\n end\n end",
"def set_application\n @application = current_student.current_application\n user_not_authorized unless @application.awaiting_payment? || @application.payment_failed?\n end",
"def check_app_auth(client_id, client_secret, response_type, state)\n error = false\n\n if Settings.multi_application == 'true'\n app = App.where(id: client_id).first\n if app.nil?\n flash[:error] = 'App not found'\n error = true\n redirect_to root_path\n else\n if response_type == 'code'\n if !app.enable_code\n error = true\n url = generate_url(app.redirect_uri, error: 'unsupported_response_type', error_description: 'Code response type not allowed', state:state)\n redirect_to url\n elsif !app.password_correct?(client_secret)\n error = true\n url = generate_url(app.redirect_uri, error: 'access_denied', error_description: \"App secret #{client_secret} for app #{client_id} incorrect\", state:state)\n redirect_to url\n end\n elsif !app.enable_implicit and response_type == 'token'\n error = true\n url = generate_url(app.redirect_uri, error: 'unsupported_response_type', error_description: 'Token (implicit) response type not allowed', state:state)\n redirect_to url\n elsif response_type != 'code' and response_type != 'token'\n error = true\n url = generate_url(app.redirect_uri, error: 'unsupported_response_type', error_description: 'Response type not supported', state:state)\n redirect_to url\n end\n end\n else\n if Settings.single_application_mode_id != client_id\n error = true\n url = generate_url(Settings.single_application_mode_url + Settings.single_application_mode_path, error: 'access_denied', error_description: 'App id and/or secret incorrect', state:state)\n redirect_to url\n elsif response_type == 'code'\n if Settings.single_application_mode_enable_code == 'false'\n error = true\n url = generate_url(Settings.single_application_mode_url + Settings.single_application_mode_path, error: 'unsupported_response_type', error_description: 'Code response type not allowed', state:state)\n redirect_to url\n elsif Settings.single_application_mode_secret != client_secret\n error = true\n url = generate_url(Settings.single_application_mode_url + Settings.single_application_mode_path, error: 'access_denied', error_description: 'App id and/or secret incorrect', state:state)\n redirect_to url\n end\n elsif Settings.single_application_mode_enable_implicit == 'false' and response_type == 'token'\n error = true\n url = generate_url(Settings.single_application_mode_url + Settings.single_application_mode_path, error: 'unsupported_response_type', error_description: 'Token (implicit) response type not allowed', state:state)\n redirect_to url\n elsif response_type != 'code' and response_type != 'token'\n error = true\n url = generate_url(Settings.single_application_mode_url + Settings.single_application_mode_path, error: 'unsupported_response_type', error_description: 'Response type not supported', state:state)\n redirect_to url\n end\n end\n destroy_session if error\n\n error\n end",
"def create_for_app(app_auth_request = nil)\n build_request(app_auth_request || { api_key: @api_key, client_secret: @secret },\n Requests::AuthenticateApp).\n send_to_api(:post, endpoint_path)\n end",
"def app_secret\n @app_secret ||= if self.encoding_app_secret.present?\n CryptService.decrypt(self.encoding_app_secret)\n end\n end",
"def bot_application\n return unless @type == :bot\n\n response = API.oauth_application(token)\n Application.new(JSON.parse(response), self)\n end",
"def open_app(server, app, cube)\n raise NotConnectedError, \"No provider connection established\" unless @session_id && @provider\n\n # Reset app state\n @dimensions = nil\n\n # Connect to application\n @logger.info \"Opening cube #{app}.#{cube} on #{server}\"\n @req.OpenApplication do |xml|\n xml.sID @session_id\n if @sso\n xml.sso @sso\n else\n xml.usr @user\n xml.pwd @password\n end\n xml.srv server\n xml.app app\n end\n invoke\n\n # Obtain an SSO token for subsequent use\n unless @sso\n @req.GetSSOToken do |xml|\n xml.sID @session_id\n end\n @sso = invoke.at('//res_GetSSOToken/sso').inner_html\n @password = nil # Don't remember password any longer than we need to\n end\n\n # Open cube\n @req.OpenCube do |xml|\n xml.sID @session_id\n xml.srv server\n xml.app app\n xml.cube cube\n end\n invoke\n @app = app\n @cube = cube\n\n # Get default POV\n default_pov\n end",
"def connect_code\n if @config.db_general_authmode == :winauth\n @config.db_connect_string_winauth.gsub(/@host@/, host).\n gsub(/@initialcatalog@/, name)\n else\n @config.db_connect_string_sqlauth.gsub(/@host@/, host).\n gsub(/@initialcatalog@/, name).\n gsub(/@user@/, user).\n gsub(/@password@/, @config.db_general_password)\n end\n end",
"def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end",
"def set_app_environment_credential\n @app_environment_credential = AppEnvironmentCredential.find(params[:id])\n end",
"def create\n authorize @application, policy_class: Oauth::ApplicationPolicy\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if T.unsafe(Doorkeeper).configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end",
"def user_apps\n Application.with_user(session[:user_id])\n end",
"def create_oauth_application(name, redirect_uris)\n response = JSON.parse(API.create_oauth_application(@token, name, redirect_uris))\n [response['id'], response['secret']]\n end",
"def create_oauth_application(name, redirect_uris)\n response = JSON.parse(API.create_oauth_application(@token, name, redirect_uris))\n [response['id'], response['secret']]\n end",
"def authenticate_account(client, options)\n if options[:application].nil? or options[:username].nil? or options[:password].nil? \n puts \"Missing arguments\"\n return\n end\n\n application = client.applications.get options[:application]\n request = Stormpath::Authentication::UsernamePasswordRequest.new options[:username], options[:password]\n begin\n result = application.authenticate_account request\n puts \"Authentication: SUCCESS\"\n puts \"Account Href: \" + result.account.href\n \n rescue Stormpath::Error => e\n puts \"Authentication: FAILURE\"\n print_error(e)\n end\nend",
"def create\n @app = App.new app_params\n @app.user = current_user\n \n if @app.valid?\n\n openid_client = Services::OpenIdConnectionService.new(@app).register\n\n\n if openid_client[\"client_id\"].present?\n @app.openid_client_id = openid_client[\"client_id\"]\n @app.openid_client_secret = openid_client[\"client_secret\"]\n @app.openid_client_access_token = openid_client[\"registration_access_token\"]\n @app.save\n end\n end\n\n respond_to do |format|\n if @app.persisted?\n format.html { redirect_to app_path(@app), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(app_id, app_secret, uuid = nil, hostname = 'gocarrot.com')\n @app_id = app_id\n @app_secret = app_secret\n @uuid = uuid\n @hostname = hostname\n end",
"def application_credentials?\n !!application_credentials\n end",
"def application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)\n # attempt to extract a token from the url\n FBSession.activeSession.handleOpenURL(url)\n end",
"def login\n client.login(\n params[:user],\n params[:password],\n authParams: {\n scope: 'openid name email'\n },\n connection: 'Username-Password-Authentication'\n )\n end",
"def app_key \n 'app-id-9bb5f1c77f0df722a9b1bc650a41988a'\n end",
"def initialize(options= {})\n @login = options[:login] || ENV['VZAAR_LOGIN'] || ''\n application_token = options[:application_token] || ENV['VZAAR_APPLICATION_TOKEN'] || ''\n server = options[:server] || ENV['VZAAR_SERVER'] || VZAAR_LIVE_SERVER\n @logger = options[:logger] || Logger.new(STDOUT)\n\n server.gsub! 'http://', ''\n server.gsub! 'https://', ''\n consumer = OAuth::Consumer.new '', '', { :site => \"http://#{server}\" }\n @public_connection = OAuth::AccessToken.new consumer, '', ''\n consumer = OAuth::Consumer.new '', '', { :site => \"https://#{server}\" }\n if @login.length > 0 and application_token.length > 0\n @auth_connection = OAuth::AccessToken.new consumer, @login, application_token\n else\n # Authenticated requests won't be possible\n @auth_connection = nil\n log_info \"Authenticated calls won't be possible\"\n end\n end",
"def app_params\n params.require(:app).permit(:key, :identifier, :environment, :password, :certificate, :sandbox)\n end",
"def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end",
"def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end",
"def initialize(app_id, secret)\n options = {\n site: Parameter::SITE,\n authorize_url: AUTHORIZE_URL,\n token_url: TOKEN_URL\n }\n\n raise 'アプリケーションIDが入力されていません' if app_id.empty?\n raise 'Secretが入力されていません' if secret.empty?\n @client = OAuth2::Client.new(app_id, secret, options)\n end",
"def connect\n\t\tif !@twitter && @active && password\n\t\t\tputs \"connecting\"\n\t\t\t\n\t\t\t@twitter = OSX::MGTwitterEngine.alloc.initWithDelegate(self)\n\t\t\t@twitter.usesSecureConnection = true\n\t\t\t@twitter.setUsername_password(@username,password)\n\t\tend\n\tend",
"def auth\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"params=#{params}\",\n \"\" ] if browse_everything_controller_debug_verbose\n # params contains the access code with with the key :code\n provider_session.token = provider.connect(params, provider_session.data, connector_response_url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider_session.token=#{provider_session.token}\",\n \"\" ] if browse_everything_controller_debug_verbose\n provider_session.token\n end",
"def initialize(user, password, application_name, host=\"192.168.0.8\", port=3790, mode='multiUser')\n @user = user\n @password = password\n @application_name = application_name\n @host = host\n @port = port\n @mode = mode\n @ticket = nil\n @soap_client = nil \n end",
"def client_application\n @client_application ||= new_client_application\n end",
"def authenticate\n callback = qbo_oauth_callback_url\n token = Qbo.get_oauth_consumer.get_request_token(:oauth_callback => callback)\n session[:qb_request_token] = Marshal.dump(token)\n redirect_to(\"https://appcenter.intuit.com/Connect/Begin?oauth_token=#{token.token}\") and return\n end",
"def get_app the_host, the_user, the_pass\n app = ImapClear::App.new\n app.host = the_host\n app.port = 993\n app.user = the_user\n app.pass = the_pass\n\n app\nend",
"def connect_client\n if user = User.find_by_id(session[:user])\n $client = DropboxClient.new(user.auth_token)\n end\n end",
"def connect \n\t\t\tfirst_tentative = true\n\t\t\tbegin\n\t\t\t\tdatabase = ActiveOrient.database\n\t\t\t\tlogger.progname = 'OrientDB#Connect'\n\t\t\t\tr = ActiveOrient.db_pool.checkout do | conn |\n\t\t\t\t\tr = conn[\"/connect/#{database}\"].get\n\t\t\t\tend\n\t\t\t\tif r.code == 204\n\t\t\t\t\tlogger.info{\"Connected to database #{database}\"}\n\t\t\t\t\ttrue\n\t\t\t\telse\n\t\t\t\t\tlogger.error{\"Connection to database #{database} could NOT be established\"}\n\t\t\t\t\tnil\n\t\t\t\tend\n\t\t\trescue RestClient::Unauthorized => e\n\t\t\t\tif first_tentative\n\t\t\t\t\tlogger.info{\"Database #{database} NOT present --> creating\"}\n\t\t\t\t\tfirst_tentative = false\n\t\t\t\t\tcreate_database database: database\n\t\t\t\t\tretry\n\t\t\t\telse\n\t\t\t\t\tKernel.exit\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def facebook_oauth\n # Insert your own Facebook client ID and secret here\n # auth = Koala::Facebook::OAuth.new(ENV[\"FACEBOOK_KEY\"], ENV[\"FACEBOOK_SECRET\"])\n\n @facebook_oauth = Koala::Facebook::OAuth.new(ENV[\"FACEBOOK_KEY\"], ENV[\"FACEBOOK_SECRET\"])\n\n\n\n end",
"def create\n\t\t@application = Application.new(params[:application])\n\n\t\tif @application.save\n\t\t\tflash[:developer] = \"Yay! Your application has been registered!\"\n\t\t\tcurrent_developer.applications << @application\n\t\t\t# Randomizer as in http://goo.gl/qpI5Rv\n\t\t\taccess_token = Array.new(32){rand(36).to_s(36)}.join\n\t\t\tkey = ApiKey.create(:access_token => access_token)\n\t\t\tkey.application = @application\n\t\t\tkey.save\n\t\t\tredirect_to developer_home_path\n\t\telse\n\t\t\trender :action => 'register'\n\t\tend\n\tend",
"def credentials(app_name=nil)\n #bound_app is the name of an app bound to the dat-service and that credentials\n #should be used to access the data-service.\n #for example if an app creates large objects you will need to use\n #the credentials of that app to find the objects.\n app_name ||= @wrapped['director']['bound_app'] if @wrapped['director']\n @credentials ||= VMC::KNIFE.get_credentials(name(), app_name)\n @credentials\n end",
"def current_application\n fail 'Application ID is missing' unless params.key?(:application_id)\n applications = current_user.applications\n applications.where(id: params[:application_id]).first\n end",
"def connect\n\n # Initialize the gem\n ShopifyAPI::Session.setup({api_key: @api_key, secret: @shared_secret})\n\n # Instantiate the session\n session = ShopifyAPI::Session.new(@url, @password)\n\n # Activate the Session so that requests can be made\n return ShopifyAPI::Base.activate_session(session)\n\n end",
"def facebook_client\n FacebookClient.new FB_CONFIG[:client_id], FB_CONFIG[:secret_id],\n session[:access_token]\n end",
"def connect\n first_tentative = true\n begin\n\tdatabase = ActiveOrient.database\n logger.progname = 'OrientDB#Connect'\n r = @res[\"/connect/#{database}\"].get\n if r.code == 204\n \t logger.info{\"Connected to database #{database}\"}\n \t true\n \t else\n \t logger.error{\"Connection to database #{database} could NOT be established\"}\n \t nil\n \t end\n rescue RestClient::Unauthorized => e\n if first_tentative\n \t logger.info{\"Database #{database} NOT present --> creating\"}\n \t first_tentative = false\n \t create_database database: database\n \t retry\n else\n \t Kernel.exit\n end\n end\n end",
"def initialize(crowd_url, app_name, app_password, options = {})\n @crowd_url = crowd_url\n @crowd = Savon::Client.new(@crowd_url + (Client.debug? ? '?wsdl' : ''))\n if options[:verify_cert] == false\n @crowd.request.http.ssl_client_auth(:verify_mode => OpenSSL::SSL::VERIFY_NONE)\n end\n @app_name = app_name\n @app_password = app_password\n @app_token = nil\n end",
"def app_params\n params.require(:app).permit(:name, :platform, :openid_redirect_urls, :token_endpoint_auth_method, :openid_client_secret, :openid_client_id, :contacts, :client_uri, :policy_uri, :tos_uri, :logo_uri )\n end",
"def crowd_app_password(password=nil)\r\n rw_config(:crowd_app_password, password, nil)\r\n end",
"def client_id_secret\n {\n client_id: ENV['CLIENT_ID'], \n client_secret: ENV['CLIENT_SECRET'], \n }\n end",
"def create_application_token!(user)\n ApplicationToken.create_token(\n current_user: current_user,\n user_id: user.id,\n params: { application: \"default\" }\n )\n end",
"def connection_for_user\n BeaconClient.logger.debug([user.email.inspect, user.password.inspect].join(' : '))\n oauth_client.password.get_token(\n user.email, user.password,\n email: user.email\n )\n end",
"def authenticate_application(opts = {})\n data, _status_code, _headers = authenticate_application_with_http_info(opts)\n data\n end",
"def initialize(app, name, client_id=nil, client_secret=nil, client_options={}, options={}, &block)\n self.client_id = client_id\n self.client_secret = client_secret\n self.client_options = client_options\n super\n end",
"def fb_app_id\n ENV['facebook_app_id']\n end",
"def channel_app_secret\n ENV['SHOPIFY_CHANNEL_APP_SECRET']\n end",
"def create_application_id(application_name)\n applicaiton_id = VaultDriver.generate_uid\n applicaiton_create_uri = URI(@url + \"auth/#{application_name}/map/app-id/#{applicaiton_id}\")\n req = Net::HTTP::Post.new(applicaiton_create_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_create_uri.hostname, applicaiton_create_uri.port) do |http|\n req.body = { 'value' => 'root', 'display_name' => application_name.to_s }.to_json\n http.request(req)\n end\n [applicaiton_id, res.code.to_i]\n end",
"def use_demo_credentials!\n self.username = 'demo'\n self.password = 'password'\n end",
"def app(create=false)\r\n @app_integration_instance = nil if create\r\n @app_integration_instance ||= new_session do |sess|\r\n sess.host! \"www.example.com\"\r\n end\r\nend",
"def client_secret; end",
"def third_party_connect\n if tw_user_id.nil? && fb_user_id.nil?\n errors.add(\"Either twitter or facebook connect required\") \n end\n end",
"def authenticate(connect_id, secret_key)\n @connect_id, @secret_key = connect_id, secret_key\n end",
"def app_portal\n\t if params[:individual_user_id] && params[:secret]\n\t login(params[:individual_user_id], params[:secret])\n\t end\n\t\n # pathway parameter indicates that the app should return to a specific page\n if params[:pathway]\n\t redirect_returning_user(params[:pathway],params)\n\t end\n end",
"def application_authenticated?\n !!(@client_id && @client_secret)\n end",
"def initialize(app, realm = nil, &authenticator)\n @app = app\n @realm = realm\n @authenticator = authenticator\n end",
"def create_application(client, options)\n if options[:name].nil? or options[:description].nil?\n puts \"Missing arguments\"\n end\n \n application = client.applications.create({\n name: options[:name],\n description: options[:description]\n })\n puts \"Application created.\"\n\n #TODO: Add exception handling\nend",
"def authenticate_manual \n api_key = request.headers['X-Api-Key']\n @app = App.where(api_key: api_key).first if api_key\n\n unless @app\n head status: :unauthorized\n return false\n end\n end",
"def connect(options = {})\n raise MiqException::MiqHostError, \"No credentials defined\" if missing_credentials?(options[:auth_type])\n\n auth_token = authentication_token(options[:auth_type])\n username = options[:user] || authentication_userid(options[:auth_type])\n password = options[:pass] || authentication_password(options[:auth_type])\n host = options[:host] || address\n port = options[:port] || self.port\n self.class.raw_connect(username, password, host, port).login\n end",
"def connect\n raise ArgumentError unless (params[:fname] == '_opener')\n raise ArgumentError unless connect = ActiveSupport::JSON.decode(params[:session])\n\n @user = User.find_by_facebook_uid(connect['uid'])\n\n if @user.nil?\n # create a new user for the Facebook User if not present\n @user = User.new\n @user.facebook_uid = connect['uid']\n\n # XXX this is crap: login, country and email should be fetched from the facebook. Why?\n # because: login clashes could occur (if an user names itself fb_123456), the \"unknown\"\n # country is BAD design, because it's a corner case to cope with in views, and the fake\n # email is USELESS to send mewsic e-mail notifications to the user.\n #\n @user.login = \"fb_#{@user.facebook_uid}\" # XXX\n @user.country = \"unknown\" # XXX\n @user.email = \"#{@user.facebook_uid}@users.facebook.com\" # XXX\n\n @user.password = @user.password_confirmation = rand(2**32).to_s\n @user.save!\n end\n\n session[:fb_connect] = true\n self.current_user = @user\n\n # render the cross-domain communication channel\n render :layout => false\n\n rescue ActiveRecord::ActiveRecordError\n debugger\n head :forbidden\n\n rescue ArgumentError\n head :bad_request\n end"
] | [
"0.67706966",
"0.6617992",
"0.6561239",
"0.655139",
"0.6305887",
"0.6224214",
"0.6176887",
"0.615896",
"0.60993266",
"0.6063759",
"0.6046726",
"0.60441613",
"0.6016811",
"0.5971014",
"0.59639347",
"0.5855553",
"0.5813227",
"0.57922775",
"0.5791998",
"0.57514274",
"0.5742783",
"0.5739851",
"0.57137626",
"0.56982994",
"0.5683215",
"0.56814814",
"0.56798244",
"0.56699353",
"0.56464094",
"0.56458074",
"0.5634991",
"0.5628782",
"0.56126535",
"0.5604377",
"0.5588482",
"0.5588482",
"0.5579154",
"0.5578074",
"0.5570464",
"0.5569829",
"0.5564917",
"0.5551817",
"0.55487746",
"0.55455",
"0.5535412",
"0.5530808",
"0.5501652",
"0.54823244",
"0.5480476",
"0.5480476",
"0.5474859",
"0.5466714",
"0.5460712",
"0.5455599",
"0.54505074",
"0.54497755",
"0.5443664",
"0.544176",
"0.5426398",
"0.542434",
"0.542434",
"0.54138094",
"0.54061216",
"0.540347",
"0.53974587",
"0.53938",
"0.53934807",
"0.53874046",
"0.53805757",
"0.5373509",
"0.53712755",
"0.5364134",
"0.53602684",
"0.5345735",
"0.5340503",
"0.5325591",
"0.5325578",
"0.53244764",
"0.5322477",
"0.5318375",
"0.5315973",
"0.5315411",
"0.5314995",
"0.5309834",
"0.5290955",
"0.5287297",
"0.52863896",
"0.5279531",
"0.5279236",
"0.5269642",
"0.5265131",
"0.52643675",
"0.525366",
"0.52500594",
"0.5246704",
"0.5245979",
"0.5244067",
"0.524379",
"0.5242615",
"0.5232092"
] | 0.6250392 | 5 |
Connect as an User Require ApplicationID, ApplicationSecret, UserEmail, UserPassword | def connection_for_user
BeaconClient.logger.debug([user.email.inspect, user.password.inspect].join(' : '))
oauth_client.password.get_token(
user.email, user.password,
email: user.email
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n client.login(\n params[:user],\n params[:password],\n authParams: {\n scope: 'openid name email'\n },\n connection: 'Username-Password-Authentication'\n )\n end",
"def connect\n @user = User.where(:email => params[:user][:email]).first\n # If there is no user, create one\n if @user.nil? then\n @user = User.new(user_params)\n end\n authorize @user\n @user.apartment_id = params[:user][:apartment_id]\n respond_to do |format|\n if @user.save!\n format.html { redirect_to @user, notice: 'User was successfully connected.' }\n format.json { render :show, status: :connected, 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 @app = User.new\n\n @app.name_company = params[:name_company]\n @app.email = params[:email]\n @app.url = params[:url]\n @app.phone = params[:phone]\n @app.address = params[:address]\n\n # verify email format\n\n # salt password\n end",
"def app_credentials\n {user: @config['mysql_app_user'], pass: @config['mysql_app_password']}\n end",
"def connect\n raise ArgumentError unless (params[:fname] == '_opener')\n raise ArgumentError unless connect = ActiveSupport::JSON.decode(params[:session])\n\n @user = User.find_by_facebook_uid(connect['uid'])\n\n if @user.nil?\n # create a new user for the Facebook User if not present\n @user = User.new\n @user.facebook_uid = connect['uid']\n\n # XXX this is crap: login, country and email should be fetched from the facebook. Why?\n # because: login clashes could occur (if an user names itself fb_123456), the \"unknown\"\n # country is BAD design, because it's a corner case to cope with in views, and the fake\n # email is USELESS to send mewsic e-mail notifications to the user.\n #\n @user.login = \"fb_#{@user.facebook_uid}\" # XXX\n @user.country = \"unknown\" # XXX\n @user.email = \"#{@user.facebook_uid}@users.facebook.com\" # XXX\n\n @user.password = @user.password_confirmation = rand(2**32).to_s\n @user.save!\n end\n\n session[:fb_connect] = true\n self.current_user = @user\n\n # render the cross-domain communication channel\n render :layout => false\n\n rescue ActiveRecord::ActiveRecordError\n debugger\n head :forbidden\n\n rescue ArgumentError\n head :bad_request\n end",
"def create_user\n # first insert into user_secrets and use it's id in users table\n @user_secret = UserSecret.using_client_shard(client: @client).create!(login_salt: @login_salt_hash[:ciphertext_blob])\n\n password_e = User.using_client_shard(client: @client).get_encrypted_password(@password, @login_salt_hash[:plaintext])\n\n @user = User.using_client_shard(client: @client).new(\n client_id: @client_id,\n email: @email,\n password: password_e,\n user_secret_id: @user_secret.id,\n status: GlobalConstant::User.active_status,\n last_logged_in_at: Time.now.to_i\n )\n\n @user.send(\"set_\" + GlobalConstant::User.doptin_mail_sent_property) if @client.is_verify_page_active_for_client?\n @user.save!\n end",
"def create_a_user(password: 'secret!!')\n User.create! email: \"101glover@gmail.com\",\n password: password\n end",
"def user(query_params = {})\n raise ArgumentError, \"user method only allowed with OAuth\" unless self.auth[:type] == :oauth\n start('user', query_params)\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 initialize(username, password, application)\n @name = username\n @application = application\n @password = password\n end",
"def sign_in\n puts \"Enter your '#{Wow::Config.remote}' credentials.\"\n puts \"Don't have an account yet? Create one at #{Wow::Config.remote}/users/sign_up\"\n email = Wow::ApiClient::Config.username || shell.ask(\"\\tEmail: \")\n password = Wow::ApiClient::Config.password || shell.password(\"\\tPassword: \")\n begin\n result = post('users/sign_in', email: email, password: password)\n data = result.data\n @current_user = { id: data[:id], token: data[:authentication_token] }\n rescue RestClient::Unauthorized => e\n raise Wow::Error, e.response.data[:error]\n end\n end",
"def connect\n self.user_id = find_verified_user\n end",
"def associate_user\n \tfbUserIdString = params[:idString]\t\n \tuser = User.new(fbUserId:fbUserIdString)\n \tif user.valid?\t\n\t\t\t user = User.create(fbUserId:fbUserIdString)\n\t\t\t success = true\n\t\t end\n\t\t start_session(fbUserIdString)\n end",
"def initialize(app_id, app_secret, api_key, email, password)\n\n merge!(\n {\n applicationCredentials: {\n applicationId: app_id,\n applicationSecret: app_secret\n },\n userCredentials: {\n apiKey: api_key,\n email: email,\n password: password \n }\n }\n )\n end",
"def connect\n \t\t#Se sigue la convencion para la identificacion del usuario\n \t\t#y buscamos alusuario que se intenta conectar\n \t\tself.current_user = find_user\n \tend",
"def create_user(application_name, application_id)\n res = nil\n user_id = VaultDriver.generate_uid\n uri = URI(@url + \"auth/#{application_name}/map/user-id/#{user_id}\")\n req = Net::HTTP::Post.new(uri)\n req['X-Vault-Token'] = @token\n application_data = { 'value' => application_id }\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n req.body = application_data.to_json\n http.request(req)\n end\n [user_id, res.code.to_i]\n end",
"def ensure_facebook_connect\n set_facebook_session()\n if facebook_session && facebook_session.user.id\n @user = User.find_or_create_by_facebook_id(facebook_session.user.id)\n else\n redirect_to :controller=>:account, :action=>:login, :next_url=>request.request_uri\n end\n end",
"def connect\n self.current_user = find_verified_user\n end",
"def connect\n self.current_user = find_verified_user\n end",
"def connect\n self.current_user = find_verified_user\n end",
"def to_app_user\n raise MissingUIDError unless auth_hash.uid\n Kracken.config.user_class.find_or_create_from_auth_hash(auth_hash)\n end",
"def to_app_user\n raise MissingUIDError unless auth_hash.uid\n Kracken.config.user_class.find_or_create_from_auth_hash(auth_hash)\n end",
"def one_client_user(user)\n client = Client.new(\"dummy:dummy\")\n client.one_auth = \"#{user[:name]}:#{user[:password]}\"\n \n return client\n end",
"def developer\n raise 'Invalid Authentication' unless ENV['FAKE_AUTH_ENABLED'] == 'true'\n @user = User.from_omniauth(request.env['omniauth.auth'])\n @user.save\n sign_in_and_redirect @user, event: :authentication\n flash[:notice] = \"Welcome #{@user.email}!\"\n end",
"def create\n\t\t\t\tresource = User.find_for_database_authentication(email: params.require(:email).downcase)\n\t\t\t\t\n\t\t\t\tif resource && resource.valid_password?(params.require(:password))\n\t\t\t\t\tresource.ensure_authentication_token!\t\t\t\t\t\n\t\t\t\t\t@user = resource\n\t\t\t\t\tupdate_device\n\t\t\t\telse\n\t\t\t\t\trender_invalid_login\n\t\t\t\tend\n\t\t\tend",
"def user_credentials\n keys = %w[nome cognome email password]\n user_params = select_params(params, keys)\n user_params\n end",
"def login_from_config\n self.current_user = User.find(BETY_USER) if defined? BETY_USER\n end",
"def auth(user, password)\n @connection.bind(method: :simple, username: user.dn, password: password)\n end",
"def setup_user\n User.new( \n age: 5,\n bio: \"My test bio\",\n password: SecureRandom.hex(6),\n email: SecureRandom.hex(4) + \"@example.com\",\n picture: \"blah.jpg\",\n sex: \"M\",\n username: SecureRandom.hex(4)\n )\n end",
"def create\n @user = User.find_by(username: params[:username])\n @auth = request.env[\"omniauth.auth\"]\n if @user == nil && @auth == nil\n reject_credentials\n else\n if @user != nil\n if @user.authenticate(params[:password])\n start_session(@user.id)\n else\n reject_credentials\n end\n elsif check_credentials(@auth.uid) != nil\n start_session(check_credentials(@auth.uid).id)\n else\n user = User.new_twitter_user(@auth)\n start_session(user.id)\n end\n end\n end",
"def create_user_session\n password = '12345678'\n user = User.make!(\n password: password,\n password_confirmation: password\n )\n UserSession.create!(\n email: user.email,\n password: password\n )\n end",
"def connect\n self.current_user = find_verified_user # define current_user property once user sucessfully connected\n end",
"def create_bridge_user(email, password)\n url = BASE_URL + \"/users\"\n url_params = { \n \"email\" => email,\n \"password\" => password\n }\n query = @@bridge_creds_hash.merge(url_params)\n headers = @@bridge_version_hash\n result = post_bridge_request(url, headers, query)\n return result\n end",
"def login_known(the_user)\n # Get an instance of the user\n user = users(the_user)\n # provide the credentials and log in\n # Note the encrypted_password in the yml was created using an\n # instance of User in console with a password as below\n post user_session_path,\n params: {\n user: {\n email: user.email,\n password: \"secret08\",\n remember_me: 0\n },\n commit: \"Log in\"\n }\n end",
"def create\n\t\tuser = User.find_by(email: params[:email])\n\t\tif user && user.authenticate(params[:password])\n\t\t\tsession[:user_id] = user.id\n\t\t\tredirect_to \"/users/#{user.id}\"\n\t\telse\n\t\t\tflash[:errors] = [\"Invalid Email/Password Combination\"]\n\t\t\tredirect_to :back\n\t\tend\n\tend",
"def update_application_credentials_for_assigned_user(app_id, user_id, options = {})\n post(\"/apps/#{app_id}/users/#{user_id}\", options)\n end",
"def authenticate_user(username, password)\n api(\"AuthenticateUser\", username, password)\n end",
"def scribd_user\n begin\n # Ensure we can login to Scribd, and get a handle on the account\n Scribd::API.instance.key = config[:key]\n Scribd::API.instance.secret = config[:secret]\n @scribd_user = Scribd::User.login(config[:user], config[:password])\n rescue\n raise ScribdFuError, \"Your Scribd credentials are incorrect\"\n end\n end",
"def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n\n self.login = user_info['screen_name']\n self.twitter_name = user_info['name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end",
"def connect!\n @connection = user ? connection_for_user : connection_for_application\n @auth_token = @connection.token\n BeaconClient.logger.debug(\"Client token: #{@auth_token}\") if BeaconClient.config.debug?\n @auth_token\n rescue OAuth2::Error => error\n BeaconClient.logger.error(error.message)\n BeaconClient.logger.error(error.backtrace.join(\"\\n\"))\n end",
"def activate!(user, prompt, &block)\n unless user.blank?\n self.login = user[:login]\n self.password = user[:password]\n self.password_confirmation = user[:password_confirmation]\n self.openid_identifier = user[:openid_identifier]\n end\n logged = prompt and validate_password_with_openid?\n save_with_block(logged, &block)\n end",
"def create\n\t resource = User.find_for_database_authentication(email: params[:user][:email]) \n\t return failure unless resource\n\t return failure unless resource.valid_password?(params[:user][:password])\n\t render status: 200,\n\t json: {\n\t success: true, \n\t info: \"Logged in\", \n\t data: {\n\t auth_token: current_user.authentication_token\n\t }\n\t }\n\tend",
"def connect_user(body, opts = {})\n data, _status_code, _headers = connect_user_with_http_info(body, opts)\n data\n end",
"def connect_user(body, opts = {})\n data, _status_code, _headers = connect_user_with_http_info(body, opts)\n data\n end",
"def initiate_auth(email:, password:)\n client.initiate_auth(\n client_id: cognito_client_id,\n auth_flow: 'USER_PASSWORD_AUTH',\n auth_parameters: {\n 'USERNAME' => email,\n 'PASSWORD' => password\n }\n )\n rescue Aws::CognitoIdentityProvider::Errors::NotAuthorizedException,\n Aws::CognitoIdentityProvider::Errors::UserNotFoundException => e\n raise NotAuthorizedException.new(e.message)\n rescue Aws::CognitoIdentityProvider::Errors::InvalidParameterException => e\n raise AuthenticationBackendException.new(e.message)\n end",
"def connect(options = {})\n raise MiqException::MiqHostError, \"No credentials defined\" if missing_credentials?(options[:auth_type])\n\n auth_token = authentication_token(options[:auth_type])\n username = options[:user] || authentication_userid(options[:auth_type])\n password = options[:pass] || authentication_password(options[:auth_type])\n host = options[:host] || address\n port = options[:port] || self.port\n self.class.raw_connect(username, password, host, port).login\n end",
"def assign_user_to_application_for_sso(id, options = {})\n post(\"/apps/#{id}/users\", options)\n end",
"def create_user\n User.create name: \"test\", email: \"test@example.com\", password: \"123456\"\n end",
"def connect(user)\r\n uri = URI('https://www.google.com/accounts/ClientLogin')\r\n post = Net::HTTP::Post.new uri.path\r\n post.set_form_data('Email' => user.name, 'Passwd' => user.password, 'service' => 'youtube', 'source' => 'devapp')\r\n response = nil\r\n Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\r\n response = http.request post\r\n raise BadPasswordError, \"Bad password for, #{user.name}.\" if response.body.start_with?('Error')\r\n\r\n user.token = response.body.to_s.slice(/Auth=(.*)/, 1)\r\n end\r\n\r\n puts user.token\r\n puts response\r\n return response\r\n end",
"def open_user_account\n Account.create(user_id: self.id) \t\n end",
"def login_user\n password = Faker::Internet.password\n with_versioning do\n @logged_in_user = create(:user, password: password, password_confirmation: password)\n end\n sign_in_with_credentials(@logged_in_user.email, password)\n end",
"def create_user\n User.create name: 'test', email: 'test@example.com', password: '123456'\n end",
"def azureactivedirectory\n auth = request.env[\"omniauth.auth\"]\n user = User.create_with_omniauth(auth)\n if user.present?\n session[:user_id] = user.id\n sign_in user\n redirect_to root_path, notice: 'User created with outlook'\n else\n redirect_to new_user_registration_path, notice: 'Invalid email or password'\n end\n end",
"def login_correctly\r\n\t\tuserid = \"correct_user@email.com\"\r\n\t\tpassword = \"correct_password\"\r\n\tend",
"def create\n #gets the user\n user = User.find_by_credentials(params[:user][:email], params[:user][:password])\n \n # if we found it, generate a new session token, change it on the user\n # instance as well as the cookie\n if !user.nil?\n log_in_user!(user)\n flash.now[:success] = \"Login successful\"\n redirect_to user_url(user)\n else\n flash.now[:error] = \"Invalid email/password combo\"\n redirect_to :new\n end\n end",
"def set_app_user\n @app_user = AppUser.find(params[:id])\n end",
"def auth(username, password)\n @user = username\n @pass = password\n\n return self\n end",
"def sign_up(useremail, password)\n if new_user_available(useremail)\n query = \"INSERT INTO Users (useremail, password) VALUES('#{useremail}', '#{password}')\"\n @connection.exec(query)\n end\n end",
"def create_user(options={})\n\t\t\tUser.create({\n\t\t\t\tusername: \"user example\",\n\t\t\t\temail: \"example@email.com\",\n\t\t\t\tpassword: \"password\",\n\t\t\t\tpassword_confirmation: \"password\"\n\t\t\t}.merge(options))\n\t\tend",
"def connect(user_or_sso, password = nil)\n if @provider\n raise AlreadyConnected, \"Cannot change provider once connected\" if @provider\n end\n\n # Obtain a session id\n if password.nil?\n # Connect via SSO token\n @sso = user_or_sso\n @logger.info \"Connecting to #{@url} using SSO token\"\n @req.ConnectToProvider do |xml|\n xml.ClientXMLVersion CLIENT_XML_VERSION\n xml.sso @sso\n xml.lngs({:enc => 0}, \"en_US\")\n end\n else\n # Connect via userid and password\n @user = user_or_sso\n @password = password\n @logger.info \"Connecting to #{@url} using userid/password\"\n @req.ConnectToProvider do |xml|\n xml.ClientXMLVersion CLIENT_XML_VERSION\n xml.usr @user\n xml.pwd @password\n xml.lngs({:enc => 0}, \"en_US\")\n end\n end\n doc = invoke\n @session_id = doc.at('//res_ConnectToProvider/sID').inner_html\n set_provider doc.at('//res_ConnectToProvider/provider').inner_html\n end",
"def client\n @client ||= begin\n config(file: true) if !user_id\n User.new(user_id, password, security_code)\n end\n end",
"def create\n\n\t\t# grab the authentication return\n\t\tauth = request.env[\"omniauth.auth\"]\n\n\t\t# now create a temporary user with the auth element etc\n\t\tuser = User.omniauth_create auth\n\n\t\t# now set the session_id \n\t\tsession[:id] = user.id\n\n\t\t# redirect back to the root which can successfully switch the pages of the application etc\n\t\tredirect_to root_url, :notice => \"Successful Authentication\"\t\n\tend",
"def auth_with_user_info\n return unless wx_browser?\n\n Rails.logger.info \"==== auth_with_user_info\"\n\n app_id = @wx_mp_user.try(:app_id)\n app_secret = @wx_mp_user.try(:app_secret)\n\n Rails.logger.info \"==== app_id = #{app_id}\"\n Rails.logger.info \"==== app_secret = #{app_secret}\"\n Rails.logger.info \"==== @wx_user.blank? = #{@wx_user.blank?}\"\n Rails.logger.info \"==== is_oauth? = #{@wx_mp_user.try(:is_oauth?)}\"\n Rails.logger.info \"==== nickname = #{@wx_user.try(:nickname)}\"\n Rails.logger.info \"==== session[:openid] = #{session[:openid]}\"\n Rails.logger.info \"==== session[:user_id] = #{session[:user_id]}\"\n\n # no user and open id or none user infos\n if (@wx_user.blank? and @wx_mp_user.try(:is_oauth?) and app_id.present?) or !@wx_user.try(:has_info?)\n if params[:code].present?\n url = \"https://api.weixin.qq.com/sns/oauth2/access_token?appid=#{app_id}&secret=#{app_secret}&code=#{params[:code]}&grant_type=authorization_code\"\n result = RestClient.get(url)\n logger.info \"*******************authorize result:#{result}\"\n\n access_token_data = JSON(result) \n access_token, expires_in, refresh_token, openid = access_token_data.values_at('access_token', 'expires_in', 'refresh_token', 'openid')\n\n @wx_user = WxUser.follow(@wx_mp_user, wx_user_openid: openid, wx_mp_user_openid: @wx_mp_user.openid)\n if @wx_mp_user.present? and !@wx_user.has_info?\n attrs = Weixin.get_wx_user_info(@wx_mp_user, openid, access_token)\n\n if attrs.present?\n @wx_user.attributes = attrs\n @wx_user.save if @wx_user.changed?\n end\n end\n\n session[:user_id] = @wx_user.user_id\n session[:openid] = @wx_user.openid\n @user = @wx_user.user\n\n return redirect_to auth_back\n end \n\n oauth_url = \"https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{app_id}&redirect_uri=#{Rack::Utils.escape(request.url)}&response_type=code&scope=snsapi_userinfo&state=#{STATE}#wechat_redirect\"\n redirect_to oauth_url\n end\n rescue => e\n SiteLog::Base.logger('weixin_oauth', \"weixin_oauth with user info error: #{e.message} > #{e.backtrace}\")\n require_wx_user\n end",
"def login_as(user)\n login(users(user).email, users(user).password)\n end",
"def login user, password\n @username = user\n @ctx.login user, password\n end",
"def login_user\n puts \"Please enter your name\"\n name = CLI.gets_with_quit\n\n if self.user_exists(name)\n user = self.find_user(name)\n if check_password(user)\n CLI.active_user = user\n # fall through to CLI.start\n else\n CLI.start\n end\n\n else\n puts \"Sorry, User not found!\"\n if CLI.yes_no(\"Sign Up\")\n self.signup_user(name)\n else\n CLI.start\n end\n end\n end",
"def user_from_params\n name = user_params.delete(:name)\n service = user_params.delete(:service)\n email = user_params.delete(:email)\n country = user_params.delete(:country)\n price = user_params.delete(:price)\n password = user_params.delete(:password)\n\n Clearance.configuration.user_model.new(user_params).tap do |user|\n user.name = name\n user.password = password\n user.service = service\n user.email = email\n user.country = country\n user.price = price\n end\n end",
"def assign_user_to_application_for_sso_provisioning(id, options = {})\n post(\"/apps/#{id}/users\", options)\n end",
"def create_user_and_login(userinfo)\n nickname = userinfo[:nickname]\n user = User.new(\n name: nickname.nil? ? userinfo[:name] : nickname,\n email: @email,\n auth0_id: @auth0_id\n )\n user.save\n login_and_redirect user\n end",
"def try_to_login\n User.login(self.name, self.password)\n end",
"def user_from_params\n email = user_params.delete(:email)\n password = user_params.delete(:password)\n firstname = user_params.delete(:firstname)\n lastname = user_params.delete(:lastname)\n\n Clearance.configuration.user_model.new(user_params).tap do |user|\n user.email = email\n user.password = password\n user.firstname = firstname\n user.lastname = lastname\n end\n end",
"def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n self.twitter_name = user_info['name']\n self.twitter_screen_name = user_info['screen_name']\n self.login = 'twitter_' + user_info['screen_name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end",
"def create_user(email, password)\n FactoryBot.create(:user, email: email, password: password)\n end",
"def create_user(email, password, full_name = nil, language = nil)\n options = { email: email, password: password }\n options[:language] = language if language\n options[:full_name] = full_name if full_name\n\n query_api '/auth/user', options\n end",
"def create_user_token(user_id, application_id, application_name)\n res = nil\n uri = URI(@url + \"auth/#{application_name}/login\")\n req = Net::HTTP::Post.new(uri)\n req['X-Vault-Token'] = @token\n application_data = { 'app_id' => application_id, 'user_id' => user_id }\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n req.body = application_data.to_json\n http.request(req)\n end\n [JSON.parse(res.body), res.code.to_i]\n end",
"def user! opts\n opts = { :login => opts } if String === opts\n\n user = opts.delete(:user)\n\n User.transaction do\n unless user = User[opts[:login]]\n opts[:name] ||= opts[:login]\n opts[:email] ||= config['email']['template'] % opts[:login]\n # .gsub(/#\\{([^\\}]+)\\}/){ | k | opts[k.to_sym] }\n opts[:password] ||= opts[:login] + opts[:login]\n opts[:password_confirmation] ||= opts[:password]\n \n $stderr.puts \"#{self.class.name}: creating User[#{opts[:login].inspect}]\"\n user = User.create!(opts)\n end\n\n roles_for_user(user.login).each do | role_name |\n role = Role[role_name] || (raise \"No Role named #{role_name.inspect}\")\n unless user.roles.include?(role)\n add_user_role!(user, role)\n end\n end\n end\n\n user\n end",
"def initiate_auth(email:, password:)\n client.initiate_auth(\n client_id: cognito_client_id,\n auth_flow: 'USER_PASSWORD_AUTH',\n auth_parameters: {\n 'USERNAME' => email,\n 'PASSWORD' => password,\n },\n )\n rescue Aws::CognitoIdentityProvider::Errors::NotAuthorizedException,\n Aws::CognitoIdentityProvider::Errors::UserNotFoundException => e\n if e.message == 'Temporary password has expired and must be reset by an administrator.'\n raise TemporaryPasswordExpiredException, e\n else\n raise NotAuthorizedException, e\n end\n rescue Aws::CognitoIdentityProvider::Errors::InvalidParameterException => e\n raise AuthenticationBackendException, e\n rescue Aws::CognitoIdentityProvider::Errors::PasswordResetRequiredException\n raise PasswordResetRequiredException\n end",
"def set_auth(user, password)\n @user = user\n @password = password\n end",
"def resolve(username: nil, password: nil, idclient: nil) \n User.create(userName: username, password: password, idClients: idclient)\n end",
"def create\n # raise params.inspect\n if params[:password]# User entered username and password\n user = User.find_by(username: params[:username])\n if !user\n invalid\n else\n if user.authenticate(params[:password][0]) # Is username and password correct?\n # yes\n session[:user_id] = user.id \n redirect_to user_path(user.id)\n else \n # no\n invalid\n end\n end\n else # Logging in via oauth\n auth = request.env[\"omniauth.auth\"]\n # raise auth.inspect\n @user = User.find_by(username: auth['info']['nickname']) do |u|\n u.name = auth['info']['nickname']\n end\n session[:user_id] = @user.id\n redirect_to user_path(@user.id)\n end\n end",
"def create_user\n params = {\n client_id: @client_id,\n email: @email\n }\n @user = User.using_client_shard(client: @client).create!(params)\n end",
"def connect\n require 'restforce' unless defined?(::Restforce)\n username = additional_params[:username] || \"\"\n password = additional_params[:password] || \"\"\n security_token = additional_params[:security_token] || \"\"\n client_id = additional_params[:client_id] || \"\"\n client_secret = additional_params[:client_secret] || \"\"\n instance_url = additional_params[:instance_url] || \"\"\n\n @client = Restforce.new(\n username: username,\n password: password,\n security_token: security_token,\n client_id: client_id,\n client_secret: client_secret,\n instance_url: instance_url\n )\n\n @oauth = @client.authenticate!\n super\n end",
"def create\n user = User.find_by_email(params[:email])\n\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to \"/users/#{user.id}\"\n else\n flash[:errors] = [\"Invalid combination\"]\n redirect_to new_session_path\n end\n\n end",
"def authenticate(username_or_email, password)\n user = PublicEarth::Db::User.new\n if username_or_email.blank?\n user.errors.add_to_base(\"NO_USERNAME\")\n elsif password.blank?\n user.errors.add_to_base(\"NO_PASSWORD\")\n else\n existing = find_by_username_or_email(username_or_email)\n if existing\n if active?(existing.id)\n begin\n user.attributes = one.authenticate(username_or_email, password)\n user.authenticated = true\n rescue\n user.errors.add(:username, \"INVALID_PASSWORD\")\n end\n else\n user.errors.add_to_base(\"UNCONFIRMED\")\n end\n else\n user.errors.add_to_base(\"INVALID_ACCOUNT\")\n end\n end\n user\n end",
"def auth\n\t\trequest_token = OAuth::RequestToken.from_hash(oauth_consumer, \n\t\t\t:oauth_token => session[:request_token], \n\t\t\t:oauth_token_secret => session[:request_secret])\n\t\tbegin\n\t\t\t@access_token = request_token.get_access_token\n\t\t\tsession.delete(:request_token)\n\t\t\tsession.delete(:request_secret)\n\t\t\tresponse = @access_token.get('/api/auth_user')\n\t\t\tdoc = Nokogiri::XML(response.body)\n\t\t\tuser_xml = doc.at_xpath('//user')\n\t\t\tgoodreads_user_id = user_xml.attributes[\"id\"].value\n\t\t\tname_xml = doc.at_xpath('//name')\n\t\t\tgoodreads_username = name_xml.children[0].inner_text\n\t\t\t@user = User.find_by(\tgoodreads_name: goodreads_username)\n\t\t\tif @user\n\t\t\t\tsession[:user_id] = @user.id\n\t\t\t\tredirect_to :home\n\t\t\telse\n\t\t\t\t@user = User.create( goodreads_name: goodreads_username,\n\t\t\t\t\tgoodreads_user_id: goodreads_user_id, \n\t\t\t\t\tauth_token: @access_token.token, \n\t\t\t\t\tauth_secret: @access_token.secret)\n\t\t\t\tsession[:user_id] = @user.id\n\t\t\t\tredirect_to :welcome\n\t\t\tend\n\t\trescue\n\t\t\tsession.delete(:request_token)\n\t\t\tsession.delete(:request_secret)\n\t\t\t@not_authorized = true\n\t\t\tredirect_to :home\n\t\tend\t\t\n\tend",
"def authenticate!\n response = post(USERS_URL, { \"email\" => @username, \"password\" => @password})\n raise 'Could not authenticate, are you sure you have the right credentials?' if !response['secretApiKey']\n\n @api_key = response['secretApiKey']\n end",
"def login(email, password)\n user = User.new\n puts user.login email, password\n end",
"def create_user\n User.create name: 'test', email: 'test@example.com', password: '123456'\n end",
"def create_user(name, email, password, language='de', send_newsletter=true)\n data = { 'name' => name, 'email' => email, 'password' => password, 'language' => language, 'affiliate_client_id' => @client_id} #'send_newsletter' => send_newsletter,\n return query_api(\"/auth/user\", data)\n end",
"def user_instance(username)\n User.new(new_username: username, forename: 'forename', surname: 'surname',\n email_address: 'a@a.com', email_address_confirmation: 'a@a.com',\n new_password: 'P@ssword001', new_password_confirmation: 'P@ssword001',\n user_is_current: 'Y')\n end",
"def authentication(params)\n Cognito::AuthUser.call(\n username: params[:username],\n password: params[:password],\n login_ip: params[:login_ip]\n )\n end",
"def authenticate_user(username,password)\n User.authenticate(username,password)\n end",
"def authenticate_user(username,password)\n User.authenticate(username,password)\n end",
"def create\n authenticate_with_open_id(params[:openid_identifier], \n required: [:email, :nickname]) do |result, identity_url, registration|\n if result.successful?\n #FIXME - needs normalizing before checking for the identity_url?\n unless @user = User.find_by_identity_url(identity_url) or\n User.find_by_email(registration['email'])\n # creates new user if there was none registered\n # with the provided url, or fetched email \n @user = User.create(identity_url: identity_url, \n email: registration['email'], \n username: registration['nickname'])\n end\n login @user\n else\n # indicates that login failed\n # something went wrong with the auth \n # process, prompt for a retry\n flash[:alert] = \"Something went wrong. Please try logging in again.\"\n redirect_to(login_url)\n end\n end\n end",
"def action_connect_user(options)\n user_id = options[:user_id]\n\n # Nothing to do if stopped.\n return if stopping?\n\n # Are we allowed to create a new user thread?\n if user_threads_count > max_user_threads\n Log.error(\"Error: Reached maximum number of users (#{max_user_threads}).\")\n return\n end\n\n # Nothing to do if already a running (or sleeping) thread.\n user_thread = get_user_thread(user_id)\n return if user_thread.present? && user_thread.alive?\n\n # Load the user; preload connection information.\n user = User.find(user_id)\n user.connection.imap_provider\n\n # Start the thread.\n user_thread = wrapped_thread do\n Log.info(\"Connecting #{user.email}...\")\n ImapClient::UserThread.new(self, user, user_options).run\n end\n set_user_thread(user_id, user_thread)\n rescue => e\n Log.exception(e)\n end",
"def create\n\t\tuser = User.where(:email => params[:email]).first\n\t\tif user.present? && user.authenticate(params[:password])\n\t\t\tsession[:user_id] = user.id\n\t\t\tredirect_to root_path\n\t\telse \n\t\t\tredirect_to new_session_path\n\t\tend\n\n\tend",
"def authenticate!\n user = User.where(email: params[\"email\"]).first\n if user && user.authenticate(params[\"password\"])\n success!(user)\n else\n fail!(\"Could not log in\")\n end \n end",
"def from_omniauth auth\n user = User.find_by email: auth.info.email\n\n user = User.new unless user.present?\n user.name = auth.info.name.present? ? auth.info.name : auth.info.email\n user.email = auth.info.email\n user.provider = auth.provider\n user.password = User.generate_unique_secure_token if user.new_record?\n user.token = auth.credentials.token\n user.refresh_token = auth.credentials.refresh_token\n user.save\n user\n end",
"def user(user)\n raise NoUserException, \"No user specified\" if user.nil?\n connection do\n client.user(user)\n end\n end",
"def create_new_user_and_identity(auth, params)\n user = User.create!(\n first_name: auth.info[:first_name],\n last_name: auth.info[:last_name],\n email: auth.info[:email],\n oauth_signup: true,\n # referred_by_user_id => params.andand[\"rid\"]\n )\n user.confirm!\n create_new_identity(user, auth)\n end"
] | [
"0.64241004",
"0.6331916",
"0.62217134",
"0.6183177",
"0.61571425",
"0.6136779",
"0.61230576",
"0.6118697",
"0.611587",
"0.61028427",
"0.6061592",
"0.5996285",
"0.59956163",
"0.59897864",
"0.5960525",
"0.59489065",
"0.5941224",
"0.59311044",
"0.59311044",
"0.59311044",
"0.5930025",
"0.5930025",
"0.5918429",
"0.5903437",
"0.5897469",
"0.58923143",
"0.5890889",
"0.58834434",
"0.5875023",
"0.58724123",
"0.58658737",
"0.58627254",
"0.58607626",
"0.58593035",
"0.58454293",
"0.5844384",
"0.5832238",
"0.5826952",
"0.58212966",
"0.5819997",
"0.5816207",
"0.58161134",
"0.58157384",
"0.58157384",
"0.5808105",
"0.58021784",
"0.579619",
"0.57943237",
"0.5792435",
"0.57904243",
"0.57852095",
"0.5783848",
"0.57831436",
"0.5776787",
"0.5774844",
"0.5760242",
"0.5753962",
"0.57511777",
"0.57506335",
"0.57489353",
"0.5740385",
"0.5737652",
"0.57372123",
"0.5731847",
"0.5725952",
"0.5721003",
"0.57204616",
"0.57203895",
"0.5716635",
"0.571345",
"0.57040316",
"0.5694159",
"0.5692665",
"0.56919944",
"0.56898844",
"0.5689029",
"0.56863236",
"0.5680713",
"0.5675354",
"0.5675033",
"0.5672275",
"0.56616193",
"0.56584233",
"0.5651224",
"0.5650405",
"0.565028",
"0.56500036",
"0.5645398",
"0.5644536",
"0.5644329",
"0.5643636",
"0.56345415",
"0.56345415",
"0.56321144",
"0.56283885",
"0.5615036",
"0.561163",
"0.5610978",
"0.5609839",
"0.56078565"
] | 0.6625705 | 0 |
GET /products GET /products.xml | def index
# @products = Product.all
#pagination:
@products = Product.all.paginate :per_page => 5, :page => params[:page]
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @products }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def index\n @products = Product.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n @products = CatalogMebeli.find(params[:id]).products\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def products\n request :public, :get, :products\n end",
"def index\n @products = Product.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def products\n @products = ['ninja', 'fish', 'chauffeur']\n respond_to do |format|\n format.html # render html version\n format.xml {\n # NOTE This only works for ActiveRecord objects\n # render :xml => @products.to_xml\n render :file => \"machines/products.rxml\", :use_full_path => true\n }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n format.json { render :json => @products }\n end\n end",
"def product(name)\n get(\"/apiproducts/#{name}\")\n end",
"def show\r\n\t @product = Product.find(params[:id])\r\n\t @products = Product.find(:all)\r\n \r\n\t respond_to do |format|\r\n\t\t format.html # show.html.erb\r\n\t\t format.xml { render :xml => @product }\r\n\t end\r\n\tend",
"def index\n @products = Product.all.paginate(:per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n \n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @product.to_xml }\n end\n end",
"def view\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product_list = ProductList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_list }\n end\n end",
"def show\r\n load_session\r\n\r\n @product = Product.find(params[:id])\r\n @product_desc = @product.product_description\r\n\r\n # Build XML resposne object\r\n xml = Builder::XmlMarkup.new\r\n xml.instruct!\r\n xml.response << @product.to_xml\r\n\r\n respond_to do |format|\r\n format.html # { render :layout => 'home' }\r\n format.xml # { render :xml => @product }\r\n end\r\n end",
"def show\r\n @product = Product.find_by_urlname(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # product.html.erb\r\n format.xml { render :xml => @product }\r\n end\r\n end",
"def show\n @product_info = ProductInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_info }\n end\n end",
"def show\n @product = Product.find(params[:id].to_i)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def index\n @sc_products = ScProduct.all\n\n respond_to do |format|\n format.html\n format.json { render json: @sc_products }\n format.xml { render xml: @sc_products }\n end\n end",
"def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @product_software }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def index\n @products = get_products\n \n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @products }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @product }\n end\n end",
"def index\n\t\t@products = Product.page(params[:page])\n respond_with(@products)\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @catalog_product = CatalogProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalog_product }\n end\n end",
"def index\n @product_lists = ProductList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_lists }\n end\n end",
"def index\n @products = Product.published.find(:all, :order => \"featured DESC, title\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n format.json { render :json => @product }\n end\n end",
"def index\r\n @product_results = ProductResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @product_results }\r\n end\r\n end",
"def index\r\n @product_results = ProductResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @product_results }\r\n end\r\n end",
"def index\r\n @product_results = ProductResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @product_results }\r\n end\r\n end",
"def index\r\n @product_results = ProductResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @product_results }\r\n end\r\n end",
"def index\n @products = get_products(:page => params[:page], :per_page => params[:per_page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @products }\n end\n end",
"def index\n @product_sections = ProductSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_sections }\n end\n end",
"def index\n @product_use_printruns = ProductUsePrintrun.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_use_printruns }\n end\n end",
"def show\n @product_request = ProductRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_request }\n end\n end",
"def index\n admin_store_url\n @product_search = ProductSearch.new\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n @product_set = ProductSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_set }\n end\n end",
"def index\n respond_with ProductNodes.all\n end",
"def index\n if @category\n @products = @category.products\n else\n @products = Product.find(:all)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n @products = Product.find(params[:id])\n end",
"def index\n @products = Product.find(:all, :include => [:author])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def products\n run(:get,\"/school_products\", [200])\n end",
"def index\n @product_sets = ProductSet.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_sets }\n end\n end",
"def show\n @sample_product = SampleProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sample_product }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_batch }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end",
"def index\n @categories = Category.all\n @products = {}\n @categories.each do |c|\n products_by_category = c.products\n @products[c.id.to_s] = products_by_category\n end\n @products = Product.all if @products.nil?\n logger.info(@products)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end",
"def show\n @collection = Collection.find(params[:id])\n @products = Product.find(:all, :conditions => {:collection_id => @collection.id})\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @collection }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_softwares }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @artist_products }\n end\n end",
"def show\n @product_order = ProductOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_order }\n end\n end",
"def index\n @products = Product.all\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end",
"def show\n @producttag = Producttag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @producttag }\n end\n end",
"def show\n @products = Product.search(params).paginate(:page => params[:page], :per_page => 10)\n end",
"def all(params = {})\n path = \"/product-view/products\"\n\n handle_all_request(path, :products, params)\n end",
"def index\n # show the products for a supplier\n flash[:notice] = \"Supplier has (#{@products.size}) products.\"\n respond_to do |format|\n format.html # index.html\n format.xml { render :xml => @products }\n end\n end",
"def index\n @products = Product.order(\"created_at desc\").paginate(page: params[:page], per_page: 21)\n\n respond_with @products\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @parent_products }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_review_products }\n end\n end",
"def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @artist_product }\n end\n end",
"def show\n @product_exchange = ProductExchange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_exchange }\n end\n end",
"def index\n @product_exchanges = ProductExchange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_exchanges }\n end\n end",
"def index\n @products = Product.all_by_code.paginate :page => params[:page], :per_page => 30\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @products }\n end\n end",
"def show\n @online_store = OnlineStore.find(params[:id])\n @products = @online_store.products\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_store }\n end\n end",
"def show\n\t\t@produt = Produt.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml {render :xml => @produt}\n\t\tend\n\tend",
"def index\n @sprints = @product.sprints\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sprints }\n end\n end",
"def show\n @products = Product.find_by_id(params[:id])\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end",
"def index\n @product_pictures = ProductPicture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_pictures }\n end\n end",
"def index\n #@products = Product.all\n @products = Product.paginate( :page => params[:page],\n :per_page => 40\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def show\n @produto_kit = ProdutoKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @produto_kit }\n end\n end",
"def show\n\n\t\t@products = Product.find :all, :conditions => \"publisher_id = '#{@publisher.id}'\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publisher }\n end\n end",
"def index\n\t\t@products = Product.all\n\tend",
"def index\n @products = Spree::Product.not_deleted.includes(:variants).page(params[:page]).per(Spree::Config[:orders_per_page])\n respond_with @products\n end",
"def show\n @product_line = ProductLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_line }\n end\n end",
"def index\n expose Product.page(params[:page])\n end",
"def index\n @product_licence_details = ProductLicenceDetail.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_licence_details }\n end\n end",
"def index\n @products = Product.all\n @users = Product.find(:all)\n #--------amazon cloud search-----------------------------------------------------------\n #searcher = CloudSearch::Searcher.new\n #@resp = searcher.with_fields(:id, :actor, :director, :title, :year, :text_relevance)\n # .with_query(\"star wars\")\n # .search\n #--------------------------------------------------------------------------------------\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n format.xml { render :xml => @products }\n end\n end",
"def index\n @products = @user.products\n # was @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end"
] | [
"0.7690255",
"0.7466418",
"0.7425016",
"0.74209785",
"0.73869234",
"0.7353577",
"0.7106357",
"0.7065102",
"0.70622796",
"0.7044841",
"0.6991611",
"0.6951951",
"0.69358504",
"0.69277465",
"0.69277465",
"0.69277465",
"0.69277465",
"0.69277465",
"0.69277465",
"0.69277465",
"0.69277465",
"0.69277465",
"0.69277465",
"0.69277465",
"0.69277465",
"0.6925488",
"0.6923371",
"0.68176997",
"0.68108547",
"0.6808803",
"0.6796638",
"0.678941",
"0.67818284",
"0.67491055",
"0.6743884",
"0.67416227",
"0.672005",
"0.6711012",
"0.6710293",
"0.6706496",
"0.67005235",
"0.6673207",
"0.6673207",
"0.6673207",
"0.6673207",
"0.6648119",
"0.66351455",
"0.6631728",
"0.6630392",
"0.6628219",
"0.6626436",
"0.6617509",
"0.65862906",
"0.6569659",
"0.65676415",
"0.65453905",
"0.6543468",
"0.6496041",
"0.6484226",
"0.64836586",
"0.64836586",
"0.64836586",
"0.64836586",
"0.6482441",
"0.6471475",
"0.6467592",
"0.64554924",
"0.6454271",
"0.6453417",
"0.6453417",
"0.6453417",
"0.64455974",
"0.64402854",
"0.64274687",
"0.6425009",
"0.6401448",
"0.63994634",
"0.63939166",
"0.6386879",
"0.6384257",
"0.6382084",
"0.6375132",
"0.63669574",
"0.63623667",
"0.63614124",
"0.6359705",
"0.6359026",
"0.63569146",
"0.63533723",
"0.6350066",
"0.6336301",
"0.6327001",
"0.6326534",
"0.6323695",
"0.63076794",
"0.6304699",
"0.6304213",
"0.63021743",
"0.6294299",
"0.62922335"
] | 0.65631115 | 55 |
GET /products/1 GET /products/1.xml | def show
@product = Product.all
# respond_to do |format|
# format.html # show.html.erb
# format.xml { render :xml => @product }
# end
prawnto :filename => 'Report-Products.pdf', :inline => false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @products = Product.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n @products = CatalogMebeli.find(params[:id]).products\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def index\n @products = Product.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def products\n @products = ['ninja', 'fish', 'chauffeur']\n respond_to do |format|\n format.html # render html version\n format.xml {\n # NOTE This only works for ActiveRecord objects\n # render :xml => @products.to_xml\n render :file => \"machines/products.rxml\", :use_full_path => true\n }\n end\n end",
"def product(name)\n get(\"/apiproducts/#{name}\")\n end",
"def view\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id].to_i)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @product.to_xml }\n end\n end",
"def show\r\n @product = Product.find_by_urlname(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # product.html.erb\r\n format.xml { render :xml => @product }\r\n end\r\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\r\n\t @product = Product.find(params[:id])\r\n\t @products = Product.find(:all)\r\n \r\n\t respond_to do |format|\r\n\t\t format.html # show.html.erb\r\n\t\t format.xml { render :xml => @product }\r\n\t end\r\n\tend",
"def products\n request :public, :get, :products\n end",
"def show\r\n load_session\r\n\r\n @product = Product.find(params[:id])\r\n @product_desc = @product.product_description\r\n\r\n # Build XML resposne object\r\n xml = Builder::XmlMarkup.new\r\n xml.instruct!\r\n xml.response << @product.to_xml\r\n\r\n respond_to do |format|\r\n format.html # { render :layout => 'home' }\r\n format.xml # { render :xml => @product }\r\n end\r\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n format.json { render :json => @products }\n end\n end",
"def index\n @products = Product.all.paginate(:per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n \n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def show\n @product_list = ProductList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_list }\n end\n end",
"def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @product_software }\n end\n end",
"def show\n @product_info = ProductInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_info }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @product }\n end\n end",
"def show\n @catalog_product = CatalogProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalog_product }\n end\n end",
"def show\n @product_request = ProductRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_request }\n end\n end",
"def show\n @product_set = ProductSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_set }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n format.json { render :json => @product }\n end\n end",
"def show\n @sample_product = SampleProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sample_product }\n end\n end",
"def index\n admin_store_url\n @product_search = ProductSearch.new\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_batch }\n end\n end",
"def index\n @product_lists = ProductList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_lists }\n end\n end",
"def index\r\n @product_results = ProductResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @product_results }\r\n end\r\n end",
"def index\r\n @product_results = ProductResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @product_results }\r\n end\r\n end",
"def index\r\n @product_results = ProductResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @product_results }\r\n end\r\n end",
"def index\r\n @product_results = ProductResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @product_results }\r\n end\r\n end",
"def index\n @products = Product.published.find(:all, :order => \"featured DESC, title\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def index\n @product_sets = ProductSet.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_sets }\n end\n end",
"def show\n @product_exchange = ProductExchange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_exchange }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @parent_products }\n end\n end",
"def index\n @sc_products = ScProduct.all\n\n respond_to do |format|\n format.html\n format.json { render json: @sc_products }\n format.xml { render xml: @sc_products }\n end\n end",
"def index\n\t\t@products = Product.page(params[:page])\n respond_with(@products)\n end",
"def index\n @product_use_printruns = ProductUsePrintrun.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_use_printruns }\n end\n end",
"def index\n @products = get_products\n \n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @products }\n end\n end",
"def show\n @collection = Collection.find(params[:id])\n @products = Product.find(:all, :conditions => {:collection_id => @collection.id})\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @collection }\n end\n end",
"def index\n# @products = Product.all\n#pagination:\n\t@products = Product.all.paginate :per_page => 5, :page => params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @artist_products }\n end\n end",
"def index\n @product_sections = ProductSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_sections }\n end\n end",
"def index\n @products = get_products(:page => params[:page], :per_page => params[:per_page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @products }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_softwares }\n end\n end",
"def show\n @product_order = ProductOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_order }\n end\n end",
"def show\n @product_status = ProductStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_status }\n end\n end",
"def show\n @producttag = Producttag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @producttag }\n end\n end",
"def index\n if @category\n @products = @category.products\n else\n @products = Product.find(:all)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n\t\t@produt = Produt.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml {render :xml => @produt}\n\t\tend\n\tend",
"def index\n @product_exchanges = ProductExchange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_exchanges }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_review_products }\n end\n end",
"def show\n @product_line = ProductLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_line }\n end\n end",
"def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @artist_product }\n end\n end",
"def show\n @products = Product.find(params[:id])\n end",
"def show\n @produto_kit = ProdutoKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @produto_kit }\n end\n end",
"def index\n @sprints = @product.sprints\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sprints }\n end\n end",
"def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @produto }\n end\n end",
"def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @produto }\n end\n end",
"def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @produto }\n end\n end",
"def show\n begin\n @product = Product.published.find(params[:id])\n rescue\n return render_not_found\n end\n @title = \"КАТАЛОГ // #{@product.name}\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end",
"def index\n # show the products for a supplier\n flash[:notice] = \"Supplier has (#{@products.size}) products.\"\n respond_to do |format|\n format.html # index.html\n format.xml { render :xml => @products }\n end\n end",
"def index\n respond_with ProductNodes.all\n end",
"def index\n @product_pictures = ProductPicture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_pictures }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_family_products }\n end\n end",
"def index\n @rep_tot = Product.report_totals[0]\n @rep_loc = Location.report_located[0]\n\n @products = Product.grid\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @parent_product }\n end\n end",
"def show\n @price = Price.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @price }\n end\n end",
"def index\n @products = Product.find(:all, :include => [:author])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_attachments }\n end\n end",
"def index\n @products = Product.all_by_code.paginate :page => params[:page], :per_page => 30\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @products }\n end\n end",
"def show\n @mixed_product = MixedProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mixed_product }\n end\n end",
"def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @product_review_product }\n end\n end",
"def show\n @producto_stock = ProductoStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @producto_stock }\n end\n end",
"def show\n @product_archive = ProductArchive.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_archive }\n end\n end",
"def show_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_usage }\n end\n end",
"def index\n @categories = Category.all\n @products = {}\n @categories.each do |c|\n products_by_category = c.products\n @products[c.id.to_s] = products_by_category\n end\n @products = Product.all if @products.nil?\n logger.info(@products)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n @price_list = PriceList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @price_list }\n end\n end",
"def show\n @price_list = PriceList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @price_list }\n end\n end",
"def index\n @product_statuses = ProductStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_statuses }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item}\n end\n end",
"def show\n\n\t\t@products = Product.find :all, :conditions => \"publisher_id = '#{@publisher.id}'\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publisher }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_videos }\n end\n end",
"def show\n @product_section = ProductSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_section }\n end\n end",
"def show\n @products = Product.find_by_id(params[:id])\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end"
] | [
"0.7179435",
"0.7173421",
"0.71549183",
"0.71045",
"0.70836425",
"0.69191265",
"0.6913727",
"0.6910618",
"0.68953973",
"0.6880187",
"0.68616176",
"0.68402064",
"0.68402064",
"0.68402064",
"0.68402064",
"0.68402064",
"0.68402064",
"0.68402064",
"0.68402064",
"0.68402064",
"0.68402064",
"0.68402064",
"0.68402064",
"0.68336135",
"0.6780523",
"0.67759293",
"0.6766885",
"0.6752713",
"0.67368597",
"0.6732213",
"0.6685707",
"0.6683613",
"0.6673367",
"0.66019934",
"0.6589965",
"0.65810513",
"0.65803045",
"0.65517837",
"0.6513117",
"0.65059644",
"0.64622414",
"0.64529145",
"0.64491135",
"0.64491135",
"0.64491135",
"0.64491135",
"0.64329624",
"0.64077365",
"0.6388435",
"0.637206",
"0.6368258",
"0.63648677",
"0.63584125",
"0.63582206",
"0.63568467",
"0.63560224",
"0.6340201",
"0.63277745",
"0.6326989",
"0.6324736",
"0.63151294",
"0.6312454",
"0.63109714",
"0.62926817",
"0.6287139",
"0.6286685",
"0.6277393",
"0.6276905",
"0.6270068",
"0.6265887",
"0.626083",
"0.6226969",
"0.62208414",
"0.62208414",
"0.62208414",
"0.6215663",
"0.62068254",
"0.6206776",
"0.61931896",
"0.6167853",
"0.61622965",
"0.6161378",
"0.6155241",
"0.61515754",
"0.61369675",
"0.61304706",
"0.61301804",
"0.6129276",
"0.6123669",
"0.6120949",
"0.6115029",
"0.61147857",
"0.6111375",
"0.6098863",
"0.6098863",
"0.6087369",
"0.6070176",
"0.6067066",
"0.6066484",
"0.6055466",
"0.60499686"
] | 0.0 | -1 |
GET /products/1 GET /products/1.xml | def view
@product = Product.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @product }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @products = Product.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n @products = CatalogMebeli.find(params[:id]).products\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def index\n @products = Product.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def products\n @products = ['ninja', 'fish', 'chauffeur']\n respond_to do |format|\n format.html # render html version\n format.xml {\n # NOTE This only works for ActiveRecord objects\n # render :xml => @products.to_xml\n render :file => \"machines/products.rxml\", :use_full_path => true\n }\n end\n end",
"def product(name)\n get(\"/apiproducts/#{name}\")\n end",
"def show\n @product = Product.find(params[:id].to_i)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @product.to_xml }\n end\n end",
"def show\r\n @product = Product.find_by_urlname(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # product.html.erb\r\n format.xml { render :xml => @product }\r\n end\r\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\r\n\t @product = Product.find(params[:id])\r\n\t @products = Product.find(:all)\r\n \r\n\t respond_to do |format|\r\n\t\t format.html # show.html.erb\r\n\t\t format.xml { render :xml => @product }\r\n\t end\r\n\tend",
"def products\n request :public, :get, :products\n end",
"def show\r\n load_session\r\n\r\n @product = Product.find(params[:id])\r\n @product_desc = @product.product_description\r\n\r\n # Build XML resposne object\r\n xml = Builder::XmlMarkup.new\r\n xml.instruct!\r\n xml.response << @product.to_xml\r\n\r\n respond_to do |format|\r\n format.html # { render :layout => 'home' }\r\n format.xml # { render :xml => @product }\r\n end\r\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n format.json { render :json => @products }\n end\n end",
"def index\n @products = Product.all.paginate(:per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n \n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def show\n @product_list = ProductList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_list }\n end\n end",
"def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @product_software }\n end\n end",
"def show\n @product_info = ProductInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_info }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @product }\n end\n end",
"def show\n @catalog_product = CatalogProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalog_product }\n end\n end",
"def show\n @product_request = ProductRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_request }\n end\n end",
"def show\n @product_set = ProductSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_set }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n format.json { render :json => @product }\n end\n end",
"def show\n @sample_product = SampleProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sample_product }\n end\n end",
"def index\n admin_store_url\n @product_search = ProductSearch.new\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_batch }\n end\n end",
"def index\n @product_lists = ProductList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_lists }\n end\n end",
"def index\r\n @product_results = ProductResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @product_results }\r\n end\r\n end",
"def index\r\n @product_results = ProductResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @product_results }\r\n end\r\n end",
"def index\r\n @product_results = ProductResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @product_results }\r\n end\r\n end",
"def index\r\n @product_results = ProductResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @product_results }\r\n end\r\n end",
"def index\n @products = Product.published.find(:all, :order => \"featured DESC, title\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def index\n @product_sets = ProductSet.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_sets }\n end\n end",
"def show\n @product_exchange = ProductExchange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_exchange }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @parent_products }\n end\n end",
"def index\n @sc_products = ScProduct.all\n\n respond_to do |format|\n format.html\n format.json { render json: @sc_products }\n format.xml { render xml: @sc_products }\n end\n end",
"def index\n\t\t@products = Product.page(params[:page])\n respond_with(@products)\n end",
"def index\n @products = get_products\n \n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @products }\n end\n end",
"def index\n @product_use_printruns = ProductUsePrintrun.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_use_printruns }\n end\n end",
"def index\n# @products = Product.all\n#pagination:\n\t@products = Product.all.paginate :per_page => 5, :page => params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n @collection = Collection.find(params[:id])\n @products = Product.find(:all, :conditions => {:collection_id => @collection.id})\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @collection }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @artist_products }\n end\n end",
"def index\n @product_sections = ProductSection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_sections }\n end\n end",
"def index\n @products = get_products(:page => params[:page], :per_page => params[:per_page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @products }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_softwares }\n end\n end",
"def show\n @product_order = ProductOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_order }\n end\n end",
"def show\n @product_status = ProductStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_status }\n end\n end",
"def show\n @producttag = Producttag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @producttag }\n end\n end",
"def index\n if @category\n @products = @category.products\n else\n @products = Product.find(:all)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def index\n @product_exchanges = ProductExchange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_exchanges }\n end\n end",
"def show\n\t\t@produt = Produt.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml {render :xml => @produt}\n\t\tend\n\tend",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_review_products }\n end\n end",
"def show\n @product_line = ProductLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_line }\n end\n end",
"def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @artist_product }\n end\n end",
"def show\n @products = Product.find(params[:id])\n end",
"def show\n @produto_kit = ProdutoKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @produto_kit }\n end\n end",
"def index\n @sprints = @product.sprints\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sprints }\n end\n end",
"def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @produto }\n end\n end",
"def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @produto }\n end\n end",
"def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @produto }\n end\n end",
"def show\n begin\n @product = Product.published.find(params[:id])\n rescue\n return render_not_found\n end\n @title = \"КАТАЛОГ // #{@product.name}\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end",
"def index\n # show the products for a supplier\n flash[:notice] = \"Supplier has (#{@products.size}) products.\"\n respond_to do |format|\n format.html # index.html\n format.xml { render :xml => @products }\n end\n end",
"def index\n respond_with ProductNodes.all\n end",
"def index\n @product_pictures = ProductPicture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_pictures }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_family_products }\n end\n end",
"def index\n @rep_tot = Product.report_totals[0]\n @rep_loc = Location.report_located[0]\n\n @products = Product.grid\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @parent_product }\n end\n end",
"def show\n @price = Price.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @price }\n end\n end",
"def index\n @products = Product.find(:all, :include => [:author])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def index\n @products = Product.all_by_code.paginate :page => params[:page], :per_page => 30\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @products }\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_attachments }\n end\n end",
"def show\n @mixed_product = MixedProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mixed_product }\n end\n end",
"def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @product_review_product }\n end\n end",
"def show\n @producto_stock = ProductoStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @producto_stock }\n end\n end",
"def show_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_usage }\n end\n end",
"def show\n @product_archive = ProductArchive.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_archive }\n end\n end",
"def index\n @categories = Category.all\n @products = {}\n @categories.each do |c|\n products_by_category = c.products\n @products[c.id.to_s] = products_by_category\n end\n @products = Product.all if @products.nil?\n logger.info(@products)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def show\n @price_list = PriceList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @price_list }\n end\n end",
"def show\n @price_list = PriceList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @price_list }\n end\n end",
"def index\n @product_statuses = ProductStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_statuses }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item}\n end\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_videos }\n end\n end",
"def show\n\n\t\t@products = Product.find :all, :conditions => \"publisher_id = '#{@publisher.id}'\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publisher }\n end\n end",
"def show\n @product_section = ProductSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_section }\n end\n end",
"def show\n @products = Product.find_by_id(params[:id])\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end"
] | [
"0.7179336",
"0.7171388",
"0.7154841",
"0.710436",
"0.7082973",
"0.69185144",
"0.6908935",
"0.68934613",
"0.68782115",
"0.68597215",
"0.68382996",
"0.68382996",
"0.68382996",
"0.68382996",
"0.68382996",
"0.68382996",
"0.68382996",
"0.68382996",
"0.68382996",
"0.68382996",
"0.68382996",
"0.68382996",
"0.6832363",
"0.67805123",
"0.6773906",
"0.67667943",
"0.6753084",
"0.6735251",
"0.6730357",
"0.6683981",
"0.66813993",
"0.6671414",
"0.6599522",
"0.65883994",
"0.65797466",
"0.6578337",
"0.65499383",
"0.6511255",
"0.65050715",
"0.646057",
"0.6452518",
"0.6448992",
"0.6448992",
"0.6448992",
"0.6448992",
"0.6432652",
"0.6407713",
"0.6385787",
"0.63709563",
"0.63679206",
"0.6364987",
"0.6358217",
"0.6357853",
"0.6356669",
"0.6355394",
"0.6338893",
"0.63271815",
"0.6327106",
"0.6323949",
"0.63126016",
"0.6310963",
"0.63090473",
"0.62925076",
"0.62858945",
"0.6285165",
"0.62772965",
"0.62749976",
"0.62672687",
"0.6264646",
"0.62582624",
"0.6226022",
"0.6218661",
"0.6218661",
"0.6218661",
"0.62134373",
"0.6207607",
"0.6205593",
"0.61929023",
"0.6167149",
"0.61614215",
"0.6161173",
"0.6152398",
"0.6149357",
"0.6136285",
"0.6130375",
"0.61294866",
"0.6126768",
"0.6121992",
"0.6118473",
"0.61127293",
"0.6112671",
"0.6111777",
"0.60965323",
"0.60965323",
"0.6087729",
"0.6068643",
"0.60661083",
"0.606421",
"0.6053437",
"0.6049116"
] | 0.69124043 | 6 |
GET /products/new GET /products/new.xml | def new
@product = Product.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @product }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product }\n end\n end",
"def new\n @product = Product.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def new\r\n @product = Product.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @product }\r\n end\r\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item}\n end\n end",
"def new\n #@product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_software }\n end\n end",
"def new\n default_data\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n format.json { render :json => @product }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @product_info = ProductInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_info }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @artist_product }\n end\n end",
"def new\n @catalog_product = CatalogProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog_product }\n end\n end",
"def new\n @product = Product.new(:active => true)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def new\n @product_list = ProductList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_list }\n end\n end",
"def new\n @sample_product = SampleProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sample_product }\n end\n end",
"def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end",
"def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @parent_product }\n end\n end",
"def new\n @produto = ProdutoSimples.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @produto }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_family_product }\n end\n end",
"def new\n @shopping = Shopping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shopping }\n end\n end",
"def new\n @produto = Produto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @produto }\n end\n end",
"def new\n @produto = Produto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @produto }\n end\n end",
"def new\n @product = Product.new\n assign_lovs\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @product }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software }\n end\n end",
"def new\n 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\t \t# @product = Product.create( name: params[:name], description: params[:description])\n\t \t# redirct_to '/products/index'\n \tend",
"def new\r\n @product_result = ProductResult.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @product_result }\r\n end\r\n end",
"def new\r\n @product_result = ProductResult.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @product_result }\r\n end\r\n end",
"def new\r\n @product_result = ProductResult.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @product_result }\r\n end\r\n end",
"def new\r\n @product_result = ProductResult.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @product_result }\r\n end\r\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_batch }\n end\n end",
"def new\n\t\t@produt = Produt.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml {render :xml => @produt}\n\t\tend\n\tend",
"def new\n @product_order = ProductOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_order }\n end\n end",
"def new\n print params\n @product_sold = ProductSold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_sold }\n end\n end",
"def new\n @product_status = ProductStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_status }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new()\n respond_to do |format|\n format.js # new.js.rjs\n format.xml { render :xml => @product }\n end\n end",
"def new\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @price }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product }\n end\n end",
"def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end",
"def new\n @product = Product.new()\n \n respond_to do |format|\n format.js # new.js.rjs\n format.xml { render :xml => @product }\n end\n end",
"def new\n @shop = Shop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shop }\n end\n end",
"def new\n @product_exchange = ProductExchange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_exchange }\n end\n end",
"def new\n @product = ProductProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @catalog_product_attributes = CatalogProductAttributes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog_product_attributes }\n end\n end",
"def new\n @product_line = ProductLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_line }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=> @product }\n end\n end",
"def new\n @pro_temp = ProTemp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pro_temp }\n end\n end",
"def new\n @production = Production.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @production }\n end\n end",
"def new\n @press = Press.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @press }\n end\n end",
"def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end",
"def new\n if params[:product_id]\n @badge.product = Product.find(params[:product_id])\n end\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @badge }\n end\n end",
"def new\n\t\t@product = Product.new\n\t\t@products = Product.all\n\t\t@attachment_file = AttachmentFile.new\n\t\t@action = 'create'\n\t\trespond_to do |format|\n\t\t format.html # new.html.erb\n\t\t format.json { render :json => @product }\n\t\tend\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @brand_solution_featured_product }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_cabinet }\n end\n end",
"def new\n @mixed_product = MixedProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mixed_product }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @product_specification.product = @product\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_specification }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end",
"def new\n @pr = Pr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pr }\n end\n end",
"def new\n @product_archive = ProductArchive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_archive }\n end\n end",
"def new\n # @produto = Produto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @produto }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end"
] | [
"0.76482433",
"0.7579773",
"0.7519316",
"0.7502765",
"0.74657583",
"0.7434349",
"0.74215573",
"0.7396897",
"0.7360391",
"0.7310408",
"0.7238188",
"0.72329867",
"0.7184186",
"0.71429384",
"0.71082217",
"0.7098051",
"0.7098051",
"0.70815927",
"0.70775115",
"0.7044904",
"0.70373803",
"0.70056707",
"0.70056707",
"0.700555",
"0.69689274",
"0.69584095",
"0.69498825",
"0.69232965",
"0.69232965",
"0.69232965",
"0.69232965",
"0.6921298",
"0.6919372",
"0.69191754",
"0.6916569",
"0.69139946",
"0.69091564",
"0.68994254",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6898024",
"0.6896542",
"0.68939847",
"0.6893239",
"0.6893239",
"0.6893239",
"0.6893239",
"0.6887818",
"0.68778294",
"0.68750846",
"0.68697834",
"0.6859535",
"0.68521595",
"0.6850737",
"0.6844048",
"0.68430364",
"0.6825912",
"0.68238497",
"0.68200564",
"0.6817376",
"0.68134314",
"0.6811661",
"0.68102527",
"0.68030876",
"0.67940074",
"0.67940074",
"0.6791937",
"0.6786468",
"0.67799324",
"0.67743486",
"0.67731",
"0.67726004"
] | 0.75921214 | 10 |
POST /products POST /products.xml | def create
@product = Product.new(params[:product])
respond_to do |format|
if @product.save
format.html { redirect_to(products_path, :notice => 'Product was successfully created.') }
format.xml { render :xml => @product, :status => :created, :location => @product }
else
@category = Category.all
@subcategory = Subcategory.all
format.html { render :action => "new" }
format.xml { render :xml => @product.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_product(product)\n request(product, \"product\", :post, {method: \"add\"})\n end",
"def post_to_newgistics\n document = Spree::Newgistics::DocumentBuilder.build_product([self])\n response = Spree::Newgistics::HTTPManager.post('/post_products.aspx', document)\n\n if response.status == 200\n errors = Nokogiri::XML(response.body).css('errors').children.any?\n update_column(:posted_to_newgistics, true) unless errors\n end\n\n end",
"def create\n if params[:products]\n params[:products].each do |product|\n @product = Product.new(name: product[:name],\n brand: product[:brand],\n model: product[:model],\n sku: product[:sku],\n price: product[:price],\n desc: product[:desc])\n if !@product.save\n render json: @product.errors.full_messages, status: 422\n end\n end\n render 'api/products/index'\n else\n @product = Product.new(product_params)\n if @product.save\n render 'api/products/show'\n else\n render json: @product.errors.full_messages, status: 422\n end\n end\n end",
"def create\n @product = @collection.products.build(product_params)\n\n if @product.save\n render json: @product, status: :created#, location: @collection\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n flash[:notice] = 'Product was successfully created.'\n format.html { redirect_to(@product) }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n save_success\n format.html { redirect_to(@product) }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n respond_to do |format|\n if @product.save\n flash[:notice] = 'Product was successfully created.'\n format.html { redirect_to(@product) }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def omega\n products = GetProducts.new.send_request\n SaveProducts.new(products[:productRecords]).save\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to(@product, :notice => 'Product was successfully created.') }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\r\n @product = Product.new(params[:product])\r\n\r\n respond_to do |format|\r\n if @product.save\r\n flash[:notice] = 'Product was successfully created.'\r\n format.html { redirect_to(@product) }\r\n format.xml { render :xml => @product, :status => :created, :location => @product }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to(@product, :notice => 'Product was successfully created.') }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to(@product, :notice => 'Produto criado com sucesso.') }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.create!(product_params)\n json_response(@product, :created)\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created, location: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n if @product.save\n \n respond_with(@product, :location=>products_url)\n else\n respond_with(@product, :head=>:bad_request)\n end\n end",
"def create\n newProduct = Product.new(products_params)\n if newProduct.save\n msg = { status: 201 , product: newProduct }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n else\n msg = { status: 422 }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n flash[:notice] = 'El producto fue creado con éxito.'\n format.html { redirect_to(@product) }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n @product.save\n set_products\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to admin_dashboard_path, :notice => 'Product was successfully created.' }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product_request = ProductRequest.new(params[:product_request])\n\n respond_to do |format|\n if @product_request.save\n flash[:notice] = 'ProductRequest was successfully created.'\n format.html { redirect_to(product_requests_url) }\n format.xml { render :xml => @product_request, :status => :created, :location => @product_request }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, :notice => 'Product was successfully created.' }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, :notice => 'Product was successfully created.' }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, :notice => 'Product was successfully created.' }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product,\n :notice=> 'Product was successfully created.' }\n format.json { render :json=> @product, :status=> :created,\n :location=> @product }\n else\n format.html { render :action=> \"new\" }\n format.json { render :json=> @product.errors,\n :status=> :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n flash[:notice] = 'Onnistuit lisaamaan tuotteen!'\n\t\tformat.html { redirect_to(admin_index_path) }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\r\n @product = Product.new(params[:product])\r\n\r\n respond_to do |format|\r\n if @product.save\r\n flash[:notice] = 'Product was successfully created.'\r\n format.html { redirect_to(:controller => :admin, :action => :product_list) }\r\n format.xml { render :xml => @product, :status => :created, :location => @product }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create(product)\n validate_type!(product)\n\n attributes = sanitize(product)\n _, _, root = @client.post(\"/products\", attributes)\n\n Product.new(root[:data])\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_url, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: products_url }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def products\n @products = ['ninja', 'fish', 'chauffeur']\n respond_to do |format|\n format.html # render html version\n format.xml {\n # NOTE This only works for ActiveRecord objects\n # render :xml => @products.to_xml\n render :file => \"machines/products.rxml\", :use_full_path => true\n }\n end\n end",
"def create\n @product = Product.new(params[:product])\n @product.save\n redirect_to :action => :index\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created, location: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: t(:product_created) }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n flash[:notice] = 'Produto criado.'\n format.html { redirect_to(@product) }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n default_data\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_url, notice: \"Product was successfully created.\" }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_path, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_url, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product,\n notice: 'Product was successfully created.' }\n format.json { render :show, status: :created,\n location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n respond_with(@product) do |format|\n loginputs @product\n if @product.save(product_params)\n loginputs called_from_index_page?\n @products = get_products if called_from_index_page?\n loginputs @products\n end\n end\n\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: \"Product was successfully created.\" }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.create( product_params )\n redirect_to '/products'\nend",
"def create\n @product = Product.create( product_params )\n redirect_to '/products'\nend",
"def create\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(product_params)\n \n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n if @product.save\n render json: {id: @product.id}\n else\n render json: {msg: @product.errors.full_messages.first}, status: :unprocessable_entity\n end\n end",
"def create\n @sample_product = SampleProduct.new(params[:sample_product])\n\n respond_to do |format|\n if @sample_product.save\n format.html { redirect_to(@sample_product, :notice => 'Sample product was successfully created.') }\n format.xml { render :xml => @sample_product, :status => :created, :location => @sample_product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sample_product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product_info = ProductInfo.new(params[:product_info])\n\n respond_to do |format|\n if @product_info.save\n flash[:notice] = 'ProductInfo was successfully created.'\n format.html { redirect_to(@product_info) }\n format.xml { render :xml => @product_info, :status => :created, :location => @product_info }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product_info.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'new' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_product(product_node)\n url = URL + product_node.xpath(\"./strong/a/@href\").text\n name = product_node.xpath(\"./strong/a\").text.delete(\"\\n\" \" \")\n image_url = product_node.xpath(\"../td[@class='pimage']/a/img/@src\").text\n Product.create(url: url, name: name, image_url: image_url)\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Продукт успешно создан.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Изделие успешно создано.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n flash[:notice] = 'Book entry successfully created.'\n format.html { redirect_to(@product) }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.create(product_params)\n if @product.save\n # Respond to html with a redirect and json\n respond_to do |format|\n format.html do\n flash[:notice] = 'Product added'\n redirect_to products_path\n end\n format.json do\n render json: product.to_json\n end\n end\n else\n # Respond to html with a redirect and json\n respond_to do |format|\n format.html do\n flash.now[:error] = 'Error adding product'\n render :new\n end\n format.json do\n render json: { errors: @product.errors.full_messages }, status: 422\n end\n end\n end\n end",
"def create\n @magento_product = MagentoProduct.new(params[:magento_product])\n\n respond_to do |format|\n if @magento_product.save\n format.html { redirect_to @magento_product, notice: 'Magento product was successfully created.' }\n format.json { render json: @magento_product, status: :created, location: @magento_product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @magento_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n \n end"
] | [
"0.6789319",
"0.6542377",
"0.6446984",
"0.6443423",
"0.6434772",
"0.6432644",
"0.6425894",
"0.64010847",
"0.63864654",
"0.63746935",
"0.63500327",
"0.6335439",
"0.63341945",
"0.6292344",
"0.62861097",
"0.6277138",
"0.62646955",
"0.6240773",
"0.6239165",
"0.6231106",
"0.61926043",
"0.6187682",
"0.61847657",
"0.61847657",
"0.61847657",
"0.6179927",
"0.61700773",
"0.6159381",
"0.6153699",
"0.61504024",
"0.6143953",
"0.61394334",
"0.6138925",
"0.6135028",
"0.6128992",
"0.61277676",
"0.61273617",
"0.6120668",
"0.61197025",
"0.6116091",
"0.6114136",
"0.61031985",
"0.6102061",
"0.6102061",
"0.6102061",
"0.6102061",
"0.6102061",
"0.6102061",
"0.6102061",
"0.6102061",
"0.6102061",
"0.6102061",
"0.6102061",
"0.6102061",
"0.609988",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093639",
"0.6093288",
"0.60926557",
"0.6074249",
"0.6074249",
"0.60725725",
"0.60695225",
"0.6069077",
"0.6065656",
"0.6038822",
"0.60324246",
"0.60271204",
"0.60265213",
"0.6025563",
"0.60234493",
"0.60200197",
"0.6017409",
"0.6015974",
"0.6011752"
] | 0.0 | -1 |
PUT /products/1 PUT /products/1.xml | def update
@product = Product.find(params[:id])
respond_to do |format|
if @product.update_attributes(params[:product])
format.html { redirect_to(products_path, :notice => 'Product was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @product.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n save_success\n format.html { redirect_to(@product) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product.update(product_params)\n set_products\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Product was successfully updated.'\n format.html { redirect_to(@product) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Product was successfully updated.'\n format.html { redirect_to(@product) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def update\r\n @product = Product.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @product.update_attributes(params[:product])\r\n flash[:notice] = 'Product was successfully updated.'\r\n format.html { redirect_to(@product) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to(@product, :notice => 'Produto alterado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'El producto se ha actualizado.'\n format.html { redirect_to(@product) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @product.update(product_params)\n render json: @product, status: :ok#, location: @collection\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n @product = TempProduct.find(params[:id])\n @product.qty = params[:qty]\n # save product\n if @product.save\n # success\n render :json => { :success => true }\n else\n # failed\n render :json => { :success => false }\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(product_params)\n format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def update\n #@product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n @product = Product.find_by_urlname(params[:id])\r\n\r\n respond_to do |format|\r\n if @product.update_attributes(params[:product])\r\n flash[:notice] = 'Product was successfully updated.'\r\n format.html { redirect_to(:controller => :admin, :action => :product_list) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def set_api_v1_product\n begin\n @api_v1_product = Product.find(params[:id])\n rescue => ex\n json_response({error: ex.message}, :not_found)\n end\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @product = Product.find(params[:id])\n\n if @product.update(product_params)\n head :no_content\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Product was successfully updated.'\n format.html { redirect_to products_url(:oss => (@product.oss ||= 'false')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors.to_xml }\n end\n end\n end",
"def update\n @product_info = ProductInfo.find(params[:id])\n\n respond_to do |format|\n if @product_info.update_attributes(params[:product_info])\n flash[:notice] = 'ProductInfo was successfully updated.'\n format.html { redirect_to(@product_info) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_info.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Book entry successfully updated.'\n format.html { redirect_to(@product) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update_attributes(product_params)\n format.html { redirect_to([:admin, @product], notice: 'Product was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated product: #{@product.name}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product,\n :notice=> 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action=> \"edit\" }\n format.json { render :json=> @product.errors,\n :status=> :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n @product.name_prefix = @product.name.first.upcase\n respond_to do |format|\n if @product.update_attributes(params[:product])\n\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @magento_product = MagentoProduct.find(params[:id])\n\n respond_to do |format|\n if @magento_product.update_attributes(params[:magento_product])\n format.html { redirect_to @magento_product, notice: 'Magento product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @magento_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n #@product.accessible = :all if admin?\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to quick_list_path, :notice => 'Product was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: t(:product_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.first(conditions: ['id = ? and user_id = ?', id: params[:id], user_id: current_user.id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n if @product.update_attributes(params[:product])\n respond_to do |format|\n format.html { redirect_to products_path, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end",
"def update\n @product_request = ProductRequest.find(params[:id])\n\n respond_to do |format|\n if @product_request.update_attributes(params[:product_request])\n flash[:notice] = 'ProductRequest was successfully updated.'\n format.html { redirect_to(@product_request) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @document.product_id = document_params[:product_id] #入力時に選択した製品のidを、documentの外部 key として記録\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: \"Document was successfully updated.\" }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Produto salvo.'\n format.html { redirect_to(@product) }\n format.xml { head :ok }\n else\n default_data\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @record = Product.find(params[:id])\n @record.update_attributes(params[:product])\n \n respond_to do |format|\n format.json {\n render json: {}\n }\n end\n end",
"def update\n updateProduct = Product.find_by_id(params[:id])\n updateProduct.update(products_params)\n if updateProduct != nil\n msg = { status: 200 , product: updateProduct }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n else\n msg = { status: 422 }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @product = Product.find(params[:id])\n \n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n if @product.update_attributes(params[:product])\n redirect_to products_path\n end\n end",
"def update\n if @product.update(product_params)\n render :show, status: :ok, location: api_v1_product_path(@product)\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def put!\n request! :put\n end",
"def update\n return unless product_params\n render json: @product.simple_info, status: :ok if @product.update!(@product_params)\n rescue => e\n render json: { error: e }, status: :ok\n end",
"def update\n @product = Product.find(params[:id])\n\t\trespond_to do |format|\n\t\t if @product.update_attributes(params[:product])\n\t\t\tif @product.photo.nil?\n\t\t\t\tphoto = Photo.find_by_product_id(@product.id)\n\t\t\t\t@product.update_attributes(:photo_id => photo.id) if !photo.nil?\n\t\t\tend\n\t\t\tformat.html { redirect_to @product, :notice => 'Успешно обновлено' }\n\t\t\tformat.json { head :no_content }\n\t\t else\n\t\t\tformat.html { render :action => \"edit\" }\n\t\t\tformat.json { render :json => @product.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to products_path, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.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 @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n\n # RhoConnect server\n server = \"http://127.0.0.1:9292\"\n login = \"rhoadmin\"\n password = \"\"\n\n # Login to the RhoConnect server\n res = RestClient.post(\"#{server}/login\", { :login => login, :password => password }.to_json, :content_type => :json)\n\n # Get the token from the login response\n token = RestClient.post(\"#{server}/api/get_api_token\", '', { :cookies => res.cookies })\n\n # Send a ping message, which triggers a ping on the device\n ping_params = {\n :api_token => token,\n :user_id => [\"bhanu\"], # user_id that this message is for\n :sources => [\"Product\"], # sources we want to sync when this message is received\n :vibrate => \"2\",\n :message => \"#{params[:product][:name]} has been updated\",\n :sound => ''\n }\n\n RestClient.post(\"#{server}/api/ping\", ping_params.to_json, :content_type => :json)\n\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to admin_dashboard_path, :notice => 'Product was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Tekemasi tuotepaivitys onnistui.'\n\t\tformat.html { redirect_to(admin_index_path)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n #Find product by productID\n @product = Product.find_by(productID: params[:id])\n \n respond_to do |format|\n if @product.update_attributes(product_params)\n format.html { redirect_to products_path, notice: 'Product has been updated.' }\n format.json { render :index, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = @person.products.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:model])\n flash[:notice] = 'Product was successfully updated.'\n format.json { render :json=>nil }\n else\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @supplier = Supplier.find(params[:supplier_id])\n @product = @supplier.products.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @supplier, :notice => 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @os_product.update(os_product_params)\n format.html { redirect_to @os_product, notice: 'Os product was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_product }\n else\n format.html { render :edit }\n format.json { render json: @os_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Продукт успешно обновлен.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n @produto.update(produto_params)\n respond_with @produto\n end",
"def put endpoint, data\n do_request :put, endpoint, data\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sample_product = SampleProduct.find(params[:id])\n\n respond_to do |format|\n if @sample_product.update_attributes(params[:sample_product])\n format.html { redirect_to(@sample_product, :notice => 'Sample product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sample_product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n \t\t@product = Product.update( product_params )\n \t\tredirect_to '/products/'\n\tend",
"def update\n @product = Product.find(params[:id])\n\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to edit_product_path(@product), notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n respond_to do |format|\n @product.edit\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_count, :price)\n\n product.update(product_details)\n\n render json: product\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Produto atualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_product(product, id)\n request(customer, \"product\", :post, {id: id, method: \"edit\"})\n end",
"def update\n @catalog_product = CatalogProduct.find(params[:id])\n\n respond_to do |format|\n if @catalog_product.update_attributes(params[:catalog_product])\n flash[:notice] = 'CatalogProduct was successfully updated.'\n format.html { redirect_to(@catalog_product) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @catalog_product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @product.update(product_params)\n render json: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def update\n @produto_kit = ProdutoKit.find(params[:id])\n\n respond_to do |format|\n if @produto_kit.update_attributes(params[:produto_kit])\n flash[:notice] = 'ProdutoKit was successfully updated.'\n format.html { redirect_to(@produto_kit) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @produto_kit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product1.update(product1_params)\n format.html { redirect_to @product1, notice: \"Product1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_product_info\n update_info = params[:product]\n market = Market.find(params[:place_id])\n product = market.products.find(update_info[:id])\n if product.update(update_info)\n response = {status: \"OK\", code: 200}\n else\n response = { status: \"Not Ok\", code: 201}\n end\n respond_to do |format|\n format.json{render json: response.to_json }\n end\n end",
"def update\n\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @angular = Product.find(params[:id])\n \n @angular.update_attributes(title: params[:products][:title], description: params[:products][:description])\n respond_to do |format|\n if @angular.valid?\n format.html { redirect_to store_index_path, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @angular.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6657229",
"0.6596969",
"0.6552781",
"0.6262558",
"0.6182844",
"0.6148961",
"0.61441714",
"0.6139365",
"0.61223286",
"0.61182135",
"0.60683304",
"0.60678256",
"0.60616505",
"0.6059548",
"0.6045304",
"0.60420585",
"0.6039043",
"0.6035258",
"0.60067576",
"0.59999204",
"0.5983771",
"0.59831846",
"0.5966079",
"0.5948212",
"0.59477913",
"0.59342957",
"0.5908153",
"0.5870364",
"0.5869019",
"0.58638626",
"0.58638626",
"0.5862622",
"0.5858731",
"0.5858115",
"0.5858004",
"0.5850113",
"0.5850113",
"0.5844027",
"0.5841277",
"0.58408207",
"0.5839375",
"0.5833277",
"0.5831459",
"0.5831289",
"0.58297765",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5828899",
"0.5825701",
"0.5823492",
"0.58203274",
"0.5816643",
"0.58128923",
"0.58004874",
"0.57990587",
"0.5789778",
"0.5779453",
"0.5775234",
"0.57696795",
"0.5767051",
"0.5766397",
"0.57663685",
"0.5763211",
"0.5756016",
"0.57466215",
"0.5741328",
"0.57402575",
"0.5739813",
"0.57342654",
"0.57326967",
"0.57264555",
"0.57239705",
"0.5718725",
"0.571693",
"0.5714081",
"0.5713734",
"0.5708736",
"0.56993836",
"0.5691581",
"0.5689563",
"0.56872463",
"0.5683031",
"0.5682199",
"0.5680249",
"0.56737655"
] | 0.6130307 | 8 |
DELETE /products/1 DELETE /products/1.xml | def destroy
@product = Product.find(params[:id])
@product.destroy
respond_to do |format|
format.html { redirect_to(products_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end",
"def destroy\n #@product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to(products_url) }\n format.xml { head :ok }\n end\n end",
"def delete_product(id)\n @client.raw('delete', \"/ecommerce/products/#{id}\")\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to(:controller => :products, :action => :new) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @product = Product.find(params[:id])\r\n @product.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(products_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\r\n @product = Product.find_by_urlname(params[:id])\r\n @product.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(:controller => :admin, :action => :product_list) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_products_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @catalog = Catalog.find(params[:catalog_id])\n @product = @catalog.products.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to(catalog_products_path(@catalog)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n flash[:notice] = 'Produto removido com sucesso!'\n respond_to do |format|\n format.html { redirect_to(products_url) }\n format.xml { head :ok }\n end\n end",
"def remove_configuration_product\r\n # node = ProductPackageProduct.find(params[:id].to_i).destroy\r\n # redirect_to :action => \"configuration_products\", :id => node.parent_id\r\n ExampleConfigurationProduct.delete params[:id]\r\n redirect_to :action => \"configuration_products\", :id => params[:id]\r\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to(admin_products_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted product: #{@product.name}\")\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to(admin_products_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted product: #{@product.name}\")\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @sample_product = SampleProduct.find(params[:id])\n @sample_product.destroy\n\n respond_to do |format|\n format.html { redirect_to(sample_products_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @catalog_product = CatalogProduct.find(params[:id])\n @catalog_product.destroy\n\n respond_to do |format|\n format.html { redirect_to(catalog_products_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to(products_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def delete(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.delete(path, data, options))\n return_values = Array.new\n \n return_values.push(response.success)\n\n \n return_values[0]\n end",
"def destroy\n @product_request = ProductRequest.find(params[:id])\n @product_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n unread\n\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n\n head :no_content\n end",
"def delete\r\n \tProductPackageNode.delete params[:node_ids]\r\n render :nothing => true\r\n end",
"def destroy\n @magento_product = MagentoProduct.find(params[:id])\n @magento_product.destroy\n\n respond_to do |format|\n format.html { redirect_to magento_products_url }\n format.json { head :no_content }\n end\n end",
"def delete_product\n product_to_delete = @view.delete_product\n @seller.delete_product(product_to_delete)\n input = @view.menu(\"2\")\n seller_actions(input) \n end",
"def destroy\n @produto = Produto.find(params[:id])\n @produto.destroy\n\n respond_to do |format|\n format.html { redirect_to(produtos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @produto = Produto.find(params[:id])\n @produto.destroy\n\n respond_to do |format|\n format.html { redirect_to(produtos_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n #@produto = Produto.find(params[:id])\n @produto.destroy\n\n respond_to do |format|\n format.html { redirect_to(produtos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product_info = ProductInfo.find(params[:id])\n @product_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_infos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @produto = Produto.find(params[:id])\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to(admin_produtos_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product_detail = ProductDetail.find(params[:id])\n @product_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_details_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n params.delete(:id)\n load_index()\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n head :no_content\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @record = Product.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.delete!\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def delete\n msg = FileOperations.id_exist?(self) ? FileOperations.delete(self) : 'Product\n Not Found'\n puts msg\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def deleteProductProvisioning( product_id, gen_id)\n params = Hash.new\n params['product_id'] = product_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/product/provisioning\",params)\n end",
"def destroy\n @product.destroy\n end",
"def destroy\n @product1.destroy\n respond_to do |format|\n format.html { redirect_to product1s_url, notice: \"Product1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_order = ProductOrder.find(params[:id])\n @product_order.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_orders_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @collection = Collection.find(params[:id])\n\n Product.delete_all(:collection_id => @collection.id)\n\n save_activity(@collection, \"deleted collection\")\n \n @collection.destroy\n\n respond_to do |format|\n format.html { redirect_to(dashboard_path) }\n format.xml { head :ok }\n end\n end",
"def delete(*rest) end",
"def destroy\n puts(\"you are in destroy \")\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_test = ProductTest.find(params[:id])\n @product_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_tests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @my_product.destroy\n end",
"def destroy\n @user_product_xref = UserProductXref.find(params[:id])\n @user_product_xref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_product_xrefs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product_batch.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_batches_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n ProductSubproduct.delete_all(\"subproduct_id=#{params[:id]}\")\n Subproduct.find(params[:id]).delete\n redirect_to :action => 'index'\n flash[:notice] = \"#{t(:text_subproducts)} #{t(:flash_was_successful)} #{t(:text_deleted)}\"\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to root_url(:item => 3), notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find params[:id]\n @product.destroy\n redirect_to products_path\n end",
"def destroy\n p @product.destroy!\n render json: { result: 'deleted' }, status: :ok\n end",
"def destroy\n @ps = ProductsStore.find(params[:id])\n @ps.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was successfully removed from store.' }\n format.json { head :ok }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @produto_kit = ProdutoKit.find(params[:id])\n @produto_kit.destroy\n\n respond_to do |format|\n format.html { redirect_to(produto_kits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ccbs_product = CcbsProduct.find(params[:id])\n @ccbs_product.destroy\n\n respond_to do |format|\n format.html { redirect_to(ccbs_products_url) }\n format.xml { head :ok }\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 destroy\n @product = Product.find(params[:id])\n @product.destroy\n redirect_to root_path\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n redirect_to root_path\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @product_set = ProductSet.find(params[:id])\n @product_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_product_sets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Product.find(@params[:id]).destroy\n redirect_to :action => 'list'\n end",
"def product_delete\n\t\t@task_data = Product.find(params[:id])\n\t\t@task_data.destroy\n\t\tredirect_to product_index_path\n\tend",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to(purchase_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @categories = Category.all\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to(products_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n begin\n @api_v1_product.destroy!\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def destroy\n @qx = Qx.find(params[:id])\n @qx.destroy\n\n respond_to do |format|\n format.html { redirect_to(qxes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n drop_rs(current_user.id, params[:id], \"uploaded\")\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to uploaded_products_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.deleted = true\n @product.update_attributes(:deleted => true) \n # @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n redirect_to :action => :index\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @product_line = ProductLine.find(params[:id])\n @product_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.714076",
"0.6952734",
"0.6938255",
"0.6938226",
"0.69245267",
"0.69100815",
"0.69078654",
"0.68602526",
"0.68597865",
"0.6848749",
"0.678357",
"0.67752033",
"0.6767523",
"0.6767523",
"0.67373854",
"0.67333865",
"0.6726935",
"0.66829884",
"0.66734195",
"0.66715693",
"0.66235703",
"0.66042054",
"0.6600161",
"0.6580965",
"0.65694976",
"0.6568717",
"0.6568717",
"0.65528095",
"0.65514755",
"0.6541406",
"0.65246964",
"0.65230703",
"0.6520133",
"0.6514038",
"0.65129656",
"0.64921147",
"0.6471042",
"0.6463165",
"0.6453351",
"0.645127",
"0.6446218",
"0.6438687",
"0.6425613",
"0.6424949",
"0.64116037",
"0.6408714",
"0.6407843",
"0.64049554",
"0.64010596",
"0.63963455",
"0.6394634",
"0.6390897",
"0.63868827",
"0.63862926",
"0.6384886",
"0.63819104",
"0.6376784",
"0.6372932",
"0.6363909",
"0.6361972",
"0.63573253",
"0.6357316",
"0.63545114",
"0.63545114",
"0.63466287",
"0.63466287",
"0.63466287",
"0.6346553",
"0.63453585",
"0.63453585",
"0.6342286",
"0.6340067",
"0.633849",
"0.6337201",
"0.632892",
"0.63286805",
"0.6328668",
"0.6327918",
"0.63255924",
"0.63233775",
"0.6322384",
"0.6321035",
"0.6319282",
"0.6319104",
"0.6319104",
"0.6319104",
"0.6319104",
"0.6319104"
] | 0.69181097 | 16 |
End: Search method for load subcategories | def load_subcategries
#puts "#### Country Id - #{params[:id]}"
@subcategories = Subcategory.where(:category_id => params[:id])
respond_to do |format|
format.js{
render :update do |page|
page[:product_subcategory_id].replace collection_select(:product,:subcategory_id, @subcategories, :id, :name)
end
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subcategories\n @subcategories ||= Category.find_all_subcategories(category_name)\n end",
"def index\n @subcategories = @category.subcategories\n end",
"def sub_category\n @sub_category = SubCategory.new\n @sub_categories = SubCategory.find_all\n end",
"def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def sub_categories(params = {})\n @sub_categories ||= client.categories.all(params.merge(parent: id))\n end",
"def index\n @sub_sub_categories = SubSubCategory.all\n end",
"def index\n @sub_categories = SubCategory.all\n end",
"def index\n @subcategories = Subcategory.all\n end",
"def index\n @subcategories = Subcategory.all\n end",
"def by_category\n @category = Category.roots.find_by_slug(params[:category])\n raise ListingException, \"missing category\" if @category.blank?\n @subcategory = @category.children.find_by_slug(params[:subcategory]) if params[:subcategory].present?\n terms = [ListingFilter.category(@subcategory.present? ? @subcategory.id : @category.id), ListingFilter.state('active')]\n query = {filter: {bool: {must: terms}}, sort: {id: \"desc\"}}\n @listings = Listing.search(query).page(page).per(per).records\n\n @subcategories = @category.children.with_listings\n\n @title = [@category.name, @subcategory.try(:name)].compact.join(\" : \") + \" | Category\"\n\n respond_to do |format|\n format.html { render(action: :index, layout: !request.xhr?) }\n end\n end",
"def index\n @subcategories = Subcategory.all\n @categories = Category.all\n end",
"def get_subc(category)\n retval = []\n #Category.where(category_id: category.id).each do |c| \n category.categories.each do |c| \n retval += [c] + get_subc(c)\n end\n retval\n end",
"def index\n puts '============================ INDEX ===================================='\n\n # @archives = Archive.all\n @archives = Archive.all.where( :course_id => params[:course_id])\n\n @categories = Category.all.includes(:subcategories).where('parent_id' => nil)\n case params[:subcategory]\n when nil\n @subcategory = []\n else\n @subcategory = Category.find(params[:subcategory])\n end\n end",
"def index\n @sub2_categories = Sub2Category.all\n end",
"def index\n params.permit(:category_id)\n if params[:category_id]\n @subcategories = Subcategory.where(category_id: params[:category_id])\n else\n @subcategories = Subcategory.all\n end\n end",
"def index\n @suba_categories = SubaCategory.all\n end",
"def apply_category_filter\n top_level_category_ids = Category.top_level.\n where(id: @category_ids).\n pluck(:id)\n subcategory_ids = @category_ids +\n Category.where(parent_id: top_level_category_ids).pluck(:id)\n\n subcategory_ids\n end",
"def all_sub_categories(params = {})\n @all_sub_categories ||= sub_categories(params) + sub_categories.flat_map do |sub|\n sub.all_sub_categories(params)\n end\n end",
"def populate_category\n\t\t\t\tif params[:purpose] == \"category\"\n\t\t\t\t\t\tcategory = Category.find(params[:category_id])\n\t\t\t\t\t\t@sub_categories = category.sub_categories\n\t\t\t\telsif params[:purpose] == \"sub_category\"\n\t\t\t\t\t\tsub_category = SubCategory.find(params[:category_id])\n\t\t\t\t\t\t@inner_categories = sub_category.inner_categories\n\t\t\t\tend\n\t\tend",
"def show\n @sub_categories = SubCategory.where(category_id: params[:id]).order(:order)\n end",
"def show\n\n @search = @subcategory.resources.search(params[:q])\n @resources = @search.result(distinct: true)\n @resource_subcat_id = @subcategory.id\n end",
"def index\n @cp_subcategories = Subcategory.all\n @title = \"Subcategories\"\n end",
"def show\n\t\t@category = Category.find(params[:id])\n\t\t@sub_categories = @category.sub_categories\n\tend",
"def index\n @categories = Category.all\n @subcategories = Subcategory.all\n end",
"def getAllSubcategories(reset=false) \n reset ? @allSubcategories = [self] + self.setAllSubcategories() : \n @allSubcategories ||= [self] + self.setAllSubcategories() \nend",
"def index\n @subcategoria = Subcategorium.all\n end",
"def search_filters\n return category_filters if tree_end?\n\n reload\n end_nodes = all_children.filter(&:tree_end?)\n common_filters_in_categories(end_nodes)\n end",
"def fetch_categories\r\n page = File.open(\"#{Rails.root}/public/Categories.html\") { |f| Nokogiri::HTML(f) }\r\n Category.save_fetched_categories_and_subcategories(page)\r\n end",
"def fill_subcategory\n @select_data = Subcategory.ordered_by_category params[:category_id]\n end",
"def index\n @sub_category_types = SubCategoryType.all\n end",
"def index\n if params[:category_id]\n @category = Category.find(params[:category_id])\n end\n session[:last_cat_id] = params[:category_id] \n if params[:q].nil? && @category\n @test_cases = KoalaTestCase.paginate_by_category_id @category.id, :page => params[:page], :per_page => 50, :conditions => { :active => true} \n elsif !params[:q].blank?\n if @category.nil?\n\t\t\t\t\tlogger.info \"SEARCHING......................\"\n @test_cases = KoalaTestCase.search(params[:q], :page => params[:page], :per_page => 20, :group_by => 'category_id', :group_function => :attr, :conditions => { :active => true} ) \n else\n\t\t\t\t\tflash[:notice] = \"Please search from the top level\"\n @test_cases = KoalaTestCase.search(params[:q], :page => params[:page], :per_page => 20, :group_by => 'category_id', :group_function => :attr, :with => {:category_id => @category.self_and_descendants.map(&:id)}, :conditions => { :active => true} ) \n #@test_cases = KoalaTestCase.paginate_search(params[:q] + \" & ancestor_ids:#{@category.id}\", {:page => params[:page], :per_page => 50}, {:order => 'category_id', :conditions => { :active => true }})\n end\n else\n @test_cases = []\n end\n\n if logged_in?\n @playlists = current_user.live_playlists \n @playlist_collection = current_user.live_playlists.collect {|p| [ \"#{p.title}\", p.id ] }.reverse\n end\n end",
"def index\n @subcategories = @category.subcategories.find(:all, :order => 'popularity DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subcategories }\n end\n end",
"def get_subcategories_by_category\n permitted = params.permit(:category_name)\n category_name = permitted[\"category_name\"]\n\n sub_cat_array = []\n category_id = helpers.get_category_id_by_name(category_name)\n sub_cat_array = helpers.subcategories_by_category(category_id)\n\n respond_to do |format|\n format.js { render :json => {sub_cat_array: sub_cat_array, category_title: helpers.category_filters_title(category_name)}.to_json }\n end\n end",
"def index\n authorize! :read, Category\n if params[:search] \n @categories = Category.includes(:related_categories, :suggested_categories).where(\"lower(name) LIKE :search\",{search: \"%#{params[:search].downcase}%\"}).order( :name )\n else\n @categories = Category.includes(:related_categories, :suggested_categories).all.order( :name )\n end\n end",
"def index\n @wiki_cats = WikiCat.order(:name)\n \n clean_params\n\n @parent_id = params[:wiki_record_id] \n @keyword = params[:search]\n\n if @keyword.nil?\n @parent_id ||= 0 \n @wiki_record = WikiRecord.find(@parent_id) if @parent_id != 0 \n end\n\n @wiki_records = WikiRecord.by_user(is_manager?)\n .by_parent(@parent_id)\n .by_category(params[:wiki_cat_id])\n .search(\"%#{@keyword}%\")\n .order(:name) \n end",
"def index\n @subcategories = Subcategory.find(:all, :include => [:subname], :order=>'name')\n @categories = Category.find(:all, :order=> :name)\n @locations = Location.find(:all, :order=> :name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => [:cactus,@subcategories] }\n end\n end",
"def categories\r\n return handle_resource_not_found unless @article_category\r\n\r\n add_category_breadcrumbs(@article_category)\r\n if @article_category.leaf?\r\n @title_text = @article_category.display_text\r\n @articles = fetch_articles(order_by, nil, :conditions => {:article_category_id => @article_category.id}, :include => [:user, :article_category])\r\n @other_recent_posts = @article_category.parent.all_recent_posts(:exclude_category => @article_category) if @article_category.parent\r\n render 'articles/subcategories'\r\n else\r\n return unless check_category_for_stale\r\n @subcategories_with_posts = @article_category.children.with_published_articles\r\n render 'articles/categories'\r\n end\r\n end",
"def expand_category_ids\n\n #if we are on the filters brand page and the original url contains /categories we need to insert a dpc key into params\n if params[:originalURL].to_s.include?(\"/categories/\")\n parsed_original_url = params[:originalURL].split(\"/\")\n dpc_id = DPCategory.where(\"id = ? or param = ?\", parsed_original_url[2], parsed_original_url[2]).first.id\n #then we are on search/products or a brand page\n elsif !params[:id].nil? && params[:controller] == \"categories\" && params[:dpc].nil?\n dpc_id = DPCategory.where(\"id = ? or param = ?\", params[:id], params[:id]).first.id\n else\n #provides support for dpc[any] or dpc[all] in url\n params[:dpc] = nil if params[:dpc] == \"\"\n dpc_id = params[:dpc].try(:[],:any) || params[:dpc].try(:[],:all)\n end\n #match the DPCategory.id DPCategory.name that has been turned into a slug\n @dp_category = DPCategory.where(\"id in (?) or param in (?)\", dpc_id, dpc_id).first\n\n #we must set @dpc_param as nil here. otherwise we pass dpc with empty arrays to the searcher which will force zero results\n if @dp_category.blank?\n @dpc_param = nil\n #if we are working with a parent id\n elsif @dp_category.parent_id.blank?\n #expand the\n categories = []\n @dp_category.children.each do |dp_catg| \n categories << dp_catg.id\n dp_catg.children.each do |dp_catg_c|\n categories << dp_catg_c.id\n end\n end\n categories << @dp_category.id if categories.empty?\n @dpc_param = { :any => categories, :exact => [@dp_category.id] } \n elsif @dp_category.b_level? \n @dpc_param = { :any => @dp_category.children.collect { |dp_catg| dp_catg.id } << @dp_category.id, :exact => [@dp_category.id] }\n else\n @dpc_param = { :any => [ @dp_category.id ], :exact => [@dp_category.id] }\n end\n end",
"def index\n @category = Category.find(params[:category_id], :include => 'subcategories')\n @location = Location.find(params[:location_id])\n @subcat_array = @category.subcategories.select{|v| v.location_id == @location.id }\n a = []\n for subcat in @subcat_array\n a = [a, subcat.id]\n end\n if nil == params[:query]\n @query_string = \"\"\n @chunks = nil\n else\n @query = params[:query].strip\n @chunks = self.make_chunks(@query)\n x=0\n y=0\n\n for chunk in @chunks\n x = x+1\n\t if x > 0 && x < @chunks.size && chunk != 'and' && chunk != 'or' && chunk != '^+' && chunk != '^-' && @chunks[x] != 'and' && @chunks[x] != 'or'\n @chunks[y] = chunk + ' or '\n else\n\t\t@chunks[y] = chunk + ' '\n end\n y = y+1 \n end\n @query_string = process_chunk(@chunks)\n end \n filters = {} \n filters['subcategory_id'] = a.flatten\n @search=Ultrasphinx::Search.new(:query => @query_string, :filters => filters)\n @search.run\n @results = @search.results\n @postings = @results.paginate :page => params[:page],:per_page =>2 \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @postings }\n end\n end",
"def categories_for_solution_search(category)\n [Sfcatnode.root] + category.children\n end",
"def index\n @small_categories = SmallCategory.category_tree\n end",
"def all_categories\n end",
"def search_for_products\r\n @categories = Category.select(:id, :name).all\r\n end",
"def index\n# @subcategories = Subcategory.all\n#pagination:\n\t@subcategories = Subcategory.all.paginate :per_page => 5, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subcategories }\n end\n end",
"def index\n #@working_subcategories = WorkingSubcategory.all\n #ransack保持用コード\n query = params[:q]\n query ||= eval(cookies[:recent_search_history].to_s) \t\n \n \n #####\n #主カテゴリー画面からの遷移の場合、初期値をセット。\n if params[:working_category_id].present?\n working_cartegory_id = params[:working_category_id]\n #query = {\"working_category_id_eq\"=> working_cartegory_id}\n query.store(\"working_category_id_eq\", working_cartegory_id)\n end\n #####\n \n \n #ransack保持用-\n @q = WorkingSubcategory.ransack(query) \n \n #ransack保持用コード\n search_history = {\n value: params[:q],\n expires: 24.hours.from_now\n }\n cookies[:recent_search_history] = search_history if params[:q].present?\n #\n\t\n @working_subcategories = @q.result(distinct: true)\n \n end",
"def index\n @category_name = params[:category]\n @search = Search.new()\n if params[:category_id]\n @category = Category.find(params[:category_id])\n @products = @category.products.to_a.uniq\n @category_name = @category.name\n @categories = Category.where(parent_category: @category.parent_category)\n else\n @products = []\n @categories = Category.where(parent_category: @category_name)\n @categories.each {|e| @products << e.products}\n @products = @products.flatten.uniq\n end\n @page_number = 1\n @pages = (@products.length/12.0).ceil\n if params[:page_number]\n @page_number = params[:page_number].to_i\n if @page_number > @pages || @page_number < 1\n redirect_to \"/#{@category_name}\"\n end\n end\n min = (12 * (@page_number - 1))\n max = min + 11\n @products = @products[min..max]\n end",
"def select_sub_category(sub_name)\n visible = false\n @driver.find_elements(\n @rows[:type], @rows[:value]\n ).each do |row|\n next unless row.text == sub_name\n row.click\n visible = true\n break\n end\n #Scrolle ekranu lidz bridim, kad mekleta subkategorija tiek atrasta\n @driver.scroll_to(sub_name).click unless visible\n end",
"def index\n if params[:roots]\n @categories = Category.roots\n else\n @categories = Category.children\n end\n\n @categories = @categories.paginate(:page => params[:page], :per_page => 25)\n end",
"def set_sub_sub_category\n @sub_sub_category = SubSubCategory.find(params[:id])\n end",
"def index\n @categories = Category.all.includes(:sub_categories)\n @series = []\n @sub_category_names = []\n end",
"def set_sub_category\n @sub_category = SubCategory.find(params[:id])\n end",
"def set_sub_category\n @sub_category = SubCategory.find(params[:id])\n end",
"def index\n @search = Backend::Category.order(created_at: :desc).search(params[:q])\n @backend_categories = @search.result(:distinct => true)\n @backend_categories = @backend_categories.page(params[:page])\n # @search = Supervisor.search(params[:q])\n # @supervisors = @search.result(:distinct => true)\n end",
"def search\n\t\t @query = params[:query]\n\t\t @ssccategories = Ssccategory.search @query, :page => params[:page], :per_page => 10\n\tend",
"def show\n @category =\n Category.includes(:companies).find(params[:id])\n if @category\n @keyword = String.new\n @keyword << @category.name << \" \"\n @coms = @category.companies.paginate(:page => params[:page],\n :per_page => 15)\n unless @category.leaf?\n @children = @category.children.sort! {|a,b| a.name<=>b.name}\n @children.each do |child|\n @keyword << child.name << \" \"\n end\n end\n if @category.child?\n @category.ancestors.each do |ac|\n ariane.add ac.name, category_path(ac)\n end\n end\n unless @category.companies.blank?\n @json = @category.companies.to_gmaps4rails\n @coms_max = @category.companies.maximum(:updated_at)\n end\n ariane.add @category.name, @category\n else\n flash.now[:error] = \"Category not found.\"\n end\n end",
"def subcategories\n\t\trespond_to do |format|\n\t \tformat.json {\n\t \t\tparam = params[:payload]\n\n\t\t\t\tcategory = RequirementCategory.find_by_id(param[:target_id])\n\t\t\t\tputs category.id\n\n\t\t\t\t@subcategory = category.requirement_subcategories\n\t \t\trender :json => @subcategory\n\t \t}\n\t end\t\t\n\tend",
"def subcategories_json\n {id: id, name: name, depth: depth}\n end",
"def subcategories_json\n {id: id, name: name, depth: depth}\n end",
"def index\n @subcategory2s = Subcategory2.all\n end",
"def index\n @procedure_subcategories = ProcedureSubcategory.all\n end",
"def index\n category = params[:category]\n category = category == nil ? ROOT_ID : category.to_i\n\n current_category = Category.find(category)\n\n # Create an array of nearest childs of current_category\n @categories = current_category.categories\n\n # Create ancestors path\n @category_seq = [current_category]\n until @category_seq.first.id == ROOT_ID\n @category_seq.unshift( @category_seq[0].category )\n end\n\n # Create an array of all childs\n subcategories = get_subc(current_category)\n\n # Create an array of all products which belongs to current_category\n @items = current_category.products.to_a\n\n subcategories.each do |c|\n c.products.each { |p| @items.push p }\n end\n\n @items = Kaminari.paginate_array(@items).page(params[:page]).per(7)\n\n respond_to do |format|\n format.html\n format.js {}\n end\n\n\tend",
"def find_subcategory(year)\n subcategory = $client.subcategories.get(CategoryID: $archive_category['id']).find { |sc| sc['Name'] == year }\n return subcategory if subcategory\n subcategory = client.subcategories.create(CategoryID: 2538725754, Name: year)\nend",
"def get_subcategory\n @subcategories = EventCategoryMaster.find_subcategory(params[:id])\n respond_to do |format|\n format.json { render :json => @subcategories }\n end\n end",
"def subcategories_and_ids_list\n url_no_page = \"#{SUBCATEGORIES_URL}?#{TOKEN_PREFIX}#{OAUTH_TOKEN}&#{PAGE_PREFIX}\"\n subcategory_names_and_ids = []\n (1..4).each do |i|\n url = url_no_page + \"#{i}\"\n subcategories = JSON.parse(open(url).read)\n subcategories[\"subcategories\"].each do|subcategory|\n subcategory_names_and_ids << {name: subcategory[\"name\"], id: subcategory[\"id\"]}\n end\n end\n subcategory_names_and_ids\n end",
"def set_sub_catagory\n @sub_catagory = SubCatagory.find(params[:id])\n end",
"def set_subcategorium\n @subcategorium = Subcategorium.find(params[:id])\n end",
"def search\n @city = City.find(params[:city_id])\n @events = @city.events.search(params[:search])\n @categories = Category.search(params[:search])\n @venues = @city.venues.search(params[:search])\n add_breadcrumb \"Events\", events_path( @city )\n add_breadcrumb \"Search\", ''\n end",
"def search\n if params[:search].present?\n @foods = Food.search(params[:search].capitalize).paginate(:page => params[:page], :per_page => 4)\n @subs = Sub.search(params[:search].capitalize).paginate(:page => params[:page], :per_page => 4)\n else\n redirect_to root_path\n end\n\n #counter for search\n if params[:search].present? || params[:search].present? == false\n @foods_search = Food.all\n @subs_search = Sub.all\n#food\n @counters = Hash.new\n @foods_search.each do |c|\n @counters[c.id] = c.counter\n end\n \n @popular_foods = Array.new\n @counters = @counters.sort {|k, v| k[1]<=>v[1]}.reverse\n @counters.each do |id, counter|\n @popular_foods << Food.find(id)\n end\n#sub\n @counters_sub = Hash.new\n @subs_search.each do |c|\n @counters_sub[c.id] = c.counter\n end\n \n @popular_subs = Array.new\n @counters_sub = @counters_sub.sort {|k, v| k[1]<=>v[1]}.reverse\n @counters_sub.each do |id, counter|\n @popular_subs << Sub.find(id)\n end\n#results\n @popular_foods = @popular_foods[0...3]\n @popular_subs = @popular_subs[0...3]\n end\n end",
"def searched_not_for_all?(sub_categories_ids)\n searched_for?(sub_categories_ids) && (sub_categories.ids - sub_categories_ids.map(&:to_i)).count > 0\n end",
"def searched_not_for_all?(sub_categories_ids)\n searched_for?(sub_categories_ids) && (sub_categories.ids - sub_categories_ids.map(&:to_i)).count > 0\n end",
"def index\n if @main_category.nil?\n @categories = Category.where(:parent_id => nil).order('title')\n else\n @categories = @main_category.children\n end\n selected_category_id = params[:selected_category_id]\n if !selected_category_id.blank?\n @category = Category.find(selected_category_id)\n @ancestors_for_current = @category.ancestors.collect{|c| c.id.to_i} + [@category.id.to_i]\n end\n respond_to do |format|\n format.html { render :partial => 'select_index', :locals => {:categories => @categories} if request.xhr? }\n format.xml { render :xml => @categories }\n end\n end",
"def index\n @categories = @current_branch.categories.includes(:categories).\n where(category_id: 0).paginate(:page => params[:page], :per_page => 10)\n end",
"def call\n if @category.blank? && @search.blank?\n products = Product.by_branch(@branch).all\n elsif @category.blank? && @search.present?\n products = Product.by_branch(@branch).search(@search)\n elsif @category.present? && @search.blank?\n products = Product.by_category(@branch, @category)\n elsif @category.present? && @search.present?\n products = Product.by_category(@branch, @category).search(@search)\n else\n end\n end",
"def index\n @subcategoriaprodutos = Subcategoriaproduto.all\n end",
"def index\n # 設定\n if params[:order] == nil || params[:order] == \"\"\n params[:order] = \"created_at desc\"\n end\n\n @game_assets = GameAsset.where(make_public: true).search(params[:search], params[:main_category], params[:sub_category]).order(\"#{params[:order]}\").paginate(page: params[:page], :per_page => 25)\n\n if params[:main_category] != \"\"\n @main_category = params[:main_category]\n @sub_categories = SubCategory.sub_for(params[:main_category])\n @sub_category = params[:sub_category]\n end\n end",
"def index\n @categories = Category.roots\n end",
"def index\n @category = Category.find(params[:category_id], :include => 'subcategories')\n if 1 == @category.id\n @field_sort = (nil == params[:field_sort] )? 'departure' : params[:field_sort]\n elsif 5 == @category.id\n @field_sort = (nil == params[:field_sort] )? 'departure' : params[:field_sort]\n else \n @field_sort = (nil == params[:field_sort] )? 'organizer_sort' : params[:field_sort]\n end \n @list_mode = (nil == params[:list_mode] )? 'descending' : params[:list_mode]\n @month = (nil== params[:month] )? -99: params[:month] \n @year = (nil==params[:year] )? Date.today.year: params[:year]\n\n @subcategory = Subcategory.find(params[:subcategory_id])\n logger.debug(\"\\nHey Fellas, subcategory is ... #{@subcategory.id}\\n\")\n @location = Location.find(params[:location_id])\n if nil == params[:query]\n @query_string = \"\"\n @chunks = nil\n else\n @query = params[:query].strip\n @chunks = self.make_chunks(@query)\n x=0\n y=0\n\n for chunk in @chunks\n if 0 ==y\n @chunks[y] = chunk\n else\n\t @chunks[y] = ' ' + chunk\n end\n y = y+1 \n end\n @query_string = process_chunk(@chunks)\n end \n filters = {} \n filters['subcategory_id'] = @subcategory.id\n if @category.id == 1\n filters['departure_year'] = @year.to_i\n if -99 != @month.to_i\n filters['departure_month'] = @month.to_i\n end\n end\n @search=Ultrasphinx::Search.new(:query => @query_string, :filters => filters, :sort_by => @field_sort, :sort_mode=>@list_mode)\n @search.run\n @results = @search.results\n @postings = @results.paginate :page => params[:page],:per_page =>PER_PAGE, :month=>params[:month], :year=>params[:year] , :query=>params[:query] \n\n if @chunks != nil and @postings.size <1 \n flash[:notice] = \"No search results found for this query. All words must match when searching by keyword.\"\n end \n\n respond_to do |format|\n if @category.id.to_i == 1\n\tformat.html # index.html.erb\n else\n format.html {render :layout =>\"subcategories_directory\" } # index.html.erb\n end\n format.xml { render :xml => @postings }\n end\n end",
"def index\n @q = SearchParams.new(params[:search_params] || {})\n @categories = Category.default_where(@q.attributes(self)).order(:mode).page(params[:page]).per(10)\n end",
"def index\n @tutorials = Tutorial.running(session[:country])\n @categories = @tutorials.all_sub_categories.group_by(&:category)\n\n if params[\"category_id\"].present? || params[\"sub_category_id\"].present? \n institutes = params[\"category_id\"].present? ? Category.find(params[\"category_id\"]).get_institutes : SubCategory.find(params[\"sub_category_id\"]).institutes\n @tutorials = institutes.collect(&:branches).flatten.collect{ |b| b.tutorials.running(session[:country])}\n elsif params[\"institute_id\"].present?\n @tutorials = []\n institute = Institute.find(params[\"institute_id\"])\n branches = (params[\"city\"].present? || params[\"zip\"].present?) ? institute.branches.in_location(params) : institute.branches\n branch_tutorials(branches)\n elsif params[\"city\"].present? || params[\"zip\"].present?\n @tutorials = []\n branches = Branch.in_location(params)\n branch_tutorials(branches)\n end\n\n @tutorials = @tutorials.flatten.uniq.paginate(:page => params[:page], :per_page => 12)\n end",
"def find_all_sidebar_submenu_category(category)\n if !category.children.empty?\n html_code = ''\n category.children.each do |sub_category|\n html_code += '<div class=\"col-sm-12 col-md-3\">\n <ul class=\"links list-unstyled\">'\n html_code += print_sidebar_submenu_category(sub_category)\n html_code += '</ul></div>'\n end\n end\n html_code += ''\n end",
"def index\n @subproducts = Subproduct.all(:include => [:product_subproducts => :product]).paginate :page => params[:page], :per_page => 20\n end",
"def show\n if nil == params[:id]\n params[:id] = 2\n end\n @locations = Location.find(:all, :order => 'name')\n #@location = Location.find(params[:id], :include => [:categories, {:subcategories=> [:subname, :category]}])\n @location = Location.find(params[:id], :include => [:categories])\n @categories = @location.categories\n @subcategories = @location.subcategories\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def getChildCategories\n Category.find(:all, :conditions => \"parent_category_id = #{self.id}\", :order => ':id')\nend",
"def top_level_categories\r\n Category.where(parent_id: 0).order(:name).limit(8)\r\n end",
"def index\n @stream_categories = searchitems(params[:search],StreamCategory,'name')\n end",
"def get_related_categories(query='', results=10, start=0)\r\n get_related('Categories',query, results, start)\r\n end",
"def set_suba_category\n @suba_category = SubaCategory.find(params[:id])\n end",
"def set_subcategoriaproduto\n @subcategoriaproduto = Subcategoriaproduto.find(params[:id])\n end",
"def show\n @home_categories_sub = Home::Categories::Sub.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_categories_sub }\n end\n end",
"def index\n if params[\"term\"] \n cate = RoomCategory.find_by(category_name: params[\"category\"])\n @rooms = Room.where(room_category_id: cate.id).where(\"title LIKE ?\", \"%#{params[\"term\"]}%\")\n else\n @rooms = Room.includes(:room_category, :user).all\n end\n \n @categories = RoomCategory.all\n end",
"def index\n @category = Category.find(params[:category_id])\n # byebug\n if params[:search]\n #MAKE SEARCH WITH SQL COMMAND ## W H E R E ##\n @articles = Article.all.select{|art| art.title.downcase.include?(params[:search].downcase)}\n if @articles == []\n @s = true\n else\n @articles == []\n end\n else\n @articles = Article.all.select{|art| art.category_id.to_i == @category.id}\n if @articles == []\n @t = true\n else\n\n end\n end\n\n end",
"def show\n # Find the category belonging to the given id\n @clase_unit = ClaseUnit.find(params[:id])\n # Grab all sub-categories\n @clase_units = @clase_unit.subcategorias\n # We want to reuse the index renderer:\n render :action => :index\n end",
"def save_hot_products_by_category\r\n Subcategory.fill_all_subcategories_of_category(params[:category][:fields][1])\r\n end",
"def getCategories(_, _, _)\n @db.categories\n end",
"def results\n if cookies[:fit_my_4x4].present?\n @vehicle_filter = JSON.parse(cookies[:fit_my_4x4]).with_indifferent_access\n\n if params[:id].present?\n @this_category = Category.friendly.find(params[:id])\n\n @products = @this_category.leaves.map { |c| c.products.active.includes(:vehicles).references(:vehicles).where('refinery_ironman_vehicles.id in (?)', @vehicle_filter.values) }.flatten.paginate(:page => params[:page], :per_page => 12)\n\n if @this_category.depth == 0\n @category = @this_category\n elsif @this_category.depth == 1\n @category = @this_category.parent\n @subcategory = @this_category\n elsif @this_category.depth == 2\n @category = @this_category.parent.parent\n @subcategory = @this_category.parent\n @sub_subcategory = @this_category\n end\n\n else\n @products = Refinery::Ironman::Product.active.includes(:vehicles).references(:vehicles).where('refinery_ironman_vehicles.id in (?)', @vehicle_filter.values).order('refinery_ironman_products.name').paginate(:page => params[:page], :per_page => 12)\n end\n end\n\n present(@page)\n end",
"def with_globalize(conditions = {})\n Products::Categories::Finder.with_globalize(conditions)\n end",
"def assignSubcategory\n #@work=Work.find(params[:id])\n @subcategories=session[:work_subcategories]\n logger.info(\"SUBCATEGORY_COUNT \"+@subcategories.length.to_s)\n \n if params[:subcategory_id]!=\"0\"\n \n mySubcategory=WorkSubcategory.find(params[:subcategory_id]) \n \n if (mySubcategory.additional)\n #check we aren't adding a dupe\n @subcategories.push(mySubcategory) if !@subcategories.include?(mySubcategory) \n render :partial => 'additional_subcategories' \n else\n @main_category = mySubcategory\n \n #This adds a hidden field into the form to set the main category, so taht update attributes is happy\n render :partial => 'subcategories' \n end \n \n else\n \n if params[:additional]\n render :partial =>'additional_subcategories'\n else\n render :partial =>'subcategories'\n end\n \n \n end\n \n end",
"def index\n page_info = get_paging_order_info\n @search = Category.search(params[:q])\n @categories = @search.result(:distinct => true).paginate(page: page_info[:page], per_page: page_info[:limit])\n end",
"def getCat \n\t\tputs ''\n\t\tputs 'Fetching categories . . '\n\t\t@page.css('ul.dropdown li a').each do |cat|\n\t\t\tarr=[]\n\t\t\tarr.push cat.text\n\t\t\tarr.push cat['href']\n\t\t\t@arr_cat.push arr\n\t\t\tprint '. '\n\t\tend\n\t\ti=0\n\t\t@arr_cat.each do |pair|\n\t\t\t@db.execute 'insert into category values (?, ? ,?)', i, pair[0], pair[1]\n \t\t\ti +=1\n \t\tend\n\tend",
"def index \n # raise params.inspect \n admin_search_options\n @experts = Expert.search(params[:search])\n @categories = Category.all\n # @categories = Category.all.order(params[:search])\n # @exp = Expert.where(:category_id)\n # @q = Expert.search(params[:q])\n # @gra = @q.result(:distinct => true)\n # @cat = Category.search(params[:search])\n end"
] | [
"0.7385731",
"0.7033718",
"0.69372934",
"0.6935654",
"0.6793213",
"0.67677534",
"0.66941816",
"0.6618365",
"0.6618365",
"0.66144574",
"0.6581398",
"0.65587914",
"0.65270436",
"0.6523657",
"0.6515557",
"0.6510016",
"0.6492263",
"0.6490421",
"0.6481871",
"0.6479391",
"0.6459524",
"0.64252114",
"0.6424103",
"0.6422512",
"0.63865435",
"0.63633484",
"0.63545805",
"0.63435614",
"0.63256836",
"0.6288924",
"0.6284522",
"0.627279",
"0.62664664",
"0.6241828",
"0.62322843",
"0.62177926",
"0.6201556",
"0.61629444",
"0.61545795",
"0.61308587",
"0.61212283",
"0.611147",
"0.60883474",
"0.6078698",
"0.60425436",
"0.6029762",
"0.60142916",
"0.5998878",
"0.5991298",
"0.59902614",
"0.5985563",
"0.5985327",
"0.5983774",
"0.59825003",
"0.59774077",
"0.5975005",
"0.597325",
"0.597325",
"0.59427106",
"0.5941484",
"0.59352756",
"0.58911574",
"0.5886465",
"0.58719283",
"0.5871054",
"0.5858691",
"0.5847586",
"0.5847364",
"0.5846169",
"0.5846169",
"0.5842248",
"0.5814639",
"0.580324",
"0.5801808",
"0.5796507",
"0.5794356",
"0.5790401",
"0.57869345",
"0.57835287",
"0.57547975",
"0.5742784",
"0.57393175",
"0.57347",
"0.5726682",
"0.572237",
"0.57172865",
"0.5699924",
"0.568203",
"0.56765723",
"0.5676425",
"0.5672598",
"0.56651497",
"0.5662103",
"0.5657502",
"0.5654302",
"0.56532854",
"0.5652523",
"0.56494725",
"0.56445384",
"0.5640236"
] | 0.65954953 | 10 |
array to store the possible options for the interactive menu | def interactive_menu
loop do
#print the menu and ask the user what to do
print_menu
#read the input and save it into a variable
selection = STDIN.gets.chomp
#do what the user has asked
process(selection)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_menu\n input_options_array = [\"1\",\"2\",\"3\",\"4\",\"5\"]\nend",
"def menu_options\n @menu_options ||= {}\n end",
"def options\n self.items\n itemsArr = @items.keys\n @options = []\n for i in 1..(items.length) do\n @options = @options + itemsArr.combination(i).to_a\n end\n @options\n end",
"def menu_options(menu_array)\r\n\t\tcounter = 1\r\n\t\tmenu_array.each do |menu_item|\r\n\t\t\tputs \"#{counter}) #{menu_item}\"\r\n\t\t\tcounter += 1\r\n\t\tend\r\n\t\tputs \"Please select an option from above.\"\r\n\t\tchoice = gets.chomp.to_i\r\n\t\tmenu_array[choice-1]\r\n\tend",
"def selection_menu\n h = {\n a: :select_all,\n u: :unselect_all,\n s: :toggle_select,\n '*' => 'toggle_multiple_selection',\n 'x' => 'toggle_visual_mode',\n 'm' => 'toggle_selection_mode',\n v: :view_selected_files\n }\n menu 'Selection Menu', h\nend",
"def make_option_list\n end",
"def make_option_list\n end",
"def available_options \n o = \n [{ name: \"New Task\", value: \"n\" }]\n\n # To avoid trying to iterate over nill arrays, only give option that requires selection of a task if\n # the user has tasks, using has_entries? method.\n if @tm.has_entries? \n o += [\n { name: \"Show Task\", value: \"s\" },\n { name: \"Edit Task\", value: \"e\" },\n { name: \"Delete Task\", value: \"d\" },\n { name: \"Print Calendar\", value: \"c\" },\n { name: \"Calendar Options\", value: \"o\" }\n ]\n end\n \n o += [ \n { name: \"Sign Out\", value: \"q\" },\n { name: \"Exit\", value: \"exit\" }\n ] \n \n return o\n end",
"def option_keys\n []\n end",
"def selected_options; end",
"def selected_options; end",
"def display_menu choices\n\t\tmenu_array = [\"\\nHangman Options\", \"===============\"] + choices\n\t\tmenu_array.each { |menu| puts menu }\t\t\n\tend",
"def menu_options #:nodoc:\n @menu_options ||= {}\n end",
"def menu_arrows\n PROMPT.select('choose from the following'.colorize(color: :blue)) do |menu|\n menu.choice({ name: 'receive a recommendation', value: '1' })\n menu.choice({ name: 'view all games', value: '2' })\n menu.choice({ name: 'add a game', value: '3' })\n menu.choice({ name: 'delete games', value: '4' })\n menu.choice({ name: 'time wasted on video games', value: '5' })\n menu.choice({ name: 'exit application', value: '6' })\n end\n end",
"def show_possible_actions(options={})\n\t\t@operator.choose do |menu|\n\t\t\toptions.each do |key, value|\n\t\t\t\tmenu.choice(key) { send(*value) if value }\n\t\t\tend\n\t\tend\n\tend",
"def assign_all_options_array\n @start_rest_options_array ||= 0.step(3600,5).collect{ |x| [(x > 0 ? sprintf(\"%2s\\'%02.0f\\\"\",x/60, x%60) : '-'), x] }\n @pause_options_array ||= 0.step(1800,5).collect{ |x| [(x > 0 ? sprintf(\"%2s\\'%02.0f\\\"\",x/60, x%60) : '-'), x] }\n #@exercise_options_array ||= [[nil,nil]] + Exercise.to_dropdown()\n @exercise_options_array ||= [[nil,nil]] + Exercise.to_dropdown( nil, :id, :get_friendly_description )\n @step_type_options_array ||= TrainingStepType.to_unsorted_dropdown( nil, :id, :i18n_short )\n @arm_aux_options_array ||= ArmAuxType.to_dropdown( nil, :id, :i18n_description )\n @kick_aux_options_array ||= KickAuxType.to_dropdown( nil, :id, :i18n_description )\n @body_aux_options_array ||= BodyAuxType.to_dropdown( nil, :id, :i18n_description )\n @breath_aux_options_array ||= BreathAuxType.to_dropdown( nil, :id, :i18n_description )\n end",
"def print_menu_options\n\t\tputs \"----------------------------------------------\"\n\t\tputs \"1) Rename List | 2) Add task \"\n\t\tputs \"3) Complete task | 4) Uncomplete task\"\n\t\tputs \"5) Prioritize task | 6) Normalize task \"\n \t\tputs \"7) Add due date | 8) Remove due date\"\n\t\tputs \"9) Delete task | 0) Exit\"\n\t\tputs \"----------------------------------------------\"\n\t\tputs \"Enter choice: \"\n\t\tchoice = get_choice.to_i\n\t\toptions choice\n\tend",
"def menu_extras\n self[:menu_extras] || []\n end",
"def text_message_options\n # Get menu options\n menu_options = self.menu_options.where(:type => \"MenuOption\").all.order_by([:name, :desc])\n options = {}\n options[\"#0\"] = [\"menu\",\"\"]\n \n menu_options.each_with_index do |option, index|\n i = index+1\n options[\"#\" + i.to_s] = [option.option_name, option.option_format]\n end\n \n options\n end",
"def options(choice)\n\t\tif choice == 1\n\t\t\trename_submenu\n\t\telsif choice == 2\n\t\t\tadd_task_submenu\n\t\telsif choice == 3\n\t\t\tcomplete_submenu\n\t\telsif choice == 4\n\t\t\tuncomplete_submenu\n\t\telsif choice == 5\n\t\t\tprioritize_submenu\n\t\telsif choice == 6\n\t\t\tnormalize_submenu\n\t\telsif choice == 7\n\t\t\tdue_date_submenu\n\t\telsif choice == 8\n\t\t\tremove_date_submenu\n\t\telsif choice == 9\n\t\t\tdelete_task_submenu\n\t\telse\n\t\t\tputs \"Enjoy your day\"\n\t\tend\n\tend",
"def options\n case object.question_type\n when 'dropdown'\n object.dropdown_options\n when 'range'\n object.range_options\n else\n []\n end\n end",
"def build_selected_options options=nil\n options ||= vote_proposal_options\n options.map(&:name).sort.join(\"|\") \n end",
"def show_possible_values(options={})\n\t\t@operator.choose do |menu|\n\t\t\toptions.each do |key, value|\n\t\t\t\tmenu.choice(key) { value }\n\t\t\tend\n\t\tend\n\tend",
"def interface\r\n clear\r\n menu_banner\r\n puts\r\n options = [\r\n { name: 'New Game', value: -> { get_user_selection } },\r\n { name: 'Custom quiz collections', value: -> { custom_collection } },\r\n { name: 'History', value: -> { history_select } },\r\n { name: 'Exit', value: lambda {\r\n clear\r\n exit_banner\r\n exit\r\n } }\r\n ]\r\n option = @prompt.select(\"Please select from the following options.\\n\\n\", options,\r\n help: \"(Select with pressing ↑/↓ arrow keys, and then pressing Enter)\\n\\n\", show_help: :always)\r\n end",
"def play_options(prompt)\r\n choices = [\r\n {name: \"Hit\", value: 1},\r\n {name: \"Stand\", value: 2},\r\n {name: \"Exit\", value: 3}\r\n ]\r\n chosen_option = prompt.select(\"What would you like to do?\", choices, help_color: :yellow, help: \"(Use Keyboard Arrow Keys)\", show_help: :start, filter: true)\r\nend",
"def play_options(prompt)\n choices = [\n {name: \"Hit\", value: 1},\n {name: \"Stand\", value: 2},\n {name: \"Exit\", value: 3}\n ]\n chosen_option = prompt.select(\"What would you like to do?\", choices, help_color: :yellow, help: \"(Use Keybvoard keys)\", show_help: :start, filter: true)\nend",
"def build_menu(application_name, method_names)\n #take array of method names and turn into menu\n puts \"#{application_name.humanize}\"\n method_names.each_with_index {|method_name, index| puts \"#{index + 1}: #{method_name.to_s.humanize}\"}\n puts \"\\nPlease enter your selection:\"\nend",
"def items\n @items ||= menu_items.map{|i| Nyavi::Item.new(i, self)}.select(&:allowed?)\n end",
"def menu(options)\n return nil if options.empty?\n \n return_hash = options[0].kind_of?(Hash)\n\n _options = Hash.new\n _options[\"items\"] = (\n if return_hash\n options.collect { |e| e['separator'] ? '-' : e['title'] }\n else\n options.collect { |e| e == nil ? '-' : e }\n end )\n _options[\"no-newfile\"] = \"\"\n\n res = cocoa_dialog(\"menu\", _options)\n\n return nil unless res\n index = res.to_i - 1\n\n return return_hash ? options[index] : index\n end",
"def customizeMenu\n menu[:proteins] = [\"Tofurkey\", \"Hummus\"]\n menu[:veggies] = [:ginger_carrots , :potatoes, :yams]\n menu[:desserts] = { :pies => [:pumkin_pie],\n :other => [\"Chocolate Moose\"],\n :molds => [:cranberry, :mango, :cherry] }\n end",
"def choice_y_menu\n play_decision_se\n show_shadow_frame\n @base_ui.show_win_text(text_get(22, 79))\n choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999)\n choices.register_choice(text_get(22, 81), on_validate: method(:sort_name))\n .register_choice(text_get(22, 84), on_validate: method(:sort_number))\n .register_choice(ext_text(9000, 151), on_validate: method(:sort_favorites))\n .register_choice(text_get(33, 130), on_validate: method(:search_item))\n .register_choice(text_get(22, 7))\n # Process the actual choice\n y = 200 - 16 * choices.size\n choice = choices.display_choice(@viewport, 306, y, nil, on_update: method(:update_graphics), align_right: true)\n @base_ui.hide_win_text if choice != SEARCH_CHOICE_INDEX\n hide_shadow_frame\n end",
"def menu\n ([[0, 'Choisir l’icarien…']] + User.values_select(type_icarien => true)).in_my_select(id: 'opuser_user_id', name: 'opuser[user_id]', selected: param_opuser[:user_id])\n end",
"def choices\n @@choices\n end",
"def display_options_menu\n prompt = TTY::Prompt.new\n display_options_menu = prompt.select('Please select an option:') do |menu| \n menu.choice 'Add Code'\n menu.choice 'Edit Code'\n menu.choice 'Remove Code'\n menu.choice 'Search'\n menu.choice 'Help'\n menu.choice 'Exit'\n end\nend",
"def menu_items\n menu.items(self)\n end",
"def menu_items\n menu.items(self)\n end",
"def options_for_action_select\n source_array = []\n self.questions.each do |q|\n if q.class == MatrixQuestion\n q.choice_questions.each {|cq| source_array << [\"#{q.question_content.statement}: #{cq.question_content.statement} response\", \"#{cq.question_content.id}\"]}\n else\n source_array << [\"#{q.question_content.statement} response\", \"#{q.question_content.id}\"]\n end\n end\n source_array\n end",
"def options(opt)\n []\n end",
"def get_options; end",
"def option_names\n standard_option_names\nend",
"def menuAOption\n\t\tmenu = @menuStack.pop\n\t\t@menuStack.push(menu)\n\t\toption = menu.getOption\n\t\tcase option\n\t\twhen \"Magic\"\n\t\t\t@hero.nextCommand.push(option)\n\t\t\t@selectMagicBox = OptionBox.new(15, 5, 34, 7, 18, 15, 128, 26, createNextMagicSublist, @screen)\n\t\t\t@menuStack.push(@selectMagicBox)\n\t\twhen \"Attack\"\n\t\t\t@hero.nextCommand.push(option) \n\t\t\tif @enemyUnits.length > 1\n\t\t\t\t@selectEnemyBox = OptionBox.new(242, 5, 15, 7, 18, 15, 128, 26, createEnemyList, @screen)\n\t\t\t\t@menuStack.push(@selectEnemyBox)\n\t\t\telse\n\t\t\t\tsetCombat\n\t\t\t\t@hero.nextCommand.push([@enemyUnits[0]])\n\t\t\tend\n\t\twhen \"Run\"\n\t\t\t@hero.nextCommand.push(option)\n\t\t\tsetCombat\n\t\twhen \"Item\"\n\t\t\t@hero.nextCommand.push(option)\n\t\t\t@subMenuIndex = 0\n\t\t\t@selectItemBox = OptionBox.new(15, 5, 34, 7, 18, 15, 128, 26, createNextItemSublist, @screen)\n\t\t\t@menuStack.push(@selectItemBox)\n\t\telse\n\t\t\tif (option != \"\")\n\t\t\t\tif (option.class < Unit)\n\t\t\t\t\t@hero.nextCommand.push([option])\n\t\t\t\t\tsetCombat\n\t\t\t\telse\n\t\t\t\t\ttargetType = option.getTargetType\n\t\t\t\t\tcase targetType\n\t\t\t\t\twhen \"self\"\n\t\t\t\t\t\t@hero.nextCommand.push(option)\n\t\t\t\t\t\t@hero.nextCommand.push([@hero])\n\t\t\t\t\t\tsetCombat\n\t\t\t\t\twhen \"all\"\n\t\t\t\t\t\t@hero.nextCommand.push(option)\n\t\t\t\t\t\ttargets = []\n\t\t\t\t\t\t@enemyUnits.each { |unit| targets.push(unit) }\n\t\t\t\t\t\t@hero.nextCommand.push(targets)\n\t\t\t\t\t\tsetCombat\n\t\t\t\t\twhen \"enemy\"\n\t\t\t\t\t\t@hero.nextCommand.push(option)\n\t\t\t\t\t\tif @enemyUnits.length > 1\n\t\t\t\t\t\t\t@selectEnemyBox = OptionBox.new(242, 5, 15, 7, 18, 15, 128, 26, createEnemyList, @screen)\n\t\t\t\t\t\t\t@menuStack.push(@selectEnemyBox)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsetCombat\n\t\t\t\t\t\t\t@hero.nextCommand.push([@enemyUnits[0]])\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def initialize_options\n return if $game_system.options_initialized\n $game_system.options_initialized = true\n for option in H87Options.option_list\n next unless option.for_game?\n option.value = option.default if option.default != nil\n option.toggle if option.type == :bar\n end\n end",
"def manage_menu_options(options)\n class_menu = (options['menu']||[]).join(' ')\n\n tmp_style_menu = []\n style = (options['menu[option]']||{})\n case style[\"menugradient\"].presence\n when \"linear_top\"\n tmp_style_menu << \"background: linear-gradient( to top, #{style[\"menugradientcolorfrom\"].presence||\"#000\"}, #{style[\"menugradientcolorto\"].presence||\"#FFF\"})\"\n when \"linear_right\"\n tmp_style_menu << \"background: linear-gradient( to right, #{style[\"menugradientcolorfrom\"].presence||\"#000\"}, #{style[\"menugradientcolorto\"].presence||\"#FFF\"})\"\n when \"linear_top_right\"\n tmp_style_menu << \"background: linear-gradient( to top right, #{style[\"menugradientcolorfrom\"].presence||\"#000\"}, #{style[\"menugradientcolorto\"].presence||\"#FFF\"})\"\n when \"radial_ellipse\"\n tmp_style_menu << \"background: radial-gradient( ellipse at top left, #{style[\"menugradientcolorfrom\"].presence||\"#000\"}, #{style[\"menugradientcolorto\"].presence||\"#FFF\"})\"\n when \"radial_closest\"\n tmp_style_menu << \"background: radial-gradient( closest-corner at center, #{style[\"menugradientcolorfrom\"].presence||\"#000\"}, #{style[\"menugradientcolorto\"].presence||\"#FFF\"})\"\n when \"opacity\"\n tmp_style_menu << \"background-color: #{color_hex_to_rgba(style[\"menugradientcolorfrom\"].presence||\"#000\",0.85)}\" \n when \"color\"\n tmp_style_menu << \"background-color: #{style[\"menugradientcolorfrom\"].presence||\"#000\"}\"\n end\n \n tmp_style_menu << \"border-width: #{style[\"menubordersize\"].presence}px\" if style[\"menubordersize\"].present? \n tmp_style_menu << \"border-color: #{style[\"menubordercolor\"].presence}\" if style[\"menubordercolor\"].present? \n \n style_menu = tmp_style_menu.join(';')\n \n return class_menu, style_menu\n end",
"def options() end",
"def print_menu(options)\n i = 0\n options.each do |attribute|\n puts \"[#{i}] #{attribute}\"\n i += 1\n end\n end",
"def options # :nodoc:\n [].tap do |o|\n o << \"Lazy\" if lazy?\n o << \"Reverse\" if reverse?\n o << \"Exclude [#{all_excluded_words.join(\", \")}]\" if excluded_words.any?\n o << \"No Options\" if o.empty?\n end\n end",
"def main_menu\n h = {\n a: :ag,\n z: :z_interface,\n # f: :file_actions,\n b: :bookmark_menu,\n c: :create_menu,\n f: :filter_menu,\n o: :order_menu,\n s: :selection_menu,\n t: :toggle_menu,\n v: :view_menu,\n '`' => :goto_parent_dir,\n x: :extras\n }\n menu 'Main Menu', h\nend",
"def menu_options()\n print_message 'Select operation to perform'\n print_message '1. Add'\n print_message '2. Substract'\n print_message '3. Multiply'\n print_message '4. Divide'\n print_message \"Or press 'q' to exit calculator app\"\n end",
"def interactives\n self.interactive_items.collect{|ii| ii.interactive}\n end",
"def menu(options = {})\n config.menu_item_options = options\n end",
"def make_option_list\n @data = H87Options.option_list\n end",
"def make_option_list\n @data = H87Options.option_list\n end",
"def menu\n puts \"- Type in a #{\"Nintendo Character\".colorize(:red)} | #{\"Game Series\".colorize(:blue)} | #{\"Amiibo Series\".colorize(:green)}\\n\\n\"\n puts \"- Type #{'1'.colorize(:yellow)} for a list of all the Game Series included in the Amiibo collection\"\n puts \"- Type #{'2'.colorize(:yellow)} for a list of all the Amiibo Series included in the Amiibo collection\"\n puts \"- Type #{'3'.colorize(:yellow)} for a list of all the Characters included in Amiibo collection\"\n puts \"- Type #{'4'.colorize(:yellow)} for a list of ALL Amiibos collection\\n\\n\"\n puts \"- Type #{'exit'.colorize(:yellow)} to exit the CLI\\n\\n\"\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n sleep(2)\n end",
"def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend",
"def hike_options\n system 'clear'\n puts \"-----MY HIKES-----\"\n menu = [\"Start New Hike\",\n \"End Hike\",\n \"Edit Hike\",\n \"List All My Hikes\",\n \"Exit\"]\n\n choice = @prompt.select(\"Which option would you like to take?\", menu)\n\n case choice\n when \"Start New Hike\"\n start_hike\n when \"End Hike\"\n end_hike\n when \"Edit Hike\"\n edit_options\n when \"List All My Hikes\"\n list_user_hikes\n end\n\n end",
"def choices\n to_display.options[:choices].map { |c| c.nil? ? nil : items[c] }\n end",
"def add_back_to_menu_and_select_choice(array)\n back_to_menu = \"Back to menu\"\n array << back_to_menu \n @selected_choice = @prompt.select(\"Your To-Dos\", array)\n # binding.pry\n # 0\nend",
"def menu_items\n\n menu.items(self)\n\n end",
"def define_menu_items\n check_attributes\n @menu_description.concat(\"\\n #{set_boundaries}\")\n add_menu_item(\"All tasks to a person in the given #{time_string}.\", 1)\n add_menu_item(\"Worktime of a person in that #{time_string}.\", 2)\n add_menu_item(\"All tasks running during the interval.\", 3)\n add_menu_item(\"Write Query result to csv-file.\", 4)\n add_menu_item(\"Cancel and return to previous menu.\", 5)\n end",
"def available_choices_for(component); @available_choices[component] + [:none]; end",
"def make_option_list\n @data = @option.values\n if @data.is_a?(Hash)\n @keys = @data.keys\n @data = @data.values\n end\n end",
"def make_option_list\n @data = @option.values\n if @data.is_a?(Hash)\n @keys = @data.keys\n @data = @data.values\n end\n end",
"def character_menu\n puts \" \"\n puts \" ┌─┐┬ ┬┌─┐┬─┐┌─┐┌─┐┌┬┐┌─┐┬─┐ ┬┌┐┌┌─┐┌─┐\"\n puts \" │ ├─┤├─┤├┬┘├─┤│ │ ├┤ ├┬┘ ││││├┤ │ │\"\n puts \" └─┘┴ ┴┴ ┴┴└─┴ ┴└─┘ ┴ └─┘┴└─ ┴┘└┘└ └─┘\"\n puts \" \"\n puts \" Please select an option from below:\"\n puts \" \"\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Find info of character\",\n \" [2] Find allegience of character\",\n \" [3] Search characters by culture\",\n \" [4] Wiki Menu\",\n \" [5] Main Menu\",\n ]\n prompt.select(\" \", menu_choices)\nend",
"def menu_options\n raise Puerto::AbstractMethodError\n end",
"def make_your_own\r\n # Arrays of options\r\n menu_1 = [\"Basic Elements\", \"Date/Time Element\", \"Emoji\", \"Other Characters\",\"Edit Prompt Design\", \"I am done!\"]\r\n basic_element = [\"Username\", \"Hostname\", \"Shell\", \"Shell Version\", \"Path to Current Directory\", \"Current Directory\", \"Exit\"]\r\n time_element = [\"Date\", \"24hr Time\", \"12hr Time\", \"Exit\"]\r\n emoji_top = [\"🐰 \",\"🤖 \",\"🔥 \",\"❤️ \",\"🤷 \",\"🎯 \",\"💭 \",\"💯 \",\"🈲 \",\"☠️ \"]\r\n emoji_animal = [\"🙈 \",\"🙉 \",\"🙊 \",\"🦊 \",\"🐶 \",\"🦄 \",\"🐷 \",\"🐼 \",\"🐾 \",\"🐔 \",\"🐉 \",\"🕊️ \"]\r\n emoji_smileys = [\"😁 \",\"🤣 \",\"😎 \",\"😊 \",\"😍 \",\"🤗 \",\"🤩 \",\"🤔 \",\"😝 \",\"🤑 \",\"😤 \",\"😱 \"]\r\n emoji_food = [\"🍋 \",\"🍌 \",\"🥑 \",\"🥦 \",\"🥨 \",\"🍕 \",\"🍱 \",\"🍣 \",\"🎂 \",\"🍦 \",\"🍺 \"]\r\n emoji_travel = [\"⛩️ \",\"🗼 \",\"🗽 \",\"🗿 \",\"🗻 \",\"🎑 \"]\r\n emoji_symbol = [\"☠️ \",\"💘 \",\"💢 \",\"💭 \",\"🀄 \",\"⛔ \",\"♻️ \",\"💯 \",\"🎯 \",\"🈲 \",\"🤷 \",\"🔥 \"]\r\n emoji_menu = [\"Trending [Preview: #{emoji_top.join(\" \")}]\", \"Animals [Preview: #{emoji_animal.join(\" \")}]\", \"Smileys [Preview: #{emoji_smileys.join(\" \")}]\", \"Food [Preview: #{emoji_food.join(\" \")}]\", \"Travel [Preview: #{emoji_travel.join(\" \")}]\", \"Symbol [Preview: #{emoji_symbol.join(\" \")}]\"]\r\n emojis = [emoji_top,emoji_animal,emoji_smileys,emoji_food,emoji_travel,emoji_symbol]\r\n color = [\"Default (White)\", \"Red\", \"Green\", \"Yellow\", \"Blue\", \"Magenta\", \"Cyan\"]\r\n output = []\r\n terminal_code = []\r\n color_menu = \"\"\" (1) Default (White)\r\n (2) #{\"Red\".colorize(:red)}\r\n (3) #{\"Green\".colorize(:green)}\r\n (4) #{\"Yellow\".colorize(:yellow)}\r\n (5) #{\"Blue\".colorize(:blue)}\r\n (6) #{\"Magenta\".colorize(:magenta)}\r\n (7) #{\"Cyan\".colorize(:cyan)}\r\n \"\"\"\r\n divider = \"-\" * 100\r\n remove_elements = ['\\u ','\\h ','\\s ','\\v ','\\w ','\\W ','\\d ','\\A ','\\@ ']\r\n\r\n # Hash for each option\r\n # Hashes for basic_element_2 array\r\n username = {\r\n number: 1,\r\n name: \"Username\",\r\n code: '\\u ',\r\n output: \"user\"\r\n }\r\n\r\n hostname = {\r\n number: 2,\r\n name: \"Hostname\",\r\n code: '\\h ',\r\n output: \"host\"\r\n }\r\n\r\n shell = {\r\n number: 3,\r\n name: \"Shell\",\r\n code: '\\s ',\r\n output: \"bash\"\r\n }\r\n\r\n shell_version = {\r\n number: 4,\r\n name: \"Shell Version\",\r\n code: '\\v ',\r\n output: \"4.2.1\"\r\n }\r\n\r\n path_to_current_dir = {\r\n number: 5,\r\n name: \"Path to Current Directory\",\r\n code: '\\w ',\r\n output: \"~/dir\"\r\n }\r\n\r\n current_dir = {\r\n number: 6,\r\n name: \"Current Directory\",\r\n code: '\\W ',\r\n output: \"dir\"\r\n }\r\n\r\n # Hashes for date_2 array\r\n date = {\r\n number: 1,\r\n name: \"Date\",\r\n code: '\\d ',\r\n output: \"Wed Feb 28\"\r\n }\r\n\r\n time_24hr = {\r\n number: 2,\r\n name: \"24hr Time\",\r\n code: '\\A ',\r\n output: \"16:35\"\r\n }\r\n\r\n time_12hr = {\r\n number: 3,\r\n name: \"12hr Time\",\r\n code: '\\@ ',\r\n output: \"04:35 PM\"\r\n }\r\n\r\n # Hashes for color_2 array\r\n default = {\r\n number: 1,\r\n name: \"Default (White)\",\r\n code: \"\"\r\n }\r\n\r\n red = {\r\n number: 2,\r\n name: \"Red\".colorize(:red),\r\n code: '\\e[31m '\r\n }\r\n\r\n green = {\r\n number: 3,\r\n name: \"Green\".colorize(:green),\r\n code: '\\e[32m '\r\n }\r\n\r\n yellow = {\r\n number: 4,\r\n name: \"Yellow\".colorize(:yellow),\r\n code: '\\e[33m '\r\n }\r\n\r\n blue = {\r\n number: 5,\r\n name: \"Blue\".colorize(:blue),\r\n code: '\\e[34m '\r\n }\r\n\r\n magenta = {\r\n number: 6,\r\n name: \"Magenta\".colorize(:magenta),\r\n code: '\\e[35m '\r\n }\r\n\r\n cyan = {\r\n number: 7,\r\n name: \"Cyan\".colorize(:cyan),\r\n code: '\\e[36m '\r\n }\r\n\r\n # Array for option hashes\r\n basic_element_2 = [username, hostname, shell, shell_version, path_to_current_dir, current_dir]\r\n date_2 = [date, time_24hr, time_12hr]\r\n color_2 = [default, red, green, yellow, blue, magenta, cyan]\r\n\r\n # Start of main codes\r\n selection_1 = 0\r\n system (\"clear\")\r\n until selection_1 == 6 do\r\n puts \"Your new C-Promptz™ is going to look like this...\"\r\n\r\n table = Terminal::Table.new do |t|\r\n t.add_row []\r\n t.add_row [\"#{output.join}\"]\r\n t.add_row []\r\n t.style = {:width => 100, :padding_left => 4}\r\n end\r\n puts table\r\n #puts \"\"\"Terminal C-Promptz™ code:\r\n #{\"----------------------------------------------------------\".colorize(:red)}\r\n #{terminal_code.join}\r\n #{\"----------------------------------------------------------\".colorize(:red)}\r\n #\"\"\"\r\n puts \" \"\r\n puts \"What do you want to add to your C-Promptz™ ? Pick a number!\"\r\n menu_1.each_with_index do |s, index|\r\n print \" \"\r\n print \"(#{index+1}) #{s}\"\r\n puts \" \"\r\n end\r\n print \"Your selection: \"\r\n selection_1 = gets.chomp.to_i\r\n puts divider\r\n \r\n if selection_1 == 1 # Insert basic element\r\n puts \"Please select the element you wants to add to your C-Promptz™.\"\r\n basic_element.each_with_index do |b, index|\r\n print \" \"\r\n print \"(#{index+1}) #{b}\"\r\n puts \" \"\r\n end\r\n print \"Your selection: \"\r\n selection_2 = gets.chomp.to_i\r\n basic_element_2.each do |key|\r\n if selection_2 == key[:number]\r\n output.push(key[:output])\r\n terminal_code.push(key[:code])\r\n end\r\n end\r\n puts divider\r\n if selection_2 == 7\r\n puts \">\" * 20\r\n elsif selection_2 <= basic_element_2.count\r\n puts \"Any colour preference?\"\r\n puts color_menu\r\n print \"Your selection: \"\r\n selection_3 = gets.chomp.to_i\r\n if selection_3 == 1\r\n output[-1] = output[-1].colorize(:White)\r\n elsif selection_3 == 2\r\n output[-1] = output[-1].colorize(:red)\r\n terminal_code.insert(terminal_code.count-1,'\\e[31m')\r\n elsif selection_3 == 3\r\n output[-1] = output[-1].colorize(:green)\r\n terminal_code.insert(terminal_code.count-1,'\\e[32m')\r\n elsif selection_3 == 4\r\n output[-1] = output[-1].colorize(:yellow)\r\n terminal_code.insert(terminal_code.count-1,'\\e[33m')\r\n elsif selection_3 == 5\r\n output[-1] = output[-1].colorize(:blue)\r\n terminal_code.insert(terminal_code.count-1,'\\e[34m')\r\n elsif selection_3 == 6\r\n output[-1] = output[-1].colorize(:magenta)\r\n terminal_code.insert(terminal_code.count-1,'\\e[35m')\r\n elsif selection_3 == 7\r\n output[-1] = output[-1].colorize(:cyan)\r\n terminal_code.insert(terminal_code.count-1,'\\e[36m')\r\n else\r\n puts \"Invalid selection. Please reselect!\"\r\n output.pop\r\n sleep 1\r\n end\r\n else\r\n puts \"Invalid selection. Please reselect!\"\r\n end\r\n system (\"clear\")\r\n\r\n elsif selection_1 == 2 # Insert date/time element\r\n puts \"Please select the element you wants to add to your C-Promptz™.\"\r\n time_element.each_with_index do |t, index|\r\n print \" \"\r\n print \"(#{index+1}) #{t}\"\r\n puts \" \"\r\n end\r\n print \"Your selection: \"\r\n selection_2 = gets.chomp.to_i\r\n date_2.each do |key|\r\n if selection_2 == key[:number]\r\n output.push(key[:output])\r\n terminal_code.push(key[:code])\r\n end\r\n end\r\n if selection_2 == 4 # Exit menu\r\n puts \">\" * 20\r\n elsif selection_2 <= date_2.count \r\n puts \"Any colour preference?\"\r\n puts color_menu\r\n print \"Your selection: \"\r\n selection_3 = gets.chomp.to_i\r\n if selection_3 == 1\r\n output[-1] = output[-1].colorize(:White)\r\n elsif selection_3 == 2\r\n output[-1] = output[-1].colorize(:red)\r\n terminal_code.insert(terminal_code.count-1,'\\e[31m')\r\n elsif selection_3 == 3\r\n output[-1] = output[-1].colorize(:green)\r\n terminal_code.insert(terminal_code.count-1,'\\e[32m')\r\n elsif selection_3 == 4\r\n output[-1] = output[-1].colorize(:yellow)\r\n terminal_code.insert(terminal_code.count-1,'\\e[33m')\r\n elsif selection_3 == 5\r\n output[-1] = output[-1].colorize(:blue)\r\n terminal_code.insert(terminal_code.count-1,'\\e[34m')\r\n elsif selection_3 == 6\r\n output[-1] = output[-1].colorize(:magenta)\r\n terminal_code.insert(terminal_code.count-1,'\\e[35m')\r\n elsif selection_3 == 7\r\n output[-1] = output[-1].colorize(:cyan)\r\n terminal_code.insert(terminal_code.count-1,'\\e[36m')\r\n else\r\n puts \"Invalid selection. Please reselect!\"\r\n output.pop\r\n sleep 1\r\n end\r\n else\r\n puts \"Invalid selection. Please reselect!\"\r\n end\r\n system (\"clear\")\r\n\r\n elsif selection_1 == 3 # Insert emoji\r\n puts 'Please select the element you wants to add to your C-Promptz™. To exit, input \"x\".'\r\n emoji_menu.each_with_index do |e, index|\r\n print \" \"\r\n print \"(#{index+1}) #{e}\"\r\n puts \" \"\r\n end\r\n print \"Your selection: \"\r\n selection_2 = gets.chomp.to_i\r\n puts divider\r\n if selection_2 <= emojis.count && selection_2 > 0\r\n puts \"Which emoji are you after?\"\r\n emojis.each_with_index do |e, index|\r\n if selection_2 == (index + 1)\r\n e.each_with_index do |ee, index_1|\r\n print \" \"\r\n print \"(#{index_1+1}) #{ee}\"\r\n puts \" \"\r\n end\r\n end\r\n end\r\n print \"Your selection: \"\r\n selection_3 = gets.chomp.to_i\r\n output.push(emojis[selection_2-1][selection_3-1])\r\n terminal_code.push(emojis[selection_2-1][selection_3-1])\r\n elsif selection_2 == \"x\"\r\n puts \">\" * 20\r\n else\r\n puts \"Invalid selection. Please reselect!\"\r\n sleep 1\r\n end\r\n system (\"clear\")\r\n\r\n elsif selection_1 == 4 # Insert self-defined characters\r\n puts 'Please input the characters you wants to add to your C-Promptz™. To exit, put \"x\".'\r\n print \"Your input: \"\r\n selection_2 = gets.chomp\r\n if selection_2 != \"x\" # Exit menu if user put in \"x\"\r\n output.push(selection_2)\r\n terminal_code.push(selection_2)\r\n end\r\n system (\"clear\")\r\n \r\n elsif selection_1 == 5 # Function to remove current design - the only way to edit current design is to remove it and add what you want\r\n puts \"Which element do you want to remove?\"\r\n output.each_with_index do |o, index|\r\n puts \"(#{index+1}) #{o}\"\r\n end\r\n puts \"(x) Exit\"\r\n print \"Your selection: \"\r\n selection_2 = gets.chomp.to_i\r\n if selection_2 <= output.count && selection_2 > 0\r\n diff = terminal_code.count-output.count\r\n if remove_elements.count(terminal_code[selection_2-1+diff]) > 0\r\n terminal_code.delete_at(selection_2-1+diff)\r\n terminal_code.delete_at(selection_2-2+diff)\r\n else\r\n terminal_code.delete_at(selection_2-1+diff)\r\n end\r\n output.delete_at(selection_2-1)\r\n elsif selection_2 == \"x\"\r\n puts \">\" * 20\r\n else\r\n puts \"Invalid selection. Please reselect!\"\r\n end\r\n system (\"clear\")\r\n\r\n elsif selection_1 == 6 # Exit \"Build-Your-Own\" function\r\n if terminal_code.count > 0\r\n terminal_code.push('\\[\\e[m\\]') # Syntax text color white in default\r\n `echo 'PS1=\"#{terminal_code.join}\"' >>~/.bash_profile` # Designed terminal codes added into .bash_profile \r\n #system(\"source ~/.bash_profile\")\r\n puts \" \"\r\n 0.upto(2) do\r\n STDOUT.print \"\\rC-Promptz™ is baking...!\"\r\n sleep 0.4\r\n STDOUT.print \"\\r \" # Send return and six spaces\r\n sleep 0.4\r\n end\r\n puts \"\\rPlease refresh your terminal to use your updated C-Promptz™!\"\r\n puts \" \"\r\n sleep 1\r\n system(\"clear\")\r\n table = Terminal::Table.new do |t|\r\n t.add_row [\" \"]\r\n t.add_row [\"🔥 Certificate of Completion 🔥\".bold]\r\n t.add_row [\" \"]\r\n t.add_separator\r\n t.add_row [\" \"]\r\n t.add_row [\" \"]\r\n t.add_row [\"Congaratulations! You have completed a super cool C-Promptz™!\"]\r\n t.add_row [\" \"]\r\n t.add_row [\"C-Promptz™: [#{output.join}]\"]\r\n t.add_row [\" \"]\r\n t.add_row [\"You are now officially coolzz!\"]\r\n t.add_row [\" \"]\r\n t.style = {:width => 130, :alignment => :center}\r\n end\r\n\r\n puts \" \"\r\n puts table\r\n puts \"\"\"To use your brand new C-Promptz™, simply do one of the below:\r\n (1) Copy and paste 'source ~/.bash_profile' in your terminal\r\n (2) Close and re-open your terminal\"\"\" \r\n sleep 2\r\n end\r\n puts \" \"\r\n puts \"Thanks for using C-Promptz™ - your most trusted Prompt Builder!\"\r\n puts \" \"\r\n else\r\n system(\"clear\")\r\n puts \"Invalid selection. Please reselect!\"\r\n puts \" \"\r\n end\r\n end\r\nend",
"def listOptions\n\n if @assessment.has_partners then\n partnersListOptions()\n end\n \n if @assessment.has_svn then\n svnListOptions()\n end\n \n if @assessment.has_scoreboard then\n scoreboardListOptions()\n end\n end",
"def main_menu\n h = { \n \"1\" => :view_article,\n \"2\" => :view_comments,\n :f => :display_forum,\n :v => :view_menu,\n :r => :reload,\n :m => :fetch_more,\n :R => :reddit_options,\n :H => :hacker_options,\n :s => :sort_menu, \n :C => :config_menu,\n :a => :view_article,\n :c => :view_comments,\n :x => :extras\n }\n=begin\n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n=end\n\n menu \"Main Menu\", h\nend",
"def options; [] end",
"def option_selects\n content_profile_entries.map do |cpe|\n [cpe.description, cpe.id, {'data-description': \"#{cpe.content_type}:#{cpe.topic_type}\"} ]\n end\n end",
"def show_options \n \n @consequences.each do | index, value |\n puts \"#{index}. #{value.keys.join}\"\n end\n end",
"def initialize( *menu_args )\n\t\t@menu_args = menu_args \n\t\t@quit = @menu_args.length\t# seeing how many options there are in the array \n\tend",
"def menu_items\n elements = []\n\n if display_parent_work && display_parent_work.rights.present?\n elements << \"<h3 class='dropdown-header'>Rights</h3>\".html_safe\n elements << rights_statement_item\n elements << \"<div class='dropdown-divider'></div>\".html_safe\n end\n\n if has_work_download_options?\n elements << \"<h3 class='dropdown-header'>Download all #{display_parent_work.member_count} images</h3>\".html_safe\n whole_work_download_options.each do |download_option|\n elements << format_download_option(download_option)\n end\n elements << \"<div class='dropdown-divider'></div>\".html_safe\n end\n\n if viewer_template_mode?\n elements << \"<h3 class='dropdown-header'>Download selected image</h3>\".html_safe\n elements << '<div data-slot=\"selected-downloads\"></div>'.html_safe\n elsif asset_download_options\n elements << \"<h3 class='dropdown-header'>Download selected #{thing_name}</h3>\".html_safe\n asset_download_options.each do |download_option|\n elements << format_download_option(download_option)\n end\n end\n\n safe_join(elements)\n end",
"def automation_type_options\n options = [[\"<#{_('No Entry Point')}>\", nil]]\n options + AUTOMATION_TYPES.values.map do |item|\n [item[:label], item[:key]]\n end\n end",
"def trail_options\n menu = [\"View All Trails\", \n \"Search for Trail\", \n \"Exit\"]\n system 'clear'\n puts \"------TRAILS------\"\n choice = @prompt.select(\"Which action would you like to take?\", menu)\n case choice\n when \"View All Trails\"\n print_trail_info(Trail.all)\n when \"Search for Trail\"\n search_for_trail(Trail.all)\n end\n @prompt.keypress(\"Press any key to continue\")\nend",
"def house_menu\n puts \"\n ┬ ┬┌─┐┬ ┬┌─┐┌─┐ ┬┌┐┌┌─┐┌─┐\n ├─┤│ ││ │└─┐├┤ ││││├┤ │ │\n ┴ ┴└─┘└─┘└─┘└─┘ ┴┘└┘└ └─┘\n\n Please select an option from below:\n \"\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Find all characters of a house\",\n \" [2] Find largest houses\",\n \" [3] Find all houses of a region\",\n \" [4] Find info of a house\",\n \" [5] Wiki Menu\",\n \" [6] Main Menu\"\n ]\n prompt.select(\" \", menu_choices)\nend",
"def main_menu\n h = { \n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :s => :sort_menu, \n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n :x => :extras\n }\n menu \"Main Menu\", h\nend",
"def extras\n h = {\n '1' => :one_column,\n '2' => :multi_column,\n c: :columns,\n s: :scripts,\n g: :generators,\n B: :bindkey_ext_command,\n f: :page_flags,\n R: :remove_from_list,\n v: :vidir,\n r: :config_read,\n w: :config_write\n }\n key, menu_text = menu 'Extras Menu', h\n case menu_text\n when :one_column\n @pagesize = @grows\n when :multi_column\n @pagesize = @grows * @gviscols\n when :columns\n print \"How many columns to show: 1-6 [current #{@gviscols}]? \"\n key = get_char\n key = key.to_i\n if key > 0 && key < 7\n @gviscols = key.to_i\n @pagesize = @grows * @gviscols\n end\n end\nend",
"def menu\n [\n {item: \"hotdog\", display: \"Hot Dog\", price: 7.50},\n {item: \"sushi\", display: \"Sushi\", price: 13.00},\n {item: \"greendrink\", display: \"Green Drink\", price: 5.50},\n {item: \"burrito\", display: \"Burrito\", price: 6.00}\n ]\nend",
"def menu_selection \nend",
"def define_menu_items\n add_menu_item(\"Http request\", 1)\n add_menu_item(\"Http status\", 2)\n add_menu_item(\"Sourceadress\", 3)\n add_menu_item(\"Timestamp\", 4)\n end",
"def valid_options\n %i(\n\n ) # end array\n end",
"def items_for_select_menu(options = {}) \n # clean out the various parts\n html_options = options.slice(:prompt, :divider, :show_root, :root_text)\n sql_options = options.except(:prompt, :divider, :show_root, :root_text)\n \n # defaults\n html_options = {\n :prompt => \"Select #{self.name}\",\n :divider => true,\n :show_root => true,\n :root_text => \"Top Level #{self.name}\",\n }.merge(html_options)\n \n sql_options = {\n :order => [self.select_field.to_sym],\n }.merge(sql_options)\n \n mi = self.select_options[:is_tree] ? all({ :parent_id => nil }.merge(sql_options) ) : all(sql_options)\n \n res = []\n if html_options[:prompt]\n res << [nil, html_options[:prompt]] \n res << ['nil', \" ------ \"] if html_options[:divider]\n if self.select_options[:is_tree]\n if html_options[:show_root]\n res << [0, html_options[:root_text]] \n res << ['nil',\" ------ \"] if html_options[:divider]\n end\n end\n end\n \n if self.select_options[:is_tree]\n mi.each do |x|\n res << [x.send(self.value_field), x.send(self.select_field)]\n unless x.children.blank?\n x.children.each do |child|\n res << [child.send(self.value_field), \"-- #{child.send(self.select_field)}\"]\n child.children.each do |grand_child| \n res << [ grand_child.send(self.value_field), \"-- -- #{grand_child.send(self.select_field)}\"] \n end unless child.children.blank?\n end\n end\n end\n else\n mi.each do |x|\n res << [x.send(self.value_field), x.send(self.select_field)]\n end\n end\n res\n end",
"def select_options\n all.map {|e| [e.name, e.to_s] }\n end",
"def select_options\n all.map {|e| [e.name, e.to_s] }\n end",
"def chosen_options\n Option.find_all_by_id session[:chosen_options]\n end",
"def advanced_options\n return nil unless @options[:advanced]\n raise(ArgumentError, ':advanced cannot be empty.') if @options[:advanced].empty?\n\n arr = []\n @options[:advanced].each do |k, v|\n arr.push \"-#{k} #{v}\"\n end\n arr.join(' ') + ' '\n end",
"def valid_options\n []\n end",
"def list_selected_options\n list_selected_options = []\n @selected_options.each do |option|\n list_selected_options << option.type\n end\n return list_selected_options\n end",
"def interactive_menu\n loop do\n print_menu\n selection\n end\nend",
"def select_options\n map {|e| [e.text, e.to_s] }\n end",
"def create_menu\n items = Hash.new\n # action shd be a hash\n # menu should have array of hashes (or just a string)\n #db = { :name => \"Databases\", :accelerator => \"M-d\", :enabled = true, :on_right => :get_databases }\n #or = { :name => \"Open Recent\", :accelerator => \"M-o\", :enabled = true, :on_right => :get_recent }\n #find_array = {\"Find ...\" => :find, \"Find Next\" => :find_next, \"Find Previous\" => :find_prev}\n items[\"File >\"] = [\"Open ... C-o\" , \"Open Recent\", \"Databases\" , \"Tables\", \"Exit\"]\n items[\"Window >\"] = { \"Tile\" => nil, \"Find >\" => {\"Find ...\" => :find, \"Find Next\" => :find_next, \"Find Previous\" => :find_prev},\n \"Edit\" => nil, \"Whatever\" => nil}\n items[\"Others >\"] = { \"Shell Output ...\" => :shell_output, \"Suspend ...\" => :suspend , \"View File\" => :choose_file_and_view}\n\n # in the case of generated names how will call back know that it is a db name or a table name\n # We get back an array containing the entire path of selections\n right_actions = {}\n right_actions[\"Databases\"] = Proc.new { Dir.glob(\"**/*.{sqlite,db}\") }\n right_actions[\"Tables\"] = :get_table_names\n\n ret = popupmenu items, :row => 1, :col => 0, :bgcolor => :cyan, :color => :white, :right_actions => right_actions\n # ret can be nil, or have a symbol to execute, or a String for an item with no leaf/symbol\n if ret\n alert \"Got #{ret}\"\n last = ret.last\n if last.is_a? Symbol\n if respond_to?(last, true)\n send(last)\n end\n end\n end\n\n return\n r = 1\n ix = popuplist( top , :title => \" Menu \" , :row => r, :col => 0, :bgcolor => :cyan, :color => :white)\n if ix\n value = top[ix]\n ix = popuplist( items[value] , :row => r + 2 + ix, :col => 10, :bgcolor => :cyan, :color => :white)\n end\nend",
"def display_guest_options_menu\n prompt = TTY::Prompt.new\n display_options_menu = prompt.select('Please select an option:') do |menu| \n menu.choice 'Search'\n menu.choice 'Favourites'\n menu.choice 'Help'\n menu.choice 'Exit'\n end\nend",
"def getMenu(menu)\n menu.add_item(\"Done\") {self.done}\n menu.add_item(\"Edit Camera...\") {self.edit}\n menu.add_item(\"Reset Tilt\") {self.reset_tilt}\nend",
"def search_stock_options\n blank\n puts \"[1-10] from the company menu options\".colorize( :gray )\n puts \"[a] to run all\"\n puts \"[m] to view menu again\".colorize( :gray )\n puts \"[b] to view company menu again\".colorize( :gray )\n puts \"[x] to exit\".colorize( :gray )\n end",
"def createMenuItems(invocation)\n\n menu = []\n\n # Which part of the interface the user selects\n ctx = invocation.getInvocationContext()\n\n # Sitemap history, Proxy History, Request views, and Scanner will show menu item if selected by the user\n #@stdout.println('Menu TYPE: %s\\n' % ctx)\n if ctx == 5 or ctx == 6 or ctx == 2 or ctx == 7\n\n \t faradayMenu = JMenuItem.new(\"Send to Faraday\", nil)\n\n \t faradayMenu.addActionListener do |e|\n \t eventScan(invocation, ctx)\n \t end\n\n \t menu.push(faradayMenu)\n end\n\n return menu\n end",
"def option_methods\n @option_methods ||= []\n end",
"def present_menu_options\n space(1)\n puts \"Choose an option from the list below.\"\n space(1)\n puts '1. Search for events by city'\n puts '2. Search for events by artist or sports team'\n puts '3. See what I have coming up'\n puts '4. Delete my account'\n puts '5. Exit'\n space(1)\n pick_option\nend",
"def view_menu\n h = {\n f: :select_from_visited_files,\n d: :select_from_used_dirs,\n b: :view_bookmarks,\n s: :list_selected_files,\n c: :child_dirs,\n r: :recent_files,\n t: :tree,\n e: :dirtree\n }\n menu 'View Menu', h\nend",
"def list_option\n list_politicians\n list_voters\n puts\n puts \"(R)eturn to the main menu?\".center(80).green\n menu_return = gets\n end",
"def options_menu(noteboard)\n @start_prompt = TTY::Prompt.new\n @start_prompt.select(\"What do you want to do now?\") do |menu|\n menu.choice \"Load existing noteboards\", -> {noteboard_menu}\n menu.choice \"Add new note\", -> {Noteboard.noteboard_add(add_note)}\n menu.choice \"Delete note\", -> {Noteboard.noteboard_delete(delete_note)}\n menu.choice \"Back\", -> {StartMenu.new}\n end\nend",
"def initialize(prompt, options)\n super\n @selected = []\n @help = options.fetch(:help) { HELP }\n @default = options.fetch(:default) { [] }\n end"
] | [
"0.7256117",
"0.6851709",
"0.67834306",
"0.6751165",
"0.6739841",
"0.66743743",
"0.66743743",
"0.66641486",
"0.6620726",
"0.6618428",
"0.6618428",
"0.65678024",
"0.6492404",
"0.6422482",
"0.6341518",
"0.6328099",
"0.62321687",
"0.621441",
"0.6190853",
"0.61892235",
"0.61875516",
"0.61835295",
"0.6161787",
"0.61411995",
"0.6128202",
"0.6118698",
"0.6102969",
"0.61011666",
"0.607247",
"0.606482",
"0.6059575",
"0.60457075",
"0.60379595",
"0.60162663",
"0.60044634",
"0.60044634",
"0.5999968",
"0.5991266",
"0.59865075",
"0.5984811",
"0.5976682",
"0.59548575",
"0.59533495",
"0.5951657",
"0.5950653",
"0.59480923",
"0.5947629",
"0.593852",
"0.5930898",
"0.5926305",
"0.5923771",
"0.5923771",
"0.59222573",
"0.5919528",
"0.5886243",
"0.5886049",
"0.5885814",
"0.58834904",
"0.5873899",
"0.58682823",
"0.58625704",
"0.58625704",
"0.5857281",
"0.5849113",
"0.58407193",
"0.583732",
"0.5830578",
"0.58294153",
"0.58282214",
"0.5827242",
"0.5823782",
"0.5818724",
"0.58145744",
"0.5814205",
"0.5806586",
"0.5801024",
"0.5793716",
"0.57882756",
"0.5776016",
"0.5774816",
"0.57731116",
"0.5768851",
"0.57677794",
"0.57677794",
"0.57665485",
"0.57625985",
"0.57610077",
"0.576066",
"0.5757304",
"0.5754782",
"0.5752835",
"0.5748067",
"0.5743921",
"0.57418185",
"0.5722589",
"0.571887",
"0.57105124",
"0.57102567",
"0.5707775",
"0.5707501",
"0.5705791"
] | 0.0 | -1 |
WRITE NEW METHODS HERE: | def save_wizards
#open the file for writing
file = File.open("wizards.csv", "w")
# iterate over the array of save_wizards
@wizards.each do |wizard|
wizard_data = [wizard[:name], wizard[:house]]
csv_line = wizard_data.join(",")
file.puts csv_line
end
file.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def custom; end",
"def custom; end",
"def implementation; end",
"def implementation; 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 initialize\n \n end",
"def private_method\n end",
"def overrides; end",
"def wrapper; end",
"def new\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\t\t\n\tend",
"def initialize\r\n\r\n end",
"def operations; end",
"def operations; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def initialize\n\n end",
"def initialize\n\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize() end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def public_method; end",
"def public; end",
"def public; end",
"def initialize()\r\n\r\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 internal; end",
"def schubert; end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def call\n # implement in subclasses\n end",
"def initialize\n\n\tend"
] | [
"0.765835",
"0.72703606",
"0.72703606",
"0.72703606",
"0.72703606",
"0.7158053",
"0.7158053",
"0.71483564",
"0.71483564",
"0.712561",
"0.6905086",
"0.6905086",
"0.6905086",
"0.6905086",
"0.6905086",
"0.6905086",
"0.6905086",
"0.6905086",
"0.6905086",
"0.6905086",
"0.6905086",
"0.6905086",
"0.6752509",
"0.67010665",
"0.6643524",
"0.6610913",
"0.6582355",
"0.65713936",
"0.65713936",
"0.65713936",
"0.65552413",
"0.6547289",
"0.65136623",
"0.65136623",
"0.650444",
"0.650444",
"0.650444",
"0.650444",
"0.650444",
"0.650444",
"0.650444",
"0.650444",
"0.650444",
"0.650444",
"0.650444",
"0.649803",
"0.649803",
"0.6464458",
"0.6464458",
"0.6464458",
"0.6464458",
"0.6462027",
"0.6462027",
"0.64600825",
"0.64600825",
"0.64600825",
"0.64524263",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.64320755",
"0.6431039",
"0.64265436",
"0.6422714",
"0.6422714",
"0.6420781",
"0.6408167",
"0.64052236",
"0.64052236",
"0.64052236",
"0.64052236",
"0.64052236",
"0.64052236",
"0.64052236",
"0.6402072",
"0.63929695",
"0.63588595",
"0.63588595",
"0.63588595",
"0.63588595",
"0.63588595",
"0.63588595",
"0.63588595",
"0.63588595",
"0.63588595",
"0.63588595",
"0.63570166",
"0.6350472"
] | 0.0 | -1 |
Quantity because transactions are in BTC | def update_value(quantity)
if quantity > 0 # First If statement is for buying (if there are funds)
self.total_value = self.total_value + quantity
else # Else statement is for selling because quantity would be negative value
self.total_value = self.total_value + quantity
end
save!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_quantity\n cached_qty_bank.to_f + cached_qty_consigned.to_f\n end",
"def deposit_quantity\n money.to_d.divmod(market.settle_price(currency)).first\n end",
"def get_btc_profit\n quantity - close_positions.sum(:quantity)\n end",
"def get_btc_profit\n close_positions.sum(:quantity) - quantity\n end",
"def total_number_of_shares\n total = 0\n\n @transactions.each do |t|\n if t.get_action == 'buy'\n total += t.get_shares\n else\n total -= t.get_shares\n end\n end\n\n total\n end",
"def total_value_usd\n @quantity * price_in_usd\n end",
"def transaction_total_price\n hash[\"TransactionTotalPrice\"]\n end",
"def tx_value_in(tx)\n return 0 if tx.is_coinbase?\n value = 0\n tx.inputs.each do |txin|\n txout = @storage.output_for_outpoint(txin.prev_out, txin.prev_out_index)\n value += txout.value\n end\n return value\n end",
"def get_total_mined\n call_blockchain_api('totalbc').to_f\n end",
"def sell_quantity\r\n 100000000000\r\n end",
"def quantity\n quantity_initial - quantity_consumed\n end",
"def amount_in(date = nil)\n n = 0\n @transactions.each do |t|\n n += t.amount if t.adjusted_amount > 0\n end\n\n n\n end",
"def amount\n available_amount - blocked_amount\n end",
"def current_coin_total\n @coins.map(&:value).reduce { |sum, num| sum += num }\n end",
"def total_price\n total = 0\n self.transactions.each do |t|\n total += t.price\n end\n total\n end",
"def value()\n total = self.unique_transactions().values.inject(0, &:+)\n\n self.counts.values.each do |a|\n total += a[\"total\"]\n end\n\n total\n end",
"def qty_to_add\n 0\n end",
"def qty_to_add\n 0\n end",
"def price_amount_micros\n @subscription_purchase.price_amount_micros\n end",
"def total_value\n @quantity * @price_per_share\n end",
"def total_amount\n unit_amount * quantity\n end",
"def compute_quantity(new_trans)\n q = 0\n check_trans = self.transactions + new_trans\n check_trans.each do |trans|\n if (trans.action and trans.action.is_buy?)\n q += trans.quantity\n elsif (trans.action and trans.action.is_sell?)\n q -= trans.quantity\n end\n end\n\n if q < 0\n self.errors.add(:quantity_remaining, 'Cannot sell more transactions than have been bought. Please add more buys first')\n return {valid: false, quantity: self.quantity_remaining}\n end\n\n return {valid: true, quantity: q}\n end",
"def bitcoin\n @bitcoin || Counterparty.bitcoin\n end",
"def balance\n transactions.inject(0) do |sum, transaction|\n sum + transaction.amount\n end\n end",
"def gettransactionamount\r\n @transactionamount\r\n end",
"def balance\n txns.inject(Amount::ZERO) { |sum, t| sum + t.amount }\n end",
"def total_coins_value\n json_response({:total_coins_value => @total_coins_val, :status => true, :message => 'calculated'})\n end",
"def amount\n result = 0\n if gateway_mode === :test\n result = 1000\n else\n result = (@order.price * 100)\n end\n result.to_i\n end",
"def activemerchant_amount\n (amount * 100).to_i\n end",
"def balance\n transactions.inject(:+)\n end",
"def total_price \n sticker.price.to_i * quantity.to_i\n end",
"def pending_balance\n transactions.where(pending: true).sum(:amount)\n end",
"def total_amount\r\n quantity * unit_price\r\n end",
"def total_buy_price\n buy_price[\"total\"][\"amount\"].to_f\n end",
"def net_quantity\n @net_qty ||= (opening_stock_quantity + purchase_quantity + stock_received_quantity + sales_return_quantity) - (sales_quantity + stock_issued_quantity + fetch_stock_wasted_quantity + purchase_return_quantity)\n end",
"def balance\n balance = 0.00\n @transactions.each do | transaction|\n balance += transaction[:amount]\n end\n return balance\n end",
"def total_quantity\n total = 0.0\n self.quantities.each do |quantity|\n total = total + quantity.number\n end\n total\n end",
"def amount\n v = state[:amount] and BigDecimal(v.to_s)\n end",
"def update_value(quantity)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# quantity == crypto value NOT USD\n\t\t# debugger\n\n\t\tif quantity > 0\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# BUY \n\t\t\tself.total_value = self.total_value + quantity\t\t\t# increment wallet value by quantity\n\t\telse \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# SELL\n\t\t\tself.total_value = self.total_value + quantity\t\t\t# quantity is Negative!! so adding, will decrement\n\t\tend\n\n\t\tsave!\n\tend",
"def balance_btc_ui\n balance_btc.to_f * 10 ** -8\n end",
"def total_quantity\n breastfeedings.sum(:quantity)\n end",
"def total_transactions\n return self.transactions.count\n end",
"def quantity_of(item_id)\n if @item_quantity_map.blank?\n @item_quantity_map = {}\n self.trade_items.each do |ob_item|\n @item_quantity_map[ob_item.item_id] = ob_item.quantity\n end\n end\n @item_quantity_map[item_id] || 0\n end",
"def merchant_amount_usd\n payload[:merchant_amount].to_d\n end",
"def total_price\n Money.new(quantity * price_per_serving)\n end",
"def available_balance(cur)\n 1000\n end",
"def calculate_price_in_micro_units\n 0\n end",
"def get_total_qty\n return self.items.sum(:qty)\n end",
"def amount; end",
"def debit_amount\n sum( debits )\n end",
"def balance\n\t\tbalance = 0\n\t\t@transactions.each do |transaction|\n\t\t\tbalance += transaction[:amount]\n\t\tend\n\t\treturn balance\n\tend",
"def payment\n payment = 0\n transactions = finance_transactions\n unless transactions.nil?\n transactions.each do |t|\n payment += t.amount\n end\n end\n payment\n end",
"def return_sum\n @money = 0\n @transactions.each do |t|\n if t.get_action == 'buy'\n @money = @money + t.get_value\n elsif t.get_action == 'sell'\n @money = @money - t.get_value\n end\n end\n total_value_of_shares - @money\n end",
"def total_pay\n total = 0\n @serie_items.each do |item|\n # next if item.quantity.nil?\n total += item.quantity * item.creation.price\n end\n return total\n end",
"def amount_i\n @amount\n end",
"def total_value_of_shares\n total_number_of_shares * @current_value\n end",
"def subamount unit_price , quantity\n unit_price.to_f * quantity.to_i\n end",
"def sum\n transactions.sum(:amount)\n end",
"def sum\n transactions.sum(:amount)\n end",
"def total\n conv_price_single * conv_quantity\n end",
"def total_amount_inc_tax\n unit_amount_inc_tax * quantity\n end",
"def total_trans\n food.trans * quantity\n end",
"def total_benefits_value\n benefits.map{|b| b.total_value_cents}.reduce(:+).to_i\n end",
"def quantity_sold\n purchases.inject(0) { |sum, purchase| sum + purchase.quantity }\n # purchases.sum(:quantity)\n end",
"def buy_quote\n\t\tresult = money_quote('bid', btc_float2int(1.0))\n\t\treturn result['amount']\n\tend",
"def counting_quantity\n product.allow_fractional_quantity? ? 1 : quantity.to_i\n end",
"def vat_amount(q = 1)\n price_inc_vat(q) - price_ex_vat(q)\n end",
"def total_amount\n \t amount = 0\n \t operation_items.each do | oi |\n \t\tamount = amount + oi.amount\n end\n amount\n end",
"def quantity_available\n available = item_hash.deep_find(:quantity_available)\n if available.nil?\n return quantity_listed - quantity_sold\n else\n return available.to_i\n end\n end",
"def amount\n quantity * price\n end",
"def credit_amount\n sum( credits )\n end",
"def amount_out(date = nil)\n n = 0\n @transactions.each do |t|\n n += t.amount if t.adjusted_amount < 0\n end\n\n n\n end",
"def balance\n\t\tbalance = 0.00\n\t\t@transactions.each do |transaction|\n\t\t\tbalance += transaction[:amount]\n\t\tend\t\n\n\t\treturn balance\n\tend",
"def total_transactions(transactions_array)\n total = 0\n transactions_array.each do |transaction| \n total += transaction.amount\n end\n return \"%.2f\" % total\n end",
"def quantity\n hash[\"Quantity\"]\n end",
"def quantity\n map(&:quantity).sum\n end",
"def trade_value\n 0.4\n\n end",
"def total_items\n order_items.inject(0) { |t,i| t + i.quantity }\n end",
"def amount\n difference\n end",
"def total_items\n order_items.inject(0) { |t, i| t + i.quantity }\n end",
"def total_items\n order_items.inject(0) { |t, i| t + i.quantity }\n end",
"def money_spent\n self.purchases.map { |p| p.price }.sum\n end",
"def current_balance\n starting_balance + transactions.sum(:amount)\n end",
"def item_count\n order_items.map(&:quantity).sum\n end",
"def total_item_number\n @quantity * product.result_n\n end",
"def total_amount\n t = amount\n t += sub_transactions.sum(:amount) if recurring_period\n t\n end",
"def total_amount\n (total * 100).to_i\n end",
"def get_price_of_bitcoin\n data = get_data_from_website(BLOCKCHAIN_WEBSITE)\n price = get_price_in_usd(data)\n # This converts the string to a floating point number\n # Another conversion instruction is to_i (integer)\n price.to_f\nend",
"def get_total_qnty(line_items)\n line_items.map(&:quantity).sum\n end",
"def get_total_qnty(line_items)\n line_items.map(&:quantity).sum\n end",
"def cf_purchase_transaction_cost\n cash_flow_builder(amt: -self.purchase_transaction_cost*1000, pos_arr: [0])\n end",
"def estimate_crypto_profit\n quantity - close_positions.sum(:quantity)\n end",
"def total_billable_transfer_usage\n @attributes[:total_billable_transfer_usage]\n end",
"def balance\n return false unless Account.exists?(@account_id)\n\n Trade.where(account_id: @account_id).pluck(:amount).reduce(:+) || 0.0\n end",
"def current_amount\n items.reduce(0) do |sum, item|\n sum + item.current_amount * item.price\n end\n end",
"def pays_transfers\n self.offers_as_buyer.accepted.inject(0){|sum,offer| sum += offer.pay}\n end",
"def purchase_amount\n if order.present?\n order.total - credits_amount\n else\n credits_amount\n end\n end",
"def total_items\r\n\t\t@items.inject(0) { |sum, i| sum + i.quantity }\r\n\tend",
"def investment\n if buy_price\n num_of_shares * buy_price\n end\n end",
"def ot_voucher_amount\n end",
"def money\n\t\tif @wallet.neg?\n\t\t\t@in_debt = true\n\t\tend\n\t\treturn @wallet.amount\n\tend"
] | [
"0.74126107",
"0.7122835",
"0.7038064",
"0.6998828",
"0.6977632",
"0.6943274",
"0.6789709",
"0.6749792",
"0.667268",
"0.66495126",
"0.66365737",
"0.66282135",
"0.662325",
"0.6605231",
"0.65895015",
"0.6584995",
"0.65725833",
"0.65725833",
"0.6539682",
"0.652451",
"0.6523343",
"0.6521292",
"0.6509139",
"0.6508024",
"0.650272",
"0.64898497",
"0.6449479",
"0.6448267",
"0.64391553",
"0.6434154",
"0.6399165",
"0.6389774",
"0.63796645",
"0.63699865",
"0.6352575",
"0.63476235",
"0.6343726",
"0.63427484",
"0.6334848",
"0.63277245",
"0.6325663",
"0.6325614",
"0.6324528",
"0.630067",
"0.6286759",
"0.62749916",
"0.6268273",
"0.62678576",
"0.626683",
"0.62639815",
"0.6262108",
"0.6257623",
"0.62525946",
"0.6250391",
"0.6242081",
"0.6235418",
"0.6228954",
"0.6224599",
"0.6224599",
"0.6222973",
"0.6216645",
"0.6213558",
"0.62069935",
"0.6204237",
"0.61926436",
"0.6170158",
"0.6169326",
"0.61617434",
"0.6159169",
"0.6153751",
"0.61513793",
"0.6147608",
"0.61416864",
"0.613",
"0.612857",
"0.61201423",
"0.6115259",
"0.61140674",
"0.6109275",
"0.6107812",
"0.6107812",
"0.6098946",
"0.609837",
"0.6094711",
"0.60901076",
"0.608934",
"0.60828084",
"0.60812104",
"0.60807365",
"0.60807365",
"0.60710865",
"0.6068734",
"0.6064047",
"0.606226",
"0.60616094",
"0.6056854",
"0.6041636",
"0.6039423",
"0.6037546",
"0.60372853",
"0.6034803"
] | 0.0 | -1 |
Overriding the default json method so that the data returned can be used for plotting fullcalendar | def as_json(options = {})
{
:title => "#{self.user_id}",
# :desctiption => "#{self.rank}"
:start => self.exam_date.rfc822,
:end => self.exam_date.rfc822,
:recurring => false,
:allDay => true,
:rank => self.rank,
:total => self.total_users_attended,
:l1_attended => self.l1_attended,
:l2_attended => self.l2_attended,
:l3_attended => self.l3_attended,
:l1_total => self.l1_total,
:l2_total => self.l2_total,
:l3_total => self.l3_total,
:accuracy => self.accuracy,
:mark_ratio => self.mark_ratio,
:least_mark_ratio => self.least_mark_ratio,
:day_parameter => self.day_parameter,
:backgroundColor => color_pick
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.title,\n :description => self.description || \"\",\n :start => starts_at.rfc822,\n :end => ends_at.rfc822,\n :allDay => self.all_day,\n :recurring => false,\n :url => Rails.application.routes.url_helpers.event_path(id),\n #:color => \"red\"\n }\n\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.title,\n :description => self.description || \"\",\n :start => unless starts_at.blank? then starts_at.rfc822 else \"\" end,\n :end => unless ends_at.blank? then ends_at.rfc822 else \"\" end,\n :allDay => self.all_day,\n :recurring => false,\n #:url => Rails.application.routes.url_helpers.event_path(id),\n #:color => \"red\"\n }\n end",
"def show\n render json: @evento.formatted_data.as_json()\n end",
"def as_json(options = {})\n {\n :id => self.ID,\n :title => self.listing,\n :description => self.summary,\n :start => setTimes(self.eventstartdate, self.eventstarttime),\n :end => setTimes(self.eventenddate, self.eventendtime),\n :allDay => holiday?,\n :recurring => false,\n :url => get_url,\n :color => get_color,\n :textColor => get_text_color\n }\n end",
"def fullcalendar_events_json\n events.map do |event|\n {\n id: event.id.to_s,\n title: event.name,\n start: event.starts_at.strftime('%Y-%m-%d %H:%M:%S'),\n end: event.ends_at.strftime('%Y-%m-%d %H:%M:%S'),\n allDay: event.all_day,\n url: event_path(event)\n }\n end\n end",
"def as_json(*)\n CalendarJSON.rent(self)\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.titre,\n :description => self.contenu || \"\",\n :start => start_at.rfc822,\n :end => end_at.rfc822,\n :allDay => self.all_day,\n :recurring => false,\n :url => Rails.application.routes.url_helpers.event_path(id)\n }\n end",
"def render_json\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.title,\n :description => self.description || \"\",\n :start => starts_at.rfc822,\n :end => ends_at.rfc822,\n :allDay => self.all_day,\n :recurring => false,\n :url => Rails.application.routes.url_helpers.event_path(id)\n }\n \n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.title,\n :description => self.description || \"\",\n :start => starts_at.rfc822,\n :end => ends_at && !ends_at.blank? ? ends_at.rfc822 : '',\n :allDay => self.all_day,\n :color => self.person ? self.person.bg_color : \"#f3f2f2\",\n :borderColor => self.person ? self.person.bg_color : \"#ddd\",\n :textColor => self.person ? self.person.txt_color : \"#666\",\n :className => \"event #{'unsinged' unless self.person}\",\n :recurring => false,\n :resource => self.person ? self.person.id : \"\",\n :resourceId => self.person ? self.person.id : \"\",\n :url => Rails.application.routes.url_helpers.event_path(id)\n }\n \n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.title,\n :description => self.description || \"\",\n :start => starts_at.rfc822,\n :end => ends_at.rfc822,\n :allDay => self.all_day,\n :recurring => false,\n :backgroundColor => bgColor\n\n #:url => Rails.application.routes.url_helpers.team_event_path(self.team, self.id),\n #:color => \"red\"\n }\n\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.title,\n :description => self.description || \"\",\n :start => start_time.rfc822,\n :end => end_time.rfc822,\n :allDay => false,\n :recurring => false,\n :color => self.event_status,\n :textColor => 'black',\n :url => Rails.application.routes.url_helpers.event_path(id)\n }\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.title,\n :description => self.description || \"\",\n :start => (starts_at + 5.hours),\n :end => (ends_at + 5.hours),\n :allDay => self.all_day,\n :recurring => false,\n :url => Rails.application.routes.url_helpers.event_path(id)\n }\n \n end",
"def json_data_for_highcharts\n self.to_json.html_safe\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.title,\n :description => self.description || \"\",\n :start => (starts_at).to_datetime.iso8601,\n :end => (ends_at).to_datetime.iso8601,\n :allDay => self.all_day,\n :recurring => false,\n :url => Rails.application.routes.url_helpers.main_event_event_path(self.main_event.id, id)\n }\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.title,\n :description => self.description || \"\",\n :start => self.starts_at.rfc822,\n :end => self.ends_at.rfc822,\n :allDay => self.all_day,\n :recurring => false,\n :color => self.color.nil? ? \"blue\" : self.color,\n :location => self.location,\n :notes => self.notes,\n :url => self.edit_url #Rails.application.routes.url_helpers.edit_event_path(id)\n }\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.title,\n :description => self.description || \"\",\n :start => starts_at.rfc822,\n :end => ends_at.rfc822,\n :url => Rails.application.routes.url_helpers.event_path(id)\n }\n end",
"def series_json(params={})\n # Create data for charts\n color = params[:color] ||= 'AA4643'\n color = '#' + color\n series = []\n data = []\n\n data << [self.baseline_date, (self.baseline.round*100).round / 100.0]\n # For ideal data\n self.progresses.each{|progress| \n data << [progress.due_date, (progress.accuracy*100).round / 100.0]\n }\n data << [self.due_date, (self.accuracy*100).round / 100.0]\n #Sort data by due date\n data = data.sort_by { |hsh| hsh[0] }\n \n series << {\n :type => 'line',\n :name => \"Ideal chart\",\n :data => data\n }\n if color && color == '#4572A7'\n series[0][:color] = \"#AA4643\"\n end\n # For add grade \n data = []\n self.grades.find_each{|grade| \n data << [grade.due_date, (grade.accuracy*100).round / 100.0]\n }\n data = data.sort_by { |hsh| hsh[0] }\n series << {\n :name => self.name,\n :data => data,\n :color => color \n }\n series.to_json\n end",
"def show\n render json: format_event(@event)\n end",
"def as_json(options = {})\n {\n :title => self.title,\n :start => self.start_time,\n :end => self.end_time,\n :description => self.description\n }\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.title,\n :description => self.description || \"\",\n :start => self.starts_at.rfc822,\n :end => self.ends_at.rfc822,\n :allDay => self.all_day,\n :recurring => false\n }\n\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.name,\n :description => self.description || \"\",\n :start => starts_at.rfc822,\n :end => ends_at.rfc822,\n :url => Rails.application.routes.url_helpers.select_path(id),\n #:color => \"red\"\n }\n\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.title+\" by \"+self.counselor.full_name,\n :start => start_at.rfc822,\n :end => end_at.rfc822,\n :allDay => 0,\n :recurring => false\n # :url => '/'+self.counselor.class.to_s.downcase+'/dashboards'\n }\n\n end",
"def json_response(data = {})\n base = {\n 'api_version' => VERSION,\n 'auth' => 1,\n 'last_refreshed_on_time' => Feed.last_refreshed_at.to_i\n }\n\n content_type :json\n base.merge(data).to_json\n end",
"def show_json\n end",
"def json\n render :json => @talks.to_json(:include => {:venue => {:only => :name},\n :series => {:only => :name},\n :organiser => {:only => :name},\n }),\n :callback => params[:callback]\n end",
"def tojson\n\t\tend",
"def index\n @events = Event.where('user_id = ?', current_user)\n formatted_events = @events.map do |event|\n format_event event\n end\n\n render json: formatted_events\n end",
"def json\n @data.to_json\n end",
"def show\n render json: @clock_event\n end",
"def index\n @histories = History.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: json_out = {\n \"timeline\"=>\n {\n \"headline\"=>\"The Main Timeline Headline Goes here\",\n \"type\"=>\"default\",\n \"text\"=>\"<p>Intro body text goes here, some HTML is ok</p>\",\n \"asset\"=> {\n \"media\"=>\"http://www.exglam.com/wp-content/uploads/2013/02/Kajal-agarwal-in-Blue-and-white-Fade-Short-with-white-Top-and-a-Blue-bow-in-hair.jpg\",\n \"credit\"=>\"Credit Name Goes Here\",\n \"caption\"=>\"Caption text goes here\"\n },\n\n \"date\"=> @histories.map { |timeline| {\"startDate\" => timeline.startdate.strftime(\"%Y,%m,%d\"),\"endDate\" => timeline.enddate.strftime(\"%Y,%m,%d\"),\"headline\" => timeline.headline,\"text\" => timeline.content, \"asset\" => {\"media\" => timeline.media}}},\n\n\n \"era\"=> [\n {\n \"startDate\"=>\"2011,12,10\",\n \"endDate\"=>\"2011,12,11\",\n \"headline\"=>\"Headline Goes Here\",\n \"text\"=>\"<p>Body text goes here, some HTML is OK</p>\",\n \"tag\"=>\"This is Optional\"\n }\n\n ]\n }\n } }\n end\n end",
"def as_json(*args)\n data\n end",
"def getJson\n render json: getData()\n end",
"def dates\n render json: @standings\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.purpose,\n :start => start_time.rfc822,\n :end => end_time.rfc822,\n :allDay => self.allDay,\n :recurring => false,\n :url => Rails.application.routes.url_helpers.reservation_path(id),\n }\n end",
"def as_json(options = {})\n if self.category == 'platform' && self.status == 'unconfirmed'\n bck_color = '#d2322d'\n text_color = '#fff'\n elsif self.category == 'platform'\n bck_color = '#60A869'\n text_color = '#004203'\n elsif self.category == 'sync'\n bck_color = '#aaa'\n text_color = '#7e7e7e'\n else\n #bck_color = '#91C9DF'\n #text_color = '#2B6379'\n bck_color = '#808080'\n text_color = '#444444'\n end\n if self.category == 'sync'\n title = 'Busy Time (sync)'\n else\n title = [self.user_name, self.user ? self.user.name : nil, self.therapy_name, self.title, 'Appointment'].reject{ |c| !c.present? }\n title = title[0]\n end\n {\n id: self.id,\n title: title,\n address: self.address || \"\",\n start: self.service_starts_at,\n # fullCalendar stores end time as exclusive\n end: service_ends_at + 1.second,\n color: bck_color,\n textColor: text_color\n }\n end",
"def as_json\n @data\n end",
"def index\n @events = @category.events\n render json: @events \n end",
"def as_json(*)\n {\n FunJSON.create_id => self.class.name,\n 'y' => year,\n 'm' => month,\n 'd' => day,\n 'sg' => start,\n }\n end",
"def index_for_calendar\n # build_calendar_data --> AppointmentsHelper method\n render json: build_calendar_data, status: 200\n end",
"def show\n \trender json: @event\n end",
"def get_events\t\t\t\n @task = UserEvent.where(\"user_id\"=>current_user.id)\n events = []\n @task.each do |task|\n events << {:id => task.id, :title => task.title, :start => DateTime.parse(task.start.to_s).strftime(\"%Y-%m-%d\"), :end => DateTime.parse(task.end.to_s).strftime(\"%Y-%m-%d\") }\n end\n render :text => events.to_json \n end",
"def get_measurements\n render json: @data_source.measurements\n end",
"def index\n @evento = Evento.all\n @eventos_nous=Array.new\n @evento.each do |e|\n if(Date.parse(e.end_date) >= Date.today)\n @eventos_nous << Evento.find_by_id(e.id).formatted_data.as_json()\n end\n end\n render json: @eventos_nous\n end",
"def events_jsonify(events)\n\t\t\tevents.collect do |event|\n\t\t\t\t{ id: event.id,\n\t\t\t\t\tname: event.name,\n\t\t\t\t\tsummary: event.summary,\n\t\t\t\t\tstart_era: event.start_era,\n\t\t\t\t\tstart_date: \"#{event.start_date or 0}/#{event.start_month or 0}/#{event.start_year}\",\n\t\t\t\t\tend_date: \"#{event.end_date or 0}/#{event.end_month or 0}/#{event.end_year or event.start_year}\",\n\t\t\t\t\tarcs: event.arcs,\n\t\t\t\t\tentities: event.entities }\n\t\t\tend.to_json\n\t\tend",
"def json\n {\"creation_date\" => @creation_date}\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.subject.name,\n :description => self.description || \"\",\n :start => starts_at.rfc822,\n :end => ends_at.rfc822,\n :allDay => self.all_day,\n :recurring => false,\n :url => Rails.application.routes.url_helpers.routine_path(id)\n }\n end",
"def json_data\n json_format = params[:json_format] or 'default'\n case json_format\n when 'basic'\n collection.map {|p| {'id' => p.id, 'name' => p.name}}.to_json\n else\n collection.to_json()\n end\n end",
"def as_json(options = {})\n {\n title: \"#{self.proyecto.nombre} - #{self.nombre}\",\n start: self.start_time,\n end: self.end_time\n }\n end",
"def as_json(options={})\n\t\tsuper(:methods => [:display_result,:display_normal_biological_interval,:display_count_or_grade,:display_comments_or_inference,:test_is_abnormal,:test_is_ready_for_reporting,:test_is_verified, :successfully_updated_by_lis])\n\tend",
"def show\n render json: @dia_evento\n end",
"def as_json(options = {})\r\n\t\tsuper\r\n\t\t {type: type,\r\n\t\t \t Title: Title,\r\n\t\t \t Authors: authors,\r\n\t\t \t With: with,\r\n\t\t \t Details: details,\r\n\t\t \t Year: year\r\n\t\t \t }\r\n\tend",
"def json\n {}\n end",
"def index\n respond_with(events) do |format|\n format.ics { send_data(events_as_ical, filename: \"#{current_user.username}-#{current_instance.subdomain}-calendar.ics\", type: Mime::Type.lookup_by_extension('ics')) }\n format.json { render json: fullcalendar_events_json }\n end\n end",
"def json_callback\n trending_data = []\n\n # sql join statement to get all trends/locations through the link table\n trend_info = TrendDatum.find_by_sql(\n [\n 'select locations.x as x, locations.y as y, trends.name as name from trend_data\n inner join locations on trend_data.location_id = locations.id\n inner join trends on trend_data.trend_id = trends.id'\n ]\n )\n\n # loop every trend/location and store it in an object in a list\n trend_info.each do |trend_data|\n trend_data_point = TrendingData.new(trend_data.x, trend_data.y, trend_data.name)\n unless trend_data_point.nil?\n trending_data.push trend_data_point\n end\n end\n\n # return list of objects as json\n trending_data.to_json\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def get_json\n return to_json()\nend",
"def as_json(options = {})\n {\n :id => self.id,\n :title => '',\n :client => self.client.first_name + ' ' + self.client.last_name,\n :name => self.name,\n# :description => self.description || \"\",\n :start => start_datetime.rfc822,\n :start_window => start_window.rfc822,\n :end => '',\n :allDay => '',\n# :recurring => false,\n :url => Rails.application.routes.url_helpers.job_request_path(id)\n } \n end",
"def index\n @events = Event.all\n render json: @events\n end",
"def index\n @events = Event.all\n\n render json: @events\n end",
"def as_json\n # if it belongs to a department, user_id = 0\n user_id = self.user ? self.user.id : 0 \n {\n :id => self.id,\n :notify => self.notify,\n :kind => self.kind,\n :current_state => self.status,\n :title => self.overview,\n :tag => self.tag,\n :long_description => self.content,\n :editable => true,\n :start => self.started,\n :finish => self.finished,\n :end => self.finished,\n :department_id => self.department_id,\n :user_id => user_id,\n :allDay => false,\n :url => Rails.application.routes.url_helpers.activity_path(id) \n }\n end",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end",
"def to_json\n attributes = self.values\n attributes[:date_published] = self.date_published_iso8601\n return attributes.to_json\n end",
"def json_serialize\n end",
"def to_json\n\n end",
"def jsonize\n {id: self.id, title: self.title, start: self.start_date.strftime('%a %b %d %Y'), end: self.end_date.strftime('%a %b %d %Y'), resource: self.resource_id}\n end",
"def as_json(*_args)\n as_extended_json\n end",
"def index\n @stats = Stat.all\n\n render json: {data:\n @stats.map {|stat|\n days = range_to_days(stat)\n {\n total_seconds: stat.total_seconds,\n human_readable_total: humanize(stat.total_seconds),\n daily_average: stat.daily_average,\n human_readable_daily_average: humanize(stat.daily_average),\n range: stat.range,\n holidays: stat.holidays,\n days_including_holidays: days,\n days_minus_holidays: days - stat.holidays,\n status: stat.status,\n is_already_updating: stat.is_already_updating,\n is_stuck: stat.is_stuck,\n is_up_to_date: stat.is_up_to_date,\n timeout: stat.timeout,\n editors: stat.editors.map {|e|\n {\n name: e.name,\n total_seconds: e.total_seconds,\n percent: e.percent\n }\n }\n }\n }}\n end",
"def fullcalendarify\n\t\t{\n\t\t\tid: id,\n\t\t\tstart: start_date.iso8601,\n\t\t\tend: end_date.iso8601,\n\t\t\ttitle: title + (showtime ? \"\\n#{start_date.strftime \"%l:%M %p\"} - #{end_date.strftime \"%l:%M %p\"}\" : \"\"),\n\t\t\turl: \"/events/#{id}\",\n\t\t\tcolor: color\n\t\t}\n\tend",
"def as_json(_opts={})\n raise NotImplementedError\n end",
"def formatJSON\n # @formattedContents = .... whatever puts it into JSON\n end",
"def show\n render json: @business_event.to_json(\n :methods => [:activity_types],\n include: {\n business_addresses: {only: [:id, :name, :address, :latitude, :longitude]},\n event_activities: {except: []}\n }),\n status: 200\n end",
"def index\n @event = Event.all\n render json: @event\n end",
"def past_events\n @events = Event.past\n render json: @events, include: :talks\n end",
"def as_json(*)\n {\n JSON.create_id => self.class.name,\n 'y' => year,\n 'm' => month,\n 'd' => day,\n 'H' => hour,\n 'M' => min,\n 'S' => sec,\n 'of' => offset.to_s,\n 'sg' => start,\n }\n end",
"def json_data\n json_format = params[:json_format] or 'default'\n case json_format\n when 'basic'\n collection.map { |v| { 'id' => v.product.id, 'name' => v.product.name }}.uniq { |i| i['id'] }.to_json\n when 'autocomplete'\n collection.map { |v| {\n :data => {\n :id => v.id,\n :product_id => v.product.id,\n :name => v.fullname,\n :sku => v.sku,\n :count_on_hand => v.count_on_hand,\n :image_url => (v.images.count > 0 ? v.images.first.attachment.url(:mini) : nil)\n },\n :value => v.fullname,\n :result => v.fullname\n }\n }.to_json\n else\n collection.to_json(:include => {:variants => {:include => {:option_values => {:include => :option_type},\n :images => {:only => [:id], :methods => :mini_url}}},\n :images => {:only => [:id], :methods => :mini_url}, :master => {}})\n end\n end",
"def chart_data\n @track=current_user.tracks.find(params[:id])\n respond_to do |format|\n format.json {render :json => @track.as_chart_data}\n end\n end",
"def to_json\n @data.to_json\n end",
"def show\n @maps_json = @event.to_gmaps4rails do |event, marker|\n marker.title event.name \n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end",
"def to_json(*)\n #This is a stub, used for indexing\n end",
"def to_json\n data.to_json\n end",
"def to_json_raw_object()\n #This is a stub, used for indexing\n end",
"def show_events\n render json: current_user\n end",
"def json()\n @tiles = @ir.map{|e| e.json}\n @event_frame = @tiles.map{|t| t.id }\n end",
"def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\n end",
"def format\n :json\n end",
"def show\n render json: @formato\n end",
"def as_json(options = nil)\n json_data = {}\n json_data[\"start\"] = self.start if self.start\n json_data[\"end\"] = self.end if self.end\n json_data[\"duration\"] = self.duration if self.duration\n json_data[\"demand\"] = self.demand if self.demand\n json_data[\"location\"] = self.location.as_json\n json_data[\"priority\"] = self.priority if self.priority\n json_data[\"type\"] = self.type if self.type\n if self.time_windows\n json_data[\"time_windows\"] = self.time_windows.map{ |tw| tw.as_json }\n end\n\n json_data\n end",
"def show\n render json: @event_configuration.to_json\n end",
"def get_data\n raise \"This method should be overriden to return the JSON data for a concrete table\"\n end",
"def to_json_raw(*args)\n #This is a stub, used for indexing\n end",
"def series_get_all\n begin\n api = \"#{$config['sonarr']['api_url']}/series\"\n\n url = URI.parse(api)\n\n req = Net::HTTP::Get.new(url.path)\n req.add_field('Content-Type', 'application/json')\n req.add_field('X-Api-Key',$config['sonarr']['api_key'])\n\n res = Net::HTTP.new(url.host, url.port).start do |http|\n http.request(req)\n end\n\n json = JSON.parse(res.body)\n #if json.class.to_s == 'Array'\n # json.each do |row|\n # log_debug (\"#{row['title']}\")\n # end\n #end\n\n rescue => e\n log_debug \"failed #{e}\"\n end\n return json\n end",
"def index\n # @weekdays = Weekday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@weekdays, mode: :compat) }\n end\n end",
"def to_json\n Formatter::JSON.render(self)\n end",
"def as_json(options={})\n super(:methods => [:saldo_actual])\n end"
] | [
"0.7324992",
"0.7303312",
"0.72471964",
"0.72265244",
"0.7214426",
"0.71634436",
"0.7146891",
"0.7124845",
"0.7124406",
"0.70961374",
"0.70811063",
"0.70280695",
"0.7009959",
"0.69732386",
"0.6949632",
"0.6936495",
"0.691719",
"0.6679622",
"0.6658336",
"0.65865195",
"0.6556202",
"0.65453756",
"0.65384233",
"0.6528207",
"0.6509474",
"0.6503288",
"0.64903235",
"0.64707756",
"0.64589125",
"0.6455115",
"0.6452405",
"0.6435434",
"0.6414413",
"0.6368371",
"0.6357459",
"0.63545674",
"0.63532937",
"0.6349794",
"0.6345268",
"0.63276726",
"0.63233846",
"0.63232285",
"0.63160676",
"0.630432",
"0.629674",
"0.628651",
"0.6275691",
"0.62672645",
"0.62671906",
"0.6254412",
"0.6249473",
"0.62412536",
"0.62352866",
"0.6233229",
"0.62214977",
"0.6221126",
"0.6221126",
"0.6221126",
"0.6221126",
"0.6221126",
"0.6215228",
"0.6205476",
"0.6190008",
"0.61899644",
"0.6164503",
"0.6154513",
"0.6153379",
"0.61520797",
"0.6137832",
"0.61257946",
"0.6123927",
"0.61129373",
"0.6102382",
"0.610141",
"0.60869396",
"0.6066707",
"0.6063187",
"0.6058213",
"0.60581374",
"0.6054071",
"0.60439295",
"0.6041751",
"0.60370517",
"0.6034969",
"0.6030922",
"0.60301137",
"0.60207504",
"0.6019129",
"0.60166985",
"0.60092705",
"0.6009259",
"0.6008695",
"0.6003074",
"0.59981316",
"0.59757197",
"0.5973959",
"0.59682775",
"0.5967745",
"0.596612",
"0.59559304",
"0.5955714"
] | 0.0 | -1 |
this method will be called for each events in the full calendar | def color_pick
if mark_ratio < (day_parameter + least_mark_ratio)
color = "#C7E6F2" #light color below average performance
elsif mark_ratio >= ((2*day_parameter) + least_mark_ratio)
color = "#44bbdf" #dark color excellent perfomance
else
color = "#70c9e5" #meduim color average performance
end
return color
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync\n @events = nil\n each do |event|\n matching_event_page = @event_pages.find do |event_page|\n event_page.ical_url == event.url.to_s\n end\n\n if matching_event_page\n event.url = Icalendar::Values::Uri.new(matching_event_page.url)\n\n matching_event_page.title = event.summary\n # Dates are broken on Lanyrd: https://twitter.com/aslak_hellesoy/status/591272555035684864\n # Start dates is right, end date is wrong (!?!)\n # matching_event_page.dtstart = event.dtstart\n # matching_event_page.dtend = event.dtend\n end\n end\n end",
"def events_now\n\n # Open empty array\n events = []\n\n # Loop over all the calendars\n CALENDARS.each do |name, id|\n\n # Get the events\n cal_events = calendar(id).find_events_in_range(Time.now, Time.now + 60)\n\n # Loop over each one and add it to the array\n cal_events.each do |e|\n events << {event: e, cal: name} unless e.nil?\n end\n\n end\n\n # Return the final list\n return events\n\nend",
"def fullcalendar_events_json\n events.map do |event|\n {\n id: event.id.to_s,\n title: event.name,\n start: event.starts_at.strftime('%Y-%m-%d %H:%M:%S'),\n end: event.ends_at.strftime('%Y-%m-%d %H:%M:%S'),\n allDay: event.all_day,\n url: event_path(event)\n }\n end\n end",
"def index\n @calender_events = CalenderEvent.all\n end",
"def print_all_events\n return NO_EVENTS_IN_CALENDAR unless events?\n\n @calendar_events.each do |date, events|\n puts \"On date #{date}:\"\n print_events(events)\n end\n end",
"def event_instances(calendar_id, event_id)\n end",
"def index\n @events = Event.order(:time).order(:date)\n \n fetch_calendar 'tgbgmclhk5gegn8t95fvqov0s8@group.calendar.google.com'\n end",
"def create_events\n end",
"def fetch_events\n params = {'calendarId' => CONFIG[:cal_id], \n 'orderBy' => 'startTime',\n #'timeMax' => Time.utc(CONFIG[:year].to_i + 1, 4, 1).iso8601, \n #'timeMin' => Time.utc(CONFIG[:year].to_i, 4, 1).iso8601,\n 'singleEvents' => 'True'}\n \n result = @client.execute(:api_method => @cal.events.list, :parameters => params)\n\n @events_list = []\n result.data.items.each do |item|\n @events_list << item\n end\n end",
"def all_events\n @events = Event.all\n end",
"def render_events(events)\n output = ''\n last_date = Date.parse('1970-1-1')\n events.each do |event|\n \n week, calendar_page = '',''\n \n #unless last_date.strftime('%W') == event.start_date.strftime('%W')\n # #week = render_week(event.start_date)\n #end\n #unless last_date.day == event.start_date.day\n # calendar_page = render_calendar_page(event.start_date)\n #end\n \n #output += render(:partial => 'events/event',:locals => {:event=>event, :week=>week, :calendar_page=>calendar_page})\n \n #last_date = event.start_date\n \n end\n output\n end",
"def home\n\n @events = Event.limit(4)\n @events_calendar = Event.all\n\nend",
"def scrape_events\n @scraper.scrape_and_create_events\n end",
"def add_events(new_events); end",
"def index\n @agenda = HTTParty.get('http://fake-co-calendar.herokuapp.com/api/v1/events?offset=-730')['events']['list']\n @agenda.each do |meeting|\n meeting['start_time'] = DateTime.strptime(meeting['start_time'] + Time.now.getlocal.zone, \"%Y-%m-%d %H:%M:%S %z\")\n meeting['end_time'] = DateTime.strptime(meeting['end_time'] + Time.now.getlocal.zone, \"%Y-%m-%d %H:%M:%S %z\")\n end\n end",
"def render_events(events)\n output = ''\n last_date = Date.parse('1970-1-1')\n events.each do |event|\n \n week, calendar_page = '',''\n \n unless last_date.strftime('%W') == event.start_date.strftime('%W')\n week = render_week(event.start_date)\n end\n unless last_date.day == event.start_date.day\n calendar_page = render_calendar_page(event.start_date)\n end\n \n output += render(:partial => 'events/event',:locals => {:event=>event, :week=>week, :calendar_page=>calendar_page})\n \n last_date = event.start_date\n \n end\n output\n end",
"def get_events\t\t\t\n @task = UserEvent.where(\"user_id\"=>current_user.id)\n events = []\n @task.each do |task|\n events << {:id => task.id, :title => task.title, :start => DateTime.parse(task.start.to_s).strftime(\"%Y-%m-%d\"), :end => DateTime.parse(task.end.to_s).strftime(\"%Y-%m-%d\") }\n end\n render :text => events.to_json \n end",
"def show\n @calendar = Calendar.find(params[:id])\n\t\n\tcalendarWithMaxId = Calendar.find(:last, :select => \"id\")\n\tcalendarMaxId = calendarWithMaxId.id\n\t@hashArray = Array.new()\n\tt = Time.now\n\n\t1.upto(calendarMaxId) do |o|\n\t\n events1 = Event.find(:all, :select => \"title\", :conditions => [\"calendar_id = ?\", o])\n events2 = Event.find(:all, :select => \"title, description, start_on, calendar_id, id\", :conditions => [\"calendar_id = ?\", o])\n\n\t hashH = Hash.new() # Main Hash\n\t\n\t if events1.empty? # calendar number ... has no events\n\t @hashArray.push(hashH) # push empty Hash\n\t else\n\t j = 0\n loop{\n\t if events2[j].start_on.nil? || events2[j].title.nil? # do not include events without a date into calendar\n\t gru=\"ja\"\n\t\t elsif events2[j].start_on.month == t.month # include only events from the actual month into calendar\n\t if hashH.has_key?(events2[j].start_on.day) # check if another event is already taking place on that date\n\t hilfe = events2[j].start_on.day\n\t x = hashH[hilfe]\n\t\t y = (help.link_to events2[j].title, calendar_event_path(:calendar_id => (events2[j].calendar_id), :id => events2[j].id)) \n\t hashN = {(events2[j].start_on.day) => (x + y)} # merge events \n\t else \n\t\t input = events2[j].title\n\t\t\t input = input.gsub( /[<>(){}\\/\\\\]/,'')\n\t\t hashN = {(events2[j].start_on.day) => (help.link_to input, calendar_event_path(:calendar_id => (events2[j].calendar_id), :id => events2[j].id))}\n\t end\n\t hashH.merge!(hashN)\n\t\t else\n\t end\n\t \n\t j+=1\n\t break if j == events1.size\n } \n\t @hashArray.push(hashH)\n\t end\t \n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def get_events\n @doc.css(\"#cal-event-entry\")\n end",
"def events\n end",
"def call(events)\n events.each { |event| Rails.configuration.gcal_service.insert_event('primary', event) }\n\tend",
"def index\n\t\t@allevents = Event.all #not needed but spec refuses to work because html response looks for events with strange dates\n @events = Event.where([\"startDate >= :start AND endDate <= :end\", {:start=>Time.at(params[:start].to_i).to_formatted_s(:db), :end=>Time.at(params[:end].to_i).to_s(format = :db) }])\n \n\t\teventsArray = [] \n @events.each do |event|\n if current_user\n eventsArray << {:id => event.id,:allDay => event.all_day, :editable => true, :title => \"#{event.supporter.name}\", :start => \"#{event.startDate.to_s + \" \" + event.startTime.to_s[11..18]}\", :end => \"#{event.endDate.to_s + \" \" + event.endTime.to_s[11..18]}\", :className => \"#{event.supporter.role}\"}\n else\n eventsArray << {:id => event.id,:allDay => event.all_day, :title => \"#{event.supporter.name}\", :start => \"#{event.startDate.to_s + \" \" + event.startTime.to_s[11..18]}\", :end => \"#{event.endDate.to_s + \" \" + event.endTime.to_s[11..18]}\", :className => \"#{event.supporter.role}\"}\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n\t\t\tformat.json { render :json => eventsArray }\n end\n end",
"def index\n @events = Event.upcoming.order(:start_time)\n @events_cal = Event.ical(@events) if params[:format] == 'ics'\n end",
"def index\n @calendars = Event.all\n end",
"def index\n set_upcoming_events\n respond_with @upcoming_events, each_serializer: Api::V1::CompactContractSerializer, :current_user => current_user\n end",
"def scrape_calendar\n begin\n objects = objects_from_event_api\n objects.select! {|o| DateTime.strptime(o['start'],'%Y-%m-%d') > DateTime.now }\n activities = objects_to_activities(objects)\n return process_calendar(activities)\n rescue Exception => e\n return format_error(e)\n end\n end",
"def event_all_new(events)\n raise NotImplementedError\n end",
"def process_all\n @events = []\n\n # Download and parse each of the files for all the seasons\n # and week ranges we need to process\n Config.read(\"seasons\").each do |season|\n Config.read(\"week_ranges\").each do |weeks|\n data = download(academic_year, season, weeks)\n parse(data)\n end\n end\n\n # Do nothing if saving to cache was not possible\n Cache.save(@course_id, @events) rescue nil\n\n init_calendar\n add_to_calendar(@events)\n end",
"def add_associated_events_to_days(events)\n each { |day| day.events = events.select { |event| event.start_date == day || (event.start_date < day && event.end_date >= day && day == first) } }\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 update_events\n # TODO: handle simple \"date\" in \"all day\" events\n google_updated_events = get_updated_events\n current_user.events.destroy_all\n if google_updated_events.length > 0\n google_updated_events.each do |event|\n new_event = current_user.events.find_or_create_by(g_id: event.id)\n new_event.update_attributes!({\n 'g_id' => event.id,\n 'summary' => event.summary,\n 'description' => event.description,\n 'start' => event.start ? event.start[\"dateTime\"] : nil,\n 'end' => event.end ? event.end[\"dateTime\"] : nil,\n 'location' => event.location\n })\n end\n end\n end",
"def index\n respond_to do |format|\n @events = event_finder\n @title = Radiant::Config['event_calendar.feed_title'] || \"#{Radiant::Config['admin.title']} Events\"\n @description = list_description\n @description = \"All future events\" if @description.blank?\n format.js {\n @venues = @events.map(&:event_venue).uniq\n @venue_events = {}\n @events.each do |e|\n @venue_events[e.event_venue.id] ||= []\n @venue_events[e.event_venue.id].push(e)\n end\n }\n format.rss {\n @version = params[:rss_version] || '2.0'\n @link = list_url\n }\n format.ics {\n headers[\"Content-disposition\"] = %{attachment; filename=\"#{list_filename}.ics\"}\n }\n end\n end",
"def set_tasks\n @events = current_user.events.all\n @tasks = current_user.tasks.all\n @task_grouping = @tasks.group_by {|t| t.event_id }\n @attendees = current_user.attendees.all\n if @event.present?\n @attendee_grouping = @event.attendees.order(\"response ASC\").group_by {|a| a.response }\n end\n \n @latest_events = @events.order(\"starts DESC\").first(60)\n\n @events.each do |event|\n task = Task.find_by(event_id: event.gid)\n if task.present?\n task.event_title = event.title\n task.save!\n end\n end\n end",
"def events_feed\n @group = Group.find_by(id: params[:id]) || not_found\n not_found unless @group.status?\n raise 'NotGroupMember' unless @group.member?(current_user)\n @events = @group.events.confirmed.by_date\n\n feed = []\n @events.each do |event|\n next if event.date_tba == true\n event_link = url_for(\n controller: 'events', action: 'show', group_id: @group.id,\n id: event.id\n )\n feed << {\n date: event.start_time.strftime('%Y-%m-%d'),\n title: \"#{event.time != '' ? event.time : 'TBA'} - #{event.event_name}\",\n url: event_link,\n ticket_stats: event.ticket_stats(@group, current_user)\n }\n end\n render json: feed\n end",
"def event_all_new(events)\n event_all(events.stack, events.all.first.id)\n end",
"def event_all_new(events)\n event_all(events.stack, events.all.first.id)\n end",
"def event_list\n @_events\n end",
"def events\n results = @cal_service.list_events(\n @calendar_id,\n order_by: 'startTime',\n q: 'LIVE',\n single_events: true,\n time_max: (DateTime.now + 7).to_s,\n time_min: DateTime.now.to_s,\n fields: 'items(start,end,summary)',\n )\n\n results.data.items.map do |event|\n summary = event.summary.gsub(/^LIVE:\\s+/, '')\n CalendarEvent.new(summary, event.start.date_time, event.end.date_time)\n end\n end",
"def event_list\n @custom_event = Custom_event.find(params[:id])\n end",
"def each(&block)\n events.each(&block)\n end",
"def update_from_google\n @calendars.each do |google_event|\n event = Event.find_by(gid: google_event.id)\n # Update existing event with updated Calendar info\n if event.present?\n event.title = google_event.summary\n event.description = google_event.description\n event.hangout_link = google_event.hangout_link\n event.starts = google_event.start.date_time\n event.ends = google_event.end.date_time\n if google_event.organizer.display_name == nil \n event.creator = google_event.organizer.email\n else\n event.creator = google_event.organizer.display_name\n end\n event.location = google_event.location\n google_category = google_event.summary.downcase\n if [\"1:1\", \"1-to-1\", \"one-to-one\"].include? google_category\n event.category = \"1:1\"\n elsif [\"standup\", \"stand-up\", \"stand up\", \"check-in\", \"check in\"].include? google_category \n event.category = \"check-in\"\n else\n event.category = \"general\"\n end\n event.save!\n # Update attendees list\n if google_event.attendees != nil\n google_event.attendees.each do |google_attendee|\n attendee = Attendee.find_by(email: google_attendee.email, event_id: google_event.id)\n if attendee.present?\n attendee.email = google_attendee.email\n attendee.name = google_attendee.display_name\n attendee.response = google_attendee.response_status\n attendee.save!\n else\n new_attendee = Attendee.new\n new_attendee.event_id = google_event.id\n new_attendee.gid = google_attendee.id\n new_attendee.email = google_attendee.email\n new_attendee.name = google_attendee.display_name\n new_attendee.organizer = google_attendee.organizer\n new_attendee.response = google_attendee.response_status\n new_attendee.save!\n end\n end\n end\n # Create a new event in case this doesn't exist yet\n else\n if google_event.start.date_time != nil\n new_event = current_user.events.new\n new_event.gid = google_event.id\n new_event.title = google_event.summary\n new_event.description = google_event.description\n new_event.hangout_link = google_event.hangout_link\n new_event.starts = google_event.start.date_time\n new_event.ends = google_event.end.date_time\n if google_event.organizer.display_name == nil\n new_event.creator = google_event.organizer.email\n else\n new_event.creator = google_event.organizer.display_name\n end\n new_event.location = google_event.location\n google_category = google_event.summary.downcase\n if [\"1:1\", \"1-to-1\", \"one-to-one\"].include? google_category\n new_event.category = \"1:1 meeting\"\n elsif [\"standup\", \"stand-up\", \"stand up\", \"check-in\", \"check in\"].include? google_category\n new_event.category = \"Check-in / Stand-up\"\n else\n new_event.category = \"General\"\n end\n new_event.save!\n end\n # Create attendees list\n if google_event.attendees != nil\n google_event.attendees.each do |google_attendee|\n new_attendee = Attendee.new\n new_attendee.event_id = google_event.id\n new_attendee.gid = google_attendee.id\n new_attendee.email = google_attendee.email\n new_attendee.name = google_attendee.display_name\n new_attendee.organizer = google_attendee.organizer\n new_attendee.response = google_attendee.response_status\n new_attendee.save!\n end\n end\n end\n end\n end",
"def process_events(events)\n @card_events = events.select(&:card?) \n events \n end",
"def events_for_venue\n @events = []\n\n if params[:venue_id]\n @events = Event.where(venue_id: params[:venue_id]).eager_load(:dates).merge(EventDate.not_finished)\n end\n\n end",
"def all_day_events\n w = (90.0/num_days).to_i\n rows = []\n (1..(@all_day_max)).each do |row|\n cols = []\n c1 = content_tag :td, :width => \"8%\", :colspan => \"2\", \n :class => \"day_header\" do\n '' \n end\n cols << c1\n (0..(num_days-1)).each do |day|\n if @events_all_day[day].size >= row\n event = @events_all_day[day][row-1]\n col = content_tag :td, \n :height => \"15px\",\n :overflow => \"hidden\",\n :style => \"width: #{w}%\", :width => \"#{w}%\",\n :class => \"day_appointment \" + calb_class(event.calendar, user) do\n content_tag :a, :href => \"/events/#{event.id}/edit\", \n :title => \"#{event.title}\",\n :data => {:toggle => \"popover\", \n :content => \"#{event.where}#{event.when}#{event.my_notes}\",\n :html => \"true\",\n :trigger => \"hover\",\n :placement => \"left\",\n :remote => true },\n :class => \"event-popover\" do\n content_tag :div, :class => \"hide_extra\" do\n self.event_day_text(event,1)\n end\n end\n end\n else\n col = content_tag :td, \n :max => {:height => \"15px\"},\n :style => \"width: #{w}%\", :width => \"#{w}%\",\n :class => \"day_free_time\" do\n ''\n end\n end\n cols << col\n end\n row = content_tag :tr do\n cols.join.html_safe\n end\n rows << row\n end\n rows.join.html_safe\n end",
"def displayEvents\n events = self.getAllEvents\n s = \"List of events\\n\\n\"\n events.each do |sportname, sport|\n s << \"\\t\\t\" << sportname << \"\\n\"\n sport.each do |eventID, event|\n s << event.toString << \"---\\n\"\n end\n end\n s\n end",
"def show\n @events = fetch_events\n end",
"def index\n respond_with(events) do |format|\n format.ics { send_data(events_as_ical, filename: \"#{current_user.username}-#{current_instance.subdomain}-calendar.ics\", type: Mime::Type.lookup_by_extension('ics')) }\n format.json { render json: fullcalendar_events_json }\n end\n end",
"def main_calendar\n if params[:id]\n @time_now = \"#{params[:id]}\"\n else\n @time_now = \"#{Time.now.strftime('%Y-%m-%d')}\"\n end\n \n selection = DateTime.strptime(\"#{@time_now}T00:00:00+00:00\") \n\n prev_month = selection.advance :months => -1\n next_month = selection.advance :months => 1\n\n calendar( :month => selection.strftime(\"%m\").to_i,\n #:month => params[:mo].to_i,\n :year => selection.strftime(\"%Y\").to_i,\n :show_today => true,\n :previous_month_text => (link_to \"#{image_tag '/images/left_arrow.gif', :alt => 'Previous Month'}\", \"#{prev_month.strftime('%Y-%m-%d')}\"),\n :next_month_text => (link_to \"#{image_tag '/images/right_arrow.gif', :alt => 'Next Month'}\", \"#{next_month.strftime('%Y-%m-%d')}\")) do |d|\n\n cell_text = \"<p class=\\\"num\\\">#{d.mday}</p><br />\"\n cell_attrs = {:class => 'day'}\n @events.each do |e|\n if ((e.start_date.year == d.year) && (e.start_date.month == d.month) && (e.start_date.day == d.day)) || ( e.start_date <= d && e.end_date >= d )\n cell_attrs[:class] = 'specialDay' \n cell_text += link_to \"#{e.event}\", \"/calendars/show/#{e.id}\", :rel => 'facebox', :class => \"text\"\n cell_text += \"<br />\"\n end\n end\n [cell_text, cell_attrs]\n end\n end",
"def add_to_calendar(events)\n events.each do |event|\n @cal.add_event(event) unless should_ignore(event)\n end\n end",
"def set_calendar\n @calendar = Hash.new {|h, date| h[date] = Array.new}\n\n # Itera sobre cada evento y lo añade en la fecha en que se celebra si es que no está ya metido\n # EventDecorator.decorate_collection(events).each do |event|\n events.each do |event|\n unless @calendar[event.date].include? event\n @calendar[event.date] << event\n end\n end\n\n @calendar = @calendar.sort.to_h\n end",
"def index\n @list_events = Event.all\n @list_past_events = Array.new\n @list_future_events = Array.new\n @list_events.each do |event|\n if (event.date - Time.now > 0)\n # la date de l'évènement est future\n @list_future_events.push(event)\n else\n @list_past_events.push(event)\n end\n end\n end",
"def download_events(apiEngine)\n @events = []\n results = []\n results = apiEngine.client.execute!(\n :api_method => apiEngine.api.events.list,\n :parameters => {\n :calendarId => @ident,\n :singleEvents => true,\n :orderBy => 'startTime',\n :timeMin => @dateMin.iso8601,\n :timeMax => @dateMax.iso8601 })\n\n results.data.items.each do |event|\n if event.start.date_time\n fulldate = event.start.date_time.strftime(\"%B, %d, %Y\")\n month = fulldate.split(',')[0]\n day = fulldate.split(',')[1]\n year = fulldate.split(',')[2]\n else\n fulldate = event.start.date.to_s\n month = fulldate.split('-')[1].to_i\n month = I18n.t(\"date.month_names\")[month]\n day = fulldate.split('-')[2]\n year = fulldate.split('-')[0]\n end\n @events.push(Event.new(event.creator.email, year, month, day, :summary => event.summary))\n end\n end",
"def get_events\n events = [] \n @log ||= Rails.logger\n Appsterdam::Application.ical_subscriptions.each do |options|\n @log.info \"getting events from #{options[:url]}\"\n components = parse_ical(options[:url])\n events.concat(extract_events(components.first))\n end\n @log.info \"done importing iCal events.\"\n \n events\n end",
"def events\n results = @client.execute(\n :api_method => @calendar.events.list,\n :authenticated => false,\n :parameters => {\n 'calendarId' => @config[:calendar_id],\n 'fields' => 'items(start,end,summary)',\n 'singleEvents' => true,\n 'orderBy' => 'startTime',\n 'timeMin' => DateTime.now.to_s,\n 'timeMax' => (DateTime.now + 7).to_s,\n 'q' => 'LIVE'\n }\n )\n\n results.data.items.map do |event|\n summary = event.summary.gsub(/^LIVE:\\s+/, '')\n CalendarEvent.new(summary, event.start.date_time, event.end.date_time)\n end\n end",
"def draw_day_events(date, events)\n events.select { |e| e.start_time.to_date == date }\n end",
"def calendars\n if @event.travels_done?\n if current_user.expired == 1\n render :nothing => true, :status => :unauthorized\n else\n render :json => @event.to_json, :status => :ok\n end\n elsif @event.canceled?\n render :nothing => true, :status => :gone\n else\n render :nothing => true, :status => :not_found\n end\n end",
"def listOfEvents\r\n puts (@BetESS.fDisplayEvents)\r\n end",
"def index\n #@event_days = EventDay.all\n @event_days = Event.find(params[:event_id]).event_days\n end",
"def event_list\n events_list\n end",
"def fullcalendarify\n\t\t{\n\t\t\tid: id,\n\t\t\tstart: start_date.iso8601,\n\t\t\tend: end_date.iso8601,\n\t\t\ttitle: title + (showtime ? \"\\n#{start_date.strftime \"%l:%M %p\"} - #{end_date.strftime \"%l:%M %p\"}\" : \"\"),\n\t\t\turl: \"/events/#{id}\",\n\t\t\tcolor: color\n\t\t}\n\tend",
"def index\n @events = @calendar.events.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def calendar_events(calendar_id)\n records \"/calendars/#{calendar_id}/calendar_events.xml\", :method => :get\n end",
"def index\n\t\t#@events = Event.all //by default it loads everything\n\tend",
"def send_events; end",
"def set_event\n year_ids = params[:date][:year] unless params[:date].nil?\n @events = Event.where(privacy:\"f\").order(\"date_begin DESC\").search(year_ids).page(params[:page]).per(10)\n @categories = Category.all\n @departments = Department.all\n end",
"def events\n event_lookup()\n end",
"def events\n event_lookup()\n end",
"def events\r\n load_private_events\r\n load_completed_private_events\r\n end",
"def index\n @calendar_events = CalendarEvent.page(params[:page])\n end",
"def events_for_objects(calendar_events)\n groups = calendar_events.group_by { |r| r.attributes.slice(*GROUP_ATTRIBS) }\n groups.map do |_, members|\n Event.new(basic_event_attribs(members[0]).merge(\n location: members.map(&:location_name).join(\" + \")\n ))\n end\n end",
"def index\n @month_now = (Time.zone || Time).now.month.to_i\n @year_now = (Time.zone || Time).now.year.to_i\n @month = (params[:month] || (Time.zone || Time).now.month).to_i\n @year = (params[:year] || (Time.zone || Time).now.year).to_i\n @day = (params[:day] || (Time.zone || Time).now.day).to_i\n @last_month_start = Date.new(@year_now, @month_now-1).to_time\n @month_start = Date.new(@year, @month).to_time\n @month_end = Date.new(@year, @month+1).to_time\n @next_year_end = Date.new(@year_now+2, 1).to_time\n\n @shown_month = Date.civil(@year, @month)\n\n @events = Event.where(\"end_at BETWEEN :month_start AND :month_end OR start_at BETWEEN :month_start AND :month_end\", {:month_start => @month_start, :month_end => @month_end})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n\t \tformat.ics do\n\t\t\t\tsend_data(\texport_ical_range(@last_month_start,@next_year_end).export,\n\t\t\t\t\t\t\t\t\t\t:filename=>\"reisebuero_events.ics\",\n\t\t\t\t\t\t\t\t\t\t:disposition=>\"inline; filename=reisebuero_events.ics\",\n\t\t\t\t\t\t\t\t\t\t:type=>\"text/calendar\")\n\t\t\tend\n end\n end",
"def show\n# @event.create_eventbrite_registrations\n# @eventbrite_event = @event.show_eventbrite_event\n# @orders = @event.orders[\"orders\"]\n# @attendees = @event.attendees[\"attendees\"]\n\n end",
"def show_events\n @event_list.each do |restaurant, diners|\n print restaurant, diners\n end\n @event_list\n end",
"def get_appts\n @user = current_user\n @appointments = @user.appointments.actual.includes(:status, :address, :assignments, {:subscription => :subscriptionable}, :employees, :team)\n # filter by the datetime object via params from fullcalendar\n filter_show = ActiveSupport::JSON.decode(params[:filter_show])\n appointments_in_range = @appointments.where(\"appointments.start_time >= :start_time AND appointments.start_time <= :end_time\", {:start_time => Time.at(params['start'].to_i), :end_time => Time.at(params['end'].to_i)} )\n events = []\n appointments_in_range.each do |appointment|\n if appointment_is_allowed?(appointment, filter_show)\n customer = appointment.subscription.subscriptionable\n eventHash = {:id => appointment.id, :title => calendar_title(appointment, customer), :start => \"#{appointment.start_time.iso8601}\", :end => \"#{appointment.end_time.iso8601}\", :allDay => false, :recurring => appointment.subscription.repeat }\n\n eventHash[:backgroundColor] = event_background_color(appointment, params[:event_color])\n eventHash[:borderColor] = eventHash[:backgroundColor]\n\n events << eventHash\n # optional day view\n #events << {:id => event.id, :title => @customer_name, :url => \"/appointments/\"+event.id.to_s+\"/edit\", :description => \"Description here\", :start => \"#{event.start_time.iso8601}\", :end => \"#{event.end_time.iso8601}\", :allDay => true}\n end\n end\n render :json => events\n end",
"def venue_events venue_id\n response = get(\"/venues/#{venue_id}/events\")[\"response\"]\n @events = response[\"events\"]\n @events[\"items\"].map!{|item| Foursquared::Response::Event.new(self, item)}\n @events\n end",
"def fGetAllEvents\n @sports.getAllEvents\n end",
"def my_events\n @events = []\n Event.all.each do |event|\n if (event.creator == current_user.id)\n @events << event\n end\n end\n end",
"def events=(_); end",
"def index\n @created_events = current_user.created_events\n @invited_events = current_user.invited_events\n @attending_events = current_user.attending_events\n end",
"def get_next_calendar_events\n next_events = JSON.parse search_for_future_calendar_events\n next_events[\"items\"]\n end",
"def found_events\n @mood.events\n end",
"def index\n if @event != nil\n @event_dates = @event.event_dates.all\n else\n @event_dates = EventDate.all\n end\n end",
"def render_events(events)\n respond_to do |format|\n format.html # *.html.erb\n format.kml # *.kml.erb\n format.ics { ical_export(yield_events(events)) }\n format.atom { render :template => 'events/index' }\n format.xml { render :xml => yield_events(events).to_xml(:include => :venue) }\n format.json { render :json => yield_events(events).to_json(:include => :venue), :callback => params[:callback] }\n end\n end",
"def index\n @events = Event.all\n\n # Past Events that you and your friends held\n # 4 events with seed file and user 9\n @past_events = @events.select do |event|\n event.date < DateTime.now\n end\n\n # Current Events that you created\n @my_events = @events.select do |event|\n event.date >= DateTime.now && event.creator_id == current_user.id\n end\n\n # Current Events that you are attending\n @attending_events = UserEvent.joins(:event).where(\"user_id == :current_user AND events.date >= :current_event_date\",\n {current_user: current_user.id, current_event_date: DateTime.now})\n\n # All the current events you are involved in\n # 4 events with seed file and user 9\n @all_attending_events = @my_events + user_events(@attending_events)\n\n # Friend made events show all events not created by you\n @friend_made_events = @events.select do |event|\n event.date >= DateTime.now && event.creator_id != current_user.id\n end\n\n # Events made by your friends, where you are not attending\n # 3 events with seed file and user 9\n @friend_events = @friend_made_events - user_events(@attending_events)\n end",
"def update_global_common_events\n end",
"def load_events\r\n @events = Event.find(:all, \r\n :conditions => [\"user_id = \"\\\r\n \"#{session[:user_id]} and (begins >= CURRENT_DATE()\"\\\r\n \"or ends >= CURRENT_DATE())\"] ,\r\n :order => 'begins ASC')\r\n end",
"def index\n\t\t@events = Event.all\n\tend",
"def index\n\t\t@events = Event.all\n\tend",
"def set_event_items\n @event = Event.find(params[:event_id])\n end",
"def _convert_events(events)\n g_events = []\n events.each do |event|\n source = Google::Apis::CalendarV3::Event::Source.new(\n title: @cfg['calendar']['eventSource']['title'],\n url: @cfg['calendar']['eventSource']['url'],\n )\n g_event = Google::Apis::CalendarV3::Event.new(\n summary: event[:summary],\n location: event[:location],\n description: event[:description],\n start: _convert_to_calendar_time(event[:time]),\n end: _convert_to_calendar_time(event[:ends]),\n source: source,\n )\n g_events << g_event\n end\n g_events\n end",
"def index\n # todo implement search and sort and paginate\n @events = Legacy::LegacyEvent.order(\"created_date DESC\").paginate(:page => params[:page])\n end",
"def index\n\t@events = @calendar.events(:order => 'created_at ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end",
"def index\n if (Time.now - @@last_gcalendar_update).to_i > 3600\n Thread::start do\n load_events_from_calendar(\"/calendar/ical/enkarplan.org_j2njaqb2eapip42l32br00afgo%40group.calendar.google.com/public/basic.ics\")\n \n load_events_from_calendar(\"/calendar/ical/enkarplan.org_bhfbtue1pklla91t4u97m9ggno%40group.calendar.google.com/public/basic.ics\")\n \n load_events_from_calendar(\"/calendar/ical/enkarplan.org_5up3mopev5gkg9k17rcijrj0p4%40group.calendar.google.com/public/basic.ics\")\n end\n end\n \n if params[:near]\n near = params[:near].split(',')\n latitude = near[0].to_f\n longitude = near[1].to_f\n \n params[:page] = params[:page] || 0\n params[:limit] = params[:limit] || 10\n \n @pois = Poi.find_by_sql [\"select *, abs(latitude-(?))+abs(longitude-(?)) as 'distance' from pois order by distance asc limit ?, ?;\", latitude, longitude, (params[:page].to_i - 1) * params[:limit].to_i, params[:limit].to_i]\n else\n @pois = Poi.order('created_at desc').page(params[:page]).per(params[:limit] || 10) \n end\n \n if params[:type]\n @pois = @pois.where('poi_type_id = ?', params[:type])\n end\n \n if params[:search]\n search = \"%\" + params[:search].sub(\" \", \"%\") + \"%\"\n @pois = @pois.where('title like ? OR title_eu like ?', search, search)\n end\n \n @verfied = Poi.where('is_verified = ?', true)\n @top_pois = Poi.order('rating desc').limit(4)\n @last_pois = Poi.order('created_at desc').limit(4)\n @next_events = Event.where('ends_at > ?', Time.now).order('starts_at asc').limit(8)\n @last_photos = Photo.where(is_visible_on_index: true).order('created_at desc').limit(8)\n @last_comments = Comment.order('created_at desc').limit(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pois }\n end\n end",
"def add_event(doc, n, *args)\r\n# p 'Add event ' + args[1][0..199]\r\n new_event = CalendarEvent.find_or_initialize_by_pageextsourceID(:pageextsourceID => doc.xpath(\"//item//id\")[n].text, \r\n :event_type => 'ce', :event_title => args[1][0..199],\r\n :cbody => doc.xpath(\"//item//description\")[n].text, \r\n :postdate => DateTime.parse(doc.xpath(\"//item//pubDate\")[n].text),\r\n :eventstartdate => args[2], :eventstarttime => args[2], :eventenddate => args[3], :eventendtime => args[3],\r\n :contentsourceURL => args[5][0..99], \r\n :location => doc.xpath(\"//item//xCal:location\")[n].text,\r\n :mapplacename => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-venue-name\")[n].text[0..59],\r\n :mapstreet => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-street\")[n].text[0..39],\r\n :mapcity => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-city\")[n].text[0..39],\r\n :mapstate => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-region\")[n].text[0..24],\r\n :mapzip => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-postalcode\")[n].text[0..9],\r\n :mapcountry => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-country\")[n].text[0..39],\r\n :contactphone => doc.xpath(\"//item//phone\")[n].text[0..14],\r\n :contentsourceID => args[4], :localGMToffset => args[6], :endGMToffset => args[6],\r\n :subscriptionsourceID => args[4]) \r\n new_event.longitude, new_event.latitude = doc.xpath(\"//item//geo:long\")[n].text.to_f, doc.xpath(\"//item//geo:lat\")[n].text.to_f \r\n new_event.imagelink = doc.xpath(\"//item//images//url\")[n].text rescue nil\r\n new_event.save(:validate=>false)\r\n end"
] | [
"0.68089354",
"0.66351753",
"0.6625511",
"0.6571208",
"0.6562682",
"0.65499276",
"0.6546111",
"0.65309846",
"0.64745647",
"0.6468685",
"0.63850963",
"0.6361785",
"0.63551205",
"0.63305944",
"0.63158315",
"0.62972516",
"0.6290232",
"0.6279823",
"0.62779874",
"0.6269341",
"0.625109",
"0.6234876",
"0.62299186",
"0.62008226",
"0.61884815",
"0.61799425",
"0.6175673",
"0.6168693",
"0.6164379",
"0.61627644",
"0.61627644",
"0.61627644",
"0.61627644",
"0.61627644",
"0.61627644",
"0.61627644",
"0.61627644",
"0.614514",
"0.61423534",
"0.6133645",
"0.61330736",
"0.61305285",
"0.61305285",
"0.61291957",
"0.6119179",
"0.6114709",
"0.61079204",
"0.61071736",
"0.61060035",
"0.6099215",
"0.6097979",
"0.60845244",
"0.6074234",
"0.6071056",
"0.60621125",
"0.6052021",
"0.6046914",
"0.6039136",
"0.60214585",
"0.60139936",
"0.5995042",
"0.59589005",
"0.5940769",
"0.5933844",
"0.59320176",
"0.5929235",
"0.59282744",
"0.59175265",
"0.59151787",
"0.59125745",
"0.59081966",
"0.5905803",
"0.59014827",
"0.59014827",
"0.5893182",
"0.5892819",
"0.58870554",
"0.58845466",
"0.58807653",
"0.58701706",
"0.58684254",
"0.5866779",
"0.58631223",
"0.5863039",
"0.5862772",
"0.58599097",
"0.58595145",
"0.58529073",
"0.5850681",
"0.5839777",
"0.5838825",
"0.5838115",
"0.5835848",
"0.58344126",
"0.58344126",
"0.58316135",
"0.5827962",
"0.582676",
"0.58263934",
"0.5822745",
"0.5817206"
] | 0.0 | -1 |
GET /time/time_reports GET /time/time_reports.json | def index
@time_time_reports = Time::TimeReport.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_report }\n end\n end",
"def index\n @timecharts = Timechart.find(:all, order: \"stop_time DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timecharts }\n end\n end",
"def index\n @timesheets = Timesheet.all\n render json: @timesheets\n end",
"def index\n @timecards = TimeCard.all\n render :json => @timecards.to_json(:include => :time_entry), status: :ok\n end",
"def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end",
"def new\n @time_report = TimeReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_report }\n end\n end",
"def index\n if params[:date].present?\n begin\n @date = Date.parse(params[:date])\n rescue => e\n Rails.logger.debug [e.class, e.message].join(' ')\n end\n end\n\n @date ||= (Report.latest_date.presence || Date.today)\n @reports = Report.date(@date).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end",
"def index\n @service_times = ServiceTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_times }\n end\n end",
"def report\n\n @startD = params[:start].to_time\n @endD = params[:end].to_time \n \n\n #grab all MemberMonthReports which fall within date constraints\n @reports = MemberMonthReport.\n where('? <= start_date and start_date <= ?', @startD, @endD).\n reorder(:start_date, :member_id)\n \n respond_to do |format|\n format.html # report.html.erb\n format.json { render json: @time_entries }\n end\n end",
"def download_report(name, request_time, format)\n response = @client.get('arborws/reports/configured',\n api_key: @api_key, name: name,\n request_time: request_time, format: format)\n\n response\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def index\n @timings = Timing.all\n end",
"def index\n @tea_times = TeaTime.all\n respond_to do |format|\n format.html { render layout: !request.xhr? }\n format.json { render json: @tea_times }\n end\n end",
"def index\n parse_conditions\n\n @time_records = []\n\n if @user\n @project_time_record_grid = initialize_grid(TimeRecord.where(user_id: @user.id, type: TimeRecord.name).group(:project_id))\n @time_records = TimeRecord.where(@conditions.merge(type: TimeRecord.name))\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_records.to_json }\n end\n end",
"def set_time_time_report\n @time_time_report = Time::TimeReport.find(params[:id])\n end",
"def reports_schedule\n \n @schedule = ReportSchedule.find(params[:schedule_id])\n \n respond_to do |format|\n format.html\n format.json { render json: @schedule }\n end\n end",
"def index\n if params[:report_id]\n @transfer_slips = TransferSlip.where([\"report_id = ?\", params[:report_id]]).all\n @report = Report.find(params[:report_id])\n elsif params[:year] && params[:month] && params[:day]\n @transfer_slips = TransferSlip.where([\"user_id = ? AND date = ?\", current_user.id, \"#{params[:year]}-#{params[:month]}-#{params[:day]}\"])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transfer_slips }\n end\n end",
"def list\n @reports_fetch = Report.all\n @reports = []\n\n @reports_fetch.each do |report|\n @reports << report if current_user == report.submitter\n end\n\n render status: 200, json: @reports.as_json(methods: [:url_title_string, :report_time_ms], include: { report_status_type: {}, report_type: {}, specified_submit_to_role: {} })\n end",
"def index\n @timelogs = Timelog.all\n end",
"def index\n @timetables = Timetable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timetables }\n end\n end",
"def show\n @timechart = Timechart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timechart }\n end\n end",
"def show\n @timesheets = @payroll.timesheets.includes(:payroll, :user)\n reports_data([@payroll])\n end",
"def show\n reports = Hash.new \n hours_trackers = HoursTracker.where(report_id: params[:report_id]) \n HoursTracker.where(report_id: params[:report_id]).find_each do |hours_tracker|\n Report.add_hours_tracked(hours_tracker)\n end\n @reports = Report.generate_report\n end",
"def index\n respond_to do |format|\n format.html\n format.json {\n\n render :json => TimeOff.joins('LEFT OUTER JOIN request_types ON time_offs.request_type_id = request_types.id')\n .joins('INNER JOIN users ON time_offs.user_id = users.id')\n .select(\n 'time_offs.id,\n time_offs.request_start_date,\n time_offs.request_end_date,\n time_offs.status,\n time_offs.comments,\n users.name as users_name,\n request_types.name as request_type_name') }\n end\n end",
"def index\n @timesheet_entries = TimesheetEntry.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timesheet_entries }\n end\n end",
"def index\n @hours = Hour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hours }\n end\n end",
"def show\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_log }\n end\n end",
"def index\n @ticket_times = TicketTime.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticket_times }\n end\n end",
"def index\n @timers = Timer.all\n\n render json: @timers\n end",
"def hours\n render json: Pings::Selector.new.hours(params)\n end",
"def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end",
"def index\n @reporting_periods = ReportingPeriod.order(date: :desc)\n .includes(:full_reports).page params[:page]\n @data = ::Api::Charts::ReportingPeriod.new(@reporting_periods)\n .reporting_periods_cost_data\n end",
"def query_times_graphs\n controller = params[:controller_name]\n action = params[:action_name]\n data = redis(logger: true).zrangebyscore(\"request_timings/total/by_action/#{controller}##{action}\",\n 1.month.ago.to_i, '+inf',\n with_scores: true)\n .map { |y, x| [x.to_f, y.to_f] }\n throw 'No Data' if data.nil? || data.empty?\n smoothed = moving_avg(data)\n final = (params[:raw].present? ? data : smoothed).map { |x, y| [Time.at(x.to_i).to_datetime, y] }\n render json: [\n { name: 'Timings', data: final }\n ]\n end",
"def create\n\n @time_time_report = Time::TimeReport.new(time_time_report_params)\n\n respond_to do |format|\n if @time_time_report.save\n format.html { redirect_to @time_time_report, notice: 'Time report was successfully created.' }\n format.json { render :show, status: :created, location: @time_time_report }\n else\n format.html { render :new }\n format.json { render json: @time_time_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end",
"def reports\n\n \t if params[\"from_date\"].present? and params[\"to_date\"].present?\n @date=params[:from_date]\n @data=JSON.parse RestClient.get $api_service+\"/claims/data_report?from_date=#{params[\"from_date\"]}&to_date=#{params[\"to_date\"]}\"\n elsif params[:date]\n @data=JSON.parse RestClient.get $api_service+\"/claims/data_report?from_date=#{params[\"date\"]}&to_date=#{params[\"date\"]}\"\n @date=params[:date]\n else \n @date=Date.today \n @data=JSON.parse RestClient.get $api_service+'/claims/data_report'\n end\n\n end",
"def index\n @time_lines = TimeLine.all\n end",
"def index\n @entries = @time_sheet.entries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def reports_schedule_detail\n @reports = ReportSchedule.find(params[:schedule_id]).reports.order(:id).reverse[0..50]\n\n respond_to do |format|\n format.json { render json: @reports} \n end\n end",
"def index\n date_range = unix_date(params[:date])\n @timeslots = Timeslot.where('start_time >= ? and start_time <= ?', date_range[:beginning_of_day], date_range[:end_of_day])\n # render :json => @timeslots.as_json(only: [])\n end",
"def index\n set_user\n @time_offs = TimeOff.all\n end",
"def my_reports\n @reports ||= Report.user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end",
"def index\n @time_entry ||= current_user.time_entries.build(\n :tdate => Date.today\n )\n \n @time_entries = current_firm.all_time_entries\n\n respond_to do |format|\n format.html { render :index }# index.html.erb\n format.json { render json: @time_entries }\n end\n end",
"def index\n @timecard = Timecard.find(params[:timecard_id])\n render :json => Hour.timecard_hours(@timecard)\n end",
"def index\n @poi_times = PoiTime.all\n end",
"def index\n @time_frames = TimeFrame.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_frames }\n end\n end",
"def index\n respond_to do |format|\n format.html { # index.html.erb\n @work_times = WorkTime.page params[:page]\n }\n format.xml { # index.xml.builder\n @work_times = WorkTime.all\n }\n format.json { render json: WorkTime.all }\n end\n end",
"def report\n\n # Limit access to authorized users\n authorize! :administer, current_user\n @users = User.all\n\n @fromTime = DateTime.strptime(params[:fromTime] + ' EDT', '%m-%d-%Y %T %Z') rescue DateTime.current.beginning_of_year\n @toTime = DateTime.strptime(params[:toTime] + ' EDT', '%m-%d-%Y %T %Z') rescue DateTime.current\n\n params[:fromTime] = @fromTime.strftime('%m-%d-%Y %T')\n params[:toTime] = @toTime.strftime('%m-%d-%Y %T')\n\n end",
"def index\n# @time_logs = TimeLog.all\n @time_logs = TimeLog.paginate :page => params[:page], :per_page => 10, :order => 'site_id'\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_logs }\n end\n end",
"def index\n @reports = Report.where(user_id: current_user.id, patient_id:@patient.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end",
"def get_all_report\n limit = 15\n begin\n if params.has_key? :last_iso_timestamp\n from_time = DateTime.iso8601 params[:last_iso_timestamp]\n\n items = Item.active_items.order('updated_at DESC').where(\"updated_at < ?\",from_time).limit(limit)\n else \n items = Item.active_items.order('updated_at DESC').limit(limit)\n end\n #return\n render json:{success:true, lost_and_found: items.take(limit)} \n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end",
"def get_data_for_time_span()\n set_schedule_query_params\n\n @t1 = Time.at(@t1.to_i)\n @t2 = Time.at(@t2.to_i)\n\n @rsrcs = @config.resource_list # ScheduledResource.resource_list\n\n @blockss = ScheduledResource.get_all_blocks(@config, @t1, @t2, @inc)\n\n json_adjustments\n end",
"def index\n @jobtimes = current_company.jobtimes.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml {render :xml => @jobtimes }\n format.json { render :json => @jobtimes }\n end\n end",
"def reports\n @node = resource\n @reports = params[:kind] == \"inspect\" ? @node.reports.inspections : @node.reports.applies\n respond_to do |format|\n format.html { @reports = paginate_scope(@reports); render 'reports/index' }\n end\n end",
"def index\n @log_hours = LogHour.all\n end",
"def schedule\n @schedules = ReportSchedule.all\n\n respond_to do |format|\n format.html\n format.json { render json: @schedules }\n end\n end",
"def time_trackings\n Easybill::Api::TimeTrackings\n end",
"def index\n @stage_id = params[:stage_id].present? ? params[:stage_id] : nil\n @classification = params[:class].present? ? params[:class] : nil\n @time_type = params[:type].present? ? params[:type] : nil\n if @time_type == '1'\n @stage_times = RallyEventStageTime.stage_times(@rally.id, @stage_id, @classification)\n else\n @stage_times = RallyEventStageTime.final_times(@rally.id, @stage_number, @stage_id, @classification)\n end\n end",
"def show\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @my_time_trial }\n end\n end",
"def index\n render json: {time: Time.now}\n end",
"def index\n @cal_times = CalTime.paginate(page: params[:page])\n end",
"def index\n @reporting = Reporting.without_status(:deleted).all\n @category = Reporting::CATEGORY_REPORTS\n\n puts @reporting.inspect\n puts @category.inspect\n\n respond_to do |format|\n format.html\n format.json { render json: @reporting }\n end\n end",
"def show\n @timesheet = Timesheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def show\n @timesheet = Timesheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def stats\n year = Analytic.where(\"created_at > ?\", Time.now - 1.year)\n @stats = time_data year\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(year, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(year, :hash) }\n end\n end",
"def report(id)\n get(\"reports/#{id}\")\n end",
"def all\n @timesheet_entries = TimesheetEntry.all\n\n respond_to do |format|\n format.html { render json: @timesheet_entries }\n format.json { render json: @timesheet_entries }\n end\n end",
"def index\n @time_sheets = TimeSheet.all\n end",
"def index\n @time_episodes = TimeEpisode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_episodes }\n end\n end",
"def show\n \n @report = Report.find(params[:id])\n\n # Filtering logic. See ApplicationHelper.trip_filters\n if params[:time_filter_type]\n @time_filter_type = params[:time_filter_type]\n else\n @time_filter_type = session[TIME_FILTER_TYPE_SESSION_KEY]\n end\n # if it is still not set use the default\n if @time_filter_type.nil?\n # default is to use the first time period filter in the TimeFilterHelper class\n @time_filter_type = \"0\"\n end\n # store it in the session\n session[TIME_FILTER_TYPE_SESSION_KEY] = @time_filter_type\n params[:time_filter_type] = @time_filter_type\n \n if @report\n \n # set up the report view\n @report_view = @report.view_name\n # get the class instance and generate the data\n report_instance = @report.class_name.constantize.new\n @data = report_instance.get_data(current_user, params)\n respond_to do |format|\n format.html\n end\n end\n end",
"def index\n @reports = Report.order(created_at: :desc).all\n end",
"def index\r\n @clocks = ClockResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @clocks }\r\n end\r\n end",
"def index\n @timesheets = Timesheet.all\n end",
"def index\n @regimes = Regime.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @regimes }\n # end\n end",
"def getReportableType\n @reports = Report.where(\"reportable_type = ?\", params[:reportable_type])\n render json: @reports\n end",
"def index\n @type_reports = TypeReport.all\n end",
"def reports(from_id, start_date = nil, end_date = nil)\n params = []\n\n if from_id\n params << \"from_id=#{from_id}\"\n end\n\n if start_date and not end_date\n raise 'must include both start_date and end_date'\n end\n if end_date and not start_date\n raise 'must include both start_date and end_date'\n end\n\n if start_date and end_date\n params << \"start_date=#{start_date.strftime('%FT%T.%L%z')}\"\n params << \"end_date=#{end_date.strftime('%FT%T.%L%z')}\"\n end\n\n query = \"#{@endpoint}?\"\n\n if params.size > 0\n query << params.join('&')\n end\n\n get query\n end",
"def index\n records = policy_scope(Record)\n if !params[:from] && !params[:from]\n records = Record.where(:user_id => @current_user.id)\n else\n records = Record.where(\"user_id = ? and created_at >= ? and created_at <= ?\", @current_user.id, params[:from], params[:to])\n end\n records = records.select(\"date(created_at) as created_date, sum(distance) as distance,sum(time) as time,(sum(distance) / sum(time)) as average_speed\").group(\"created_date\")\n render json:{ reports: records}\n\n end",
"def index\n authorize! :show, @sensor\n set_filter_dates\n set_granularity\n @records = @sensor.records.where(granularity: @granularity, created_at: @from..@to)\n\n respond_to do |format|\n format.html\n format.json { render json: @records }\n end\n end",
"def index\n if params[:hour] != nil && params[:hour].to_i > 0\n @tracked_data = TrackedDatum.where(updated_at: params[:hour].to_i.hours.ago..Time.now).all.order(:pageURL)\n else\n @tracked_data = TrackedDatum.all.order(:pageURL)\n end\n end",
"def index\n @time = Time.new\n @prev_time = @time - 1.month\n @next_time = @time + 1.month\n @months = [@prev_time, @time, @next_time]\n @month_time_format = \"%B %Y\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end",
"def index\n @et_reports = EtReport.all\n end",
"def show\n @time_track = TimeTrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_track }\n end\n end",
"def show\n @report = Rails.cache.fetch(\"reports/#{params[:id]}\", :expires_in => 1.week) do\n Report.without(:email).find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end",
"def show_user_reports\n reports = User.find(params[:id]).reports\n render :json => reports\n end",
"def show\n @breadcrumb = 'read'\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end",
"def get_time_entries(start_date=nil, end_date=nil)\n options = Hash.new\n options[\"start_date\"] = iso8601_date(start_date) if start_date\n options[\"end_date\"] = iso8601_date(end_date) if end_date\n get \"/time_entries\", options\n end",
"def get_report(api_key, client_api_id, interval, query = \"\")\n uri = URI(API_ENDPOINT) + URI.escape(\"?api_key=#{api_key}&client_api_id=#{client_api_id}&interval=#{interval}&query=#{query}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n raise \"Server returned error #{response.code} processing your API request\" if response.code != \"200\"\n JSON.parse(response.body)\nend",
"def view\n if params[:report_date].present? && params[:report_type].present?\n @report_contents = current_user.get_reports(params[:report_date], params[:report_type])\n else\n respond_to do |format|\n format.html { redirect_to current_user, method: :get, alert: 'Either report date or report type is empty' }\n format.json { render :show, status: :bad_request, location: @user }\n end\n end\n end",
"def hourly(query)\n get_json(\"#{api_url}/hourly/q/#{parse_query(query)}.#{@options[:format]}\")\n end",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"count_of_table_sid_by_field_sid\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = AccessReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def index\n @section_times = SectionTime.all\n end",
"def index\n @rescue_time_charts = RescueTimeChart.all\n end",
"def get_analytics_reporting_schedules_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsApi.get_analytics_reporting_schedules ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/analytics/reporting/schedules\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReportScheduleEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsApi#get_analytics_reporting_schedules\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_analytics_reporting_timeperiods_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsApi.get_analytics_reporting_timeperiods ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/analytics/reporting/timeperiods\".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 \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<String>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsApi#get_analytics_reporting_timeperiods\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show_report\n report = User.find(params[:id]).reports.find(params[:r_id])\n render :json => report\n end",
"def report_time time\n end",
"def index\n @p_times = PTime.all\n end",
"def get_report_list\n res=api_call('GetReportList')[:data]\n end",
"def index\n from_time = Time.now\n render json: Invoice.where(invoice_status_id: 12).order(id: :desc).limit(10).map { |x|\n {\n username: x.user.username,\n plan: \"#{x.plan.name} - $#{x.plan.price} USD\",\n created_at: x.created_at\n }\n }\n end"
] | [
"0.7129789",
"0.6651742",
"0.6524392",
"0.6520537",
"0.64876735",
"0.6469547",
"0.64045674",
"0.6402486",
"0.63891643",
"0.637867",
"0.6360271",
"0.6352883",
"0.6333305",
"0.6322239",
"0.6311603",
"0.6298278",
"0.6296576",
"0.6294042",
"0.62818474",
"0.6249144",
"0.6238625",
"0.62381357",
"0.62317127",
"0.6228989",
"0.6225484",
"0.6196003",
"0.61712456",
"0.6169141",
"0.6155429",
"0.61521816",
"0.6145687",
"0.61437213",
"0.6138801",
"0.61166364",
"0.61162937",
"0.61040163",
"0.60923016",
"0.60787374",
"0.606509",
"0.60571086",
"0.60563415",
"0.6040603",
"0.60247546",
"0.6016327",
"0.6008223",
"0.6002282",
"0.5999308",
"0.59981954",
"0.59974325",
"0.5995371",
"0.5988203",
"0.5983541",
"0.5981132",
"0.5977183",
"0.59664184",
"0.596016",
"0.5955385",
"0.5948708",
"0.59415597",
"0.5940511",
"0.5940385",
"0.5926428",
"0.59224874",
"0.59224874",
"0.5919248",
"0.59155333",
"0.5907124",
"0.59006435",
"0.5894624",
"0.58810115",
"0.5877421",
"0.5868635",
"0.58631414",
"0.58626205",
"0.58603805",
"0.58596885",
"0.5846727",
"0.5844533",
"0.5841424",
"0.5840845",
"0.58407104",
"0.5836371",
"0.5831429",
"0.58223414",
"0.5819224",
"0.58130115",
"0.58128923",
"0.5812263",
"0.5807701",
"0.580441",
"0.5802596",
"0.5801133",
"0.58010817",
"0.57986945",
"0.5792904",
"0.57909226",
"0.5781588",
"0.5779181",
"0.5778899",
"0.57770514"
] | 0.76245445 | 0 |
GET /time/time_reports/1 GET /time/time_reports/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_report }\n end\n end",
"def index\n @time_time_reports = Time::TimeReport.all\n end",
"def new\n @time_report = TimeReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_report }\n end\n end",
"def index\n @timecharts = Timechart.find(:all, order: \"stop_time DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timecharts }\n end\n end",
"def show\n @timechart = Timechart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timechart }\n end\n end",
"def index\n if params[:date].present?\n begin\n @date = Date.parse(params[:date])\n rescue => e\n Rails.logger.debug [e.class, e.message].join(' ')\n end\n end\n\n @date ||= (Report.latest_date.presence || Date.today)\n @reports = Report.date(@date).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end",
"def reports_schedule\n \n @schedule = ReportSchedule.find(params[:schedule_id])\n \n respond_to do |format|\n format.html\n format.json { render json: @schedule }\n end\n end",
"def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end",
"def download_report(name, request_time, format)\n response = @client.get('arborws/reports/configured',\n api_key: @api_key, name: name,\n request_time: request_time, format: format)\n\n response\n end",
"def index\n @timecards = TimeCard.all\n render :json => @timecards.to_json(:include => :time_entry), status: :ok\n end",
"def set_time_time_report\n @time_time_report = Time::TimeReport.find(params[:id])\n end",
"def index\n @timesheets = Timesheet.all\n render json: @timesheets\n end",
"def show\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_log }\n end\n end",
"def index\n @service_times = ServiceTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_times }\n end\n end",
"def reports_schedule_detail\n @reports = ReportSchedule.find(params[:schedule_id]).reports.order(:id).reverse[0..50]\n\n respond_to do |format|\n format.json { render json: @reports} \n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json {\n\n render :json => TimeOff.joins('LEFT OUTER JOIN request_types ON time_offs.request_type_id = request_types.id')\n .joins('INNER JOIN users ON time_offs.user_id = users.id')\n .select(\n 'time_offs.id,\n time_offs.request_start_date,\n time_offs.request_end_date,\n time_offs.status,\n time_offs.comments,\n users.name as users_name,\n request_types.name as request_type_name') }\n end\n end",
"def index\n if params[:report_id]\n @transfer_slips = TransferSlip.where([\"report_id = ?\", params[:report_id]]).all\n @report = Report.find(params[:report_id])\n elsif params[:year] && params[:month] && params[:day]\n @transfer_slips = TransferSlip.where([\"user_id = ? AND date = ?\", current_user.id, \"#{params[:year]}-#{params[:month]}-#{params[:day]}\"])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transfer_slips }\n end\n end",
"def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end",
"def index\n render json: {time: Time.now}\n end",
"def index\n @timetables = Timetable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timetables }\n end\n end",
"def show\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @my_time_trial }\n end\n end",
"def index\n @hours = Hour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hours }\n end\n end",
"def index\n @timings = Timing.all\n end",
"def show\n @timesheet = Timesheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def show\n @timesheet = Timesheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end",
"def show\n @report = Rails.cache.fetch(\"reports/#{params[:id]}\", :expires_in => 1.week) do\n Report.without(:email).find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end",
"def show\n @breadcrumb = 'read'\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end",
"def index\n parse_conditions\n\n @time_records = []\n\n if @user\n @project_time_record_grid = initialize_grid(TimeRecord.where(user_id: @user.id, type: TimeRecord.name).group(:project_id))\n @time_records = TimeRecord.where(@conditions.merge(type: TimeRecord.name))\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_records.to_json }\n end\n end",
"def index\n @timesheet_entries = TimesheetEntry.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timesheet_entries }\n end\n end",
"def index\n @tea_times = TeaTime.all\n respond_to do |format|\n format.html { render layout: !request.xhr? }\n format.json { render json: @tea_times }\n end\n end",
"def index\n @reporting = Reporting.without_status(:deleted).all\n @category = Reporting::CATEGORY_REPORTS\n\n puts @reporting.inspect\n puts @category.inspect\n\n respond_to do |format|\n format.html\n format.json { render json: @reporting }\n end\n end",
"def index\n @time_frames = TimeFrame.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_frames }\n end\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def show\n reports = Hash.new \n hours_trackers = HoursTracker.where(report_id: params[:report_id]) \n HoursTracker.where(report_id: params[:report_id]).find_each do |hours_tracker|\n Report.add_hours_tracked(hours_tracker)\n end\n @reports = Report.generate_report\n end",
"def create\n\n @time_time_report = Time::TimeReport.new(time_time_report_params)\n\n respond_to do |format|\n if @time_time_report.save\n format.html { redirect_to @time_time_report, notice: 'Time report was successfully created.' }\n format.json { render :show, status: :created, location: @time_time_report }\n else\n format.html { render :new }\n format.json { render json: @time_time_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @reports = Report.where(user_id: current_user.id, patient_id:@patient.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end",
"def report(id)\n get(\"reports/#{id}\")\n end",
"def hours\n render json: Pings::Selector.new.hours(params)\n end",
"def get_report(api_key, client_api_id, interval, query = \"\")\n uri = URI(API_ENDPOINT) + URI.escape(\"?api_key=#{api_key}&client_api_id=#{client_api_id}&interval=#{interval}&query=#{query}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n raise \"Server returned error #{response.code} processing your API request\" if response.code != \"200\"\n JSON.parse(response.body)\nend",
"def show\n @time_track = TimeTrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_track }\n end\n end",
"def index\n @entries = @time_sheet.entries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n @reporting_periods = ReportingPeriod.order(date: :desc)\n .includes(:full_reports).page params[:page]\n @data = ::Api::Charts::ReportingPeriod.new(@reporting_periods)\n .reporting_periods_cost_data\n end",
"def report\n\n @startD = params[:start].to_time\n @endD = params[:end].to_time \n \n\n #grab all MemberMonthReports which fall within date constraints\n @reports = MemberMonthReport.\n where('? <= start_date and start_date <= ?', @startD, @endD).\n reorder(:start_date, :member_id)\n \n respond_to do |format|\n format.html # report.html.erb\n format.json { render json: @time_entries }\n end\n end",
"def reports\n\n \t if params[\"from_date\"].present? and params[\"to_date\"].present?\n @date=params[:from_date]\n @data=JSON.parse RestClient.get $api_service+\"/claims/data_report?from_date=#{params[\"from_date\"]}&to_date=#{params[\"to_date\"]}\"\n elsif params[:date]\n @data=JSON.parse RestClient.get $api_service+\"/claims/data_report?from_date=#{params[\"date\"]}&to_date=#{params[\"date\"]}\"\n @date=params[:date]\n else \n @date=Date.today \n @data=JSON.parse RestClient.get $api_service+'/claims/data_report'\n end\n\n end",
"def index\n @timers = Timer.all\n\n render json: @timers\n end",
"def index\n# @time_logs = TimeLog.all\n @time_logs = TimeLog.paginate :page => params[:page], :per_page => 10, :order => 'site_id'\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_logs }\n end\n end",
"def show\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end",
"def show\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end",
"def index\n @timecard = Timecard.find(params[:timecard_id])\n render :json => Hour.timecard_hours(@timecard)\n end",
"def show_report\n report = User.find(params[:id]).reports.find(params[:r_id])\n render :json => report\n end",
"def show\n @custom_report = CustomReport.find(params[:id])\n\n render json: @custom_report\n end",
"def get_all_report\n limit = 15\n begin\n if params.has_key? :last_iso_timestamp\n from_time = DateTime.iso8601 params[:last_iso_timestamp]\n\n items = Item.active_items.order('updated_at DESC').where(\"updated_at < ?\",from_time).limit(limit)\n else \n items = Item.active_items.order('updated_at DESC').limit(limit)\n end\n #return\n render json:{success:true, lost_and_found: items.take(limit)} \n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end",
"def index\n @timelogs = Timelog.all\n end",
"def index\n @time_entry ||= current_user.time_entries.build(\n :tdate => Date.today\n )\n \n @time_entries = current_firm.all_time_entries\n\n respond_to do |format|\n format.html { render :index }# index.html.erb\n format.json { render json: @time_entries }\n end\n end",
"def list\n @reports_fetch = Report.all\n @reports = []\n\n @reports_fetch.each do |report|\n @reports << report if current_user == report.submitter\n end\n\n render status: 200, json: @reports.as_json(methods: [:url_title_string, :report_time_ms], include: { report_status_type: {}, report_type: {}, specified_submit_to_role: {} })\n end",
"def show\n \n @report = Report.find(params[:id])\n\n # Filtering logic. See ApplicationHelper.trip_filters\n if params[:time_filter_type]\n @time_filter_type = params[:time_filter_type]\n else\n @time_filter_type = session[TIME_FILTER_TYPE_SESSION_KEY]\n end\n # if it is still not set use the default\n if @time_filter_type.nil?\n # default is to use the first time period filter in the TimeFilterHelper class\n @time_filter_type = \"0\"\n end\n # store it in the session\n session[TIME_FILTER_TYPE_SESSION_KEY] = @time_filter_type\n params[:time_filter_type] = @time_filter_type\n \n if @report\n \n # set up the report view\n @report_view = @report.view_name\n # get the class instance and generate the data\n report_instance = @report.class_name.constantize.new\n @data = report_instance.get_data(current_user, params)\n respond_to do |format|\n format.html\n end\n end\n end",
"def get_data_for_time_span()\n set_schedule_query_params\n\n @t1 = Time.at(@t1.to_i)\n @t2 = Time.at(@t2.to_i)\n\n @rsrcs = @config.resource_list # ScheduledResource.resource_list\n\n @blockss = ScheduledResource.get_all_blocks(@config, @t1, @t2, @inc)\n\n json_adjustments\n end",
"def show\n @timesheets = @payroll.timesheets.includes(:payroll, :user)\n reports_data([@payroll])\n end",
"def schedule\n @schedules = ReportSchedule.all\n\n respond_to do |format|\n format.html\n format.json { render json: @schedules }\n end\n end",
"def index\n @ticket_times = TicketTime.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticket_times }\n end\n end",
"def show\n report_id = params[:id]\n render json: Record.where(report_id: report_id)\n end",
"def index\n current_patient ||= Patient.find(params[:patient_id])\n\n if params.key?(:all) && params[:all] == '1'\n @schedules = current_patient.schedules\n else\n @schedules = [current_patient.current_schedule]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json do\n if params.key?(:key) && ['updated_at', 'started_at', 'terminated_at'].include?(params[:key])\n render json: @schedules.map { |s| s.as_json(only: params[:key]) }\n else\n render json: @schedules.to_json(include: [:pill_times])\n end\n end\n format.csv\n end\n end",
"def index\n @time_episodes = TimeEpisode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_episodes }\n end\n end",
"def index\n from_time = Time.now\n render json: Invoice.where(invoice_status_id: 12).order(id: :desc).limit(10).map { |x|\n {\n username: x.user.username,\n plan: \"#{x.plan.name} - $#{x.plan.price} USD\",\n created_at: x.created_at\n }\n }\n end",
"def index\n @jobtimes = current_company.jobtimes.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml {render :xml => @jobtimes }\n format.json { render :json => @jobtimes }\n end\n end",
"def index\n date_range = unix_date(params[:date])\n @timeslots = Timeslot.where('start_time >= ? and start_time <= ?', date_range[:beginning_of_day], date_range[:end_of_day])\n # render :json => @timeslots.as_json(only: [])\n end",
"def index\n @stage_id = params[:stage_id].present? ? params[:stage_id] : nil\n @classification = params[:class].present? ? params[:class] : nil\n @time_type = params[:type].present? ? params[:type] : nil\n if @time_type == '1'\n @stage_times = RallyEventStageTime.stage_times(@rally.id, @stage_id, @classification)\n else\n @stage_times = RallyEventStageTime.final_times(@rally.id, @stage_number, @stage_id, @classification)\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_frame }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clock_time }\n end\n end",
"def my_reports\n @reports ||= Report.user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end",
"def last_projects_report\n\t\trender json: Task.find(params[:id]).last_projects_report\n\tend",
"def show\n @timesheet = current_user.timesheets.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def show\n @time_off_request = TimeOffRequest.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_off_request }\n end\n end",
"def index\n @time_lines = TimeLine.all\n end",
"def show\n render json: @timer\n end",
"def query_times_graphs\n controller = params[:controller_name]\n action = params[:action_name]\n data = redis(logger: true).zrangebyscore(\"request_timings/total/by_action/#{controller}##{action}\",\n 1.month.ago.to_i, '+inf',\n with_scores: true)\n .map { |y, x| [x.to_f, y.to_f] }\n throw 'No Data' if data.nil? || data.empty?\n smoothed = moving_avg(data)\n final = (params[:raw].present? ? data : smoothed).map { |x, y| [Time.at(x.to_i).to_datetime, y] }\n render json: [\n { name: 'Timings', data: final }\n ]\n end",
"def show\n @daily_statistic = DailyStatistic.find(params[:id])\n\n render json: @daily_statistic\n end",
"def show\n @report = Report.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end",
"def new\n @time_report = TimeReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end",
"def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end",
"def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"count_of_table_sid_by_field_sid\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = AccessReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def index\n respond_to do |format|\n if params[:car_id] && params[:year] && params[:month] && params[:day] && params[:hour] && params[:minute]\n date = DateTime.new(params[:year].to_i, params[:month].to_i, params[:day].to_i, params[:hour].to_i, params[:minute].to_i)\n\n @meter = Meter.joins(:report => :car).where([\"reports.car_id = ? AND reports.started_at < ?\",\n params[:car_id],\n date]).order(\"reports.started_at DESC\").first\n if @meter\n format.json { render json: {:meter => @meter}, status: :created}\n else\n format.json { render json:{ :error => \"Not Acceptable:meters#show\", :status => 406 } }\n end\n end\n end\n end",
"def show\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_point }\n end\n end",
"def show\n @planned_time = PlannedTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planned_time }\n end\n end",
"def view\n if params[:report_date].present? && params[:report_type].present?\n @report_contents = current_user.get_reports(params[:report_date], params[:report_type])\n else\n respond_to do |format|\n format.html { redirect_to current_user, method: :get, alert: 'Either report date or report type is empty' }\n format.json { render :show, status: :bad_request, location: @user }\n end\n end\n end",
"def index\r\n @clocks = ClockResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @clocks }\r\n end\r\n end",
"def index\n @reports = Report.order(created_at: :desc).all\n end",
"def index\n respond_to do |format|\n format.html { # index.html.erb\n @work_times = WorkTime.page params[:page]\n }\n format.xml { # index.xml.builder\n @work_times = WorkTime.all\n }\n format.json { render json: WorkTime.all }\n end\n end",
"def time_track\n @time_track ||= begin\n record = teacher.time_tracks.\n for_date(time_track_params[:clock_out].to_date).\n no_clock_out.first\n\n raise ActiveRecord::RecordNotFound if record.nil?\n\n record\n end\n rescue ActiveRecord::RecordNotFound\n message = 'Time Track not found!'\n\n render json: [message], status: :unprocessable_entity\n end",
"def getReportableType\n @reports = Report.where(\"reportable_type = ?\", params[:reportable_type])\n render json: @reports\n end",
"def show\n @stop_time = StopTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stop_time }\n end\n end",
"def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end",
"def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end",
"def index\n set_user\n @time_offs = TimeOff.all\n end",
"def index\n @time = Time.new\n @prev_time = @time - 1.month\n @next_time = @time + 1.month\n @months = [@prev_time, @time, @next_time]\n @month_time_format = \"%B %Y\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end",
"def show\n @timer = Timer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timer }\n end\n end",
"def index\n @regimes = Regime.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @regimes }\n # end\n end",
"def getTimingDetails\n labels = [] # store links accessed during review\n percentages = [] # store percentage time per link for pie chart\n tables = [] # store timing data breakdown per link\n stats = [] # store class stat data\n\n # get total time spent on review\n totalTime = getTotalTime(params[:reponse_map_id], params[:round])\n\n # push relevant data for each row into arrays used to fill in JSON\n SubmissionViewingEvent.where(map_id: params[:reponse_map_id], round: params[:round]).each do |entry|\n labels.push(entry.link)\n percentages.push(entry.total_time.to_f / totalTime)\n tables.push({\n \"subject\" => entry.link,\n \"timeCost\" => secondsToHuman(entry.total_time.to_i),\n \"avgTime\" => secondsToHuman(getAvgRevTime(params[:reponse_map_id], params[:round], entry.link))\n })\n end\n\n tables.push({\n \"subject\" => \"Total\",\n # contains total time spent in human format\n \"timeCost\" => secondsToHuman(totalTime),\n # contains average review time for this submission in human format\n \"avgTime\" => secondsToHuman(getAvgRevTime(params[:reponse_map_id], params[:round]))\n })\n\n stats.push({\n \"title\" => 'Class Average',\n \"value\" => secondsToHuman(getClassAvgRevTime(params[:reponse_map_id], params[:round]))\n })\n\n stats.push({\n \"title\" => 'Median',\n \"value\" => secondsToHuman(getMedianRevTime(params[:reponse_map_id], params[:round]))\n })\n\n stats.push({\n \"title\" => 'Standard Deviation',\n \"value\" => secondsToHuman(getStdDevRevTime(params[:reponse_map_id], params[:round]))\n })\n\n # create JSON\n @timingDetails = {\n # contains links accessed in review\n 'Labels'=> labels,\n # contains percentage time spent per link\n 'Data' => percentages,\n # contains link name and time spent for display table\n 'tables' => tables,\n # contains class stats\n 'stats' => stats\n }\n\n # respond to request with JSON containing all data\n respond_to do |format|\n format.json { render json: @timingDetails }\n end\n end"
] | [
"0.7323457",
"0.72856814",
"0.66904587",
"0.6596875",
"0.6527952",
"0.646537",
"0.6450064",
"0.6444921",
"0.64392394",
"0.64335614",
"0.6381917",
"0.6379952",
"0.63682824",
"0.6333002",
"0.63050634",
"0.6292514",
"0.6255531",
"0.6248565",
"0.61916894",
"0.6185597",
"0.6175564",
"0.6170856",
"0.61482966",
"0.61298734",
"0.61298734",
"0.6118363",
"0.611118",
"0.609428",
"0.6093924",
"0.60841435",
"0.6082184",
"0.60788953",
"0.6077139",
"0.6076309",
"0.60753393",
"0.6070165",
"0.6068866",
"0.60664123",
"0.60633826",
"0.6059146",
"0.6049343",
"0.6046111",
"0.60394406",
"0.6038373",
"0.6033651",
"0.6031667",
"0.6017695",
"0.60168743",
"0.60168743",
"0.6012913",
"0.60087824",
"0.6006391",
"0.6002989",
"0.60029864",
"0.59917337",
"0.59739727",
"0.5964911",
"0.5964554",
"0.59538275",
"0.59336454",
"0.5925691",
"0.5922177",
"0.5912674",
"0.5907188",
"0.5907155",
"0.59047055",
"0.590461",
"0.5903454",
"0.59030455",
"0.5902948",
"0.5900411",
"0.5898977",
"0.5893566",
"0.5890638",
"0.58891624",
"0.58852684",
"0.58789235",
"0.5874743",
"0.5870136",
"0.5865966",
"0.5864078",
"0.5864078",
"0.5864078",
"0.58614874",
"0.5860997",
"0.58608",
"0.585735",
"0.58542204",
"0.5842661",
"0.5839325",
"0.5837109",
"0.5835615",
"0.5832162",
"0.58313507",
"0.5824991",
"0.5824991",
"0.5821142",
"0.58203685",
"0.5817292",
"0.58158773",
"0.58152163"
] | 0.0 | -1 |
POST /time/time_reports POST /time/time_reports.json | def create
@time_time_report = Time::TimeReport.new(time_time_report_params)
respond_to do |format|
if @time_time_report.save
format.html { redirect_to @time_time_report, notice: 'Time report was successfully created.' }
format.json { render :show, status: :created, location: @time_time_report }
else
format.html { render :new }
format.json { render json: @time_time_report.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @time_report = TimeReport.new(params[:time_report])\n\n respond_to do |format|\n if @time_report.save\n format.html { redirect_to @time_report, notice: 'Time report was successfully created.' }\n format.json { render json: @time_report, status: :created, location: @time_report }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @time_time_reports = Time::TimeReport.all\n end",
"def new\n @time_report = TimeReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_report }\n end\n end",
"def set_time_time_report\n @time_time_report = Time::TimeReport.find(params[:id])\n end",
"def report\n\n @startD = params[:start].to_time\n @endD = params[:end].to_time \n \n\n #grab all MemberMonthReports which fall within date constraints\n @reports = MemberMonthReport.\n where('? <= start_date and start_date <= ?', @startD, @endD).\n reorder(:start_date, :member_id)\n \n respond_to do |format|\n format.html # report.html.erb\n format.json { render json: @time_entries }\n end\n end",
"def create_hourly_report(url)\n @total_serv_time = 0\n @time_spent_g = 0\n @time_spent_p = 0\n @user_list = []\n @g_count = 0\n @p_count = 0\n @n = 1\n puts \"24 Hour Report for #{url}\"\n puts \"---------------------------------------------------------------------------------------------\"\n puts \"TH HOUR---# USER---# GET---# POST---TOTAL_TIME_GET(ms)---TOTAL_TIME_POST(ms)---TOTAL_TIME(ms)\"\n puts \"---------------------------------------------------------------------------------------------\"\n for n in 1..24\n $all_user_data.each do |k,v|\n if v[:th_hour] == n && !v[:uri].to_s.string_contains(url).nil? \n @total_serv_time += v[:time].to_i\n if v[:method] == 'G'\n @time_spent_g += v[:time].to_i\n @g_count += 1 \n end\n if v[:method] == 'P'\n @time_spent_p += v[:time].to_i\n @p_count += 1 \n end\n @user_list << v[:user].to_s\n end \n end\n #puts \"#{n}TH HOUR---#{@user_list.uniq.length} users---#{@g_count} GET REQs---#{@p_count} POST REQs---#{@time_spent_g}ms in GET---#{@time_spent_p}ms in POST---#{@total_serv_time}ms in Total\"\n puts \"#{n}TH HOUR---#{@user_list.length} users---#{@g_count} GET REQs---#{@p_count} POST REQs---#{@time_spent_g}ms in GET---#{@time_spent_p}ms in POST---#{@total_serv_time}ms in Total\"\n #pp @@user_list.uniq\n @total_serv_time = 0\n @time_spent_g = 0\n @time_spent_p = 0\n @g_count = 0\n @p_count = 0\n @user_list.clear\n end\n end",
"def report\n\n # Limit access to authorized users\n authorize! :administer, current_user\n @users = User.all\n\n @fromTime = DateTime.strptime(params[:fromTime] + ' EDT', '%m-%d-%Y %T %Z') rescue DateTime.current.beginning_of_year\n @toTime = DateTime.strptime(params[:toTime] + ' EDT', '%m-%d-%Y %T %Z') rescue DateTime.current\n\n params[:fromTime] = @fromTime.strftime('%m-%d-%Y %T')\n params[:toTime] = @toTime.strftime('%m-%d-%Y %T')\n\n end",
"def time_time_report_params\n params.require(:time_report).permit(:repdate, :hours, :note,:user_id,:time_reason_id)\n end",
"def create\n @report = Report.new(report_params)\n \n if report_params[:begin_dt] == nil and report_params[:end_dt] == nil then\n @begin_datetime = Time.new(report_params[\"begin_dt(1i)\"].to_i, report_params[\"begin_dt(2i)\"].to_i, report_params[\"begin_dt(3i)\"].to_i, report_params[\"begin_dt(4i)\"].to_i, report_params[\"begin_dt(5i)\"].to_i)\n @end_datetime = Time.new(report_params[\"end_dt(1i)\"].to_i, report_params[\"end_dt(2i)\"].to_i, report_params[\"end_dt(3i)\"].to_i, report_params[\"end_dt(4i)\"].to_i, report_params[\"end_dt(5i)\"].to_i)\n else \n @begin_datetime = report_params[:begin_dt].to_date\n @end_datetime = report_params[:end_dt].to_date\n end\n \n respond_to do |format|\n error_inconsistent_data_time = false\n if report_params[:generate_by].to_i != 0 and @begin_datetime >= @end_datetime then\n error_inconsistent_data_time = true\n end\n \n error_residuos_not_find = true\n case report_params[:generate_by].to_i\n when 0\n error_residuos_not_find = false\n when 1 #teste por departamento\n report_params[:list].each do |dep_name|\n if dep_name == \"\" then\n next\n end\n dep = Department.find_by(name: dep_name)\n if dep != nil then\n labs = dep.laboratories\n if labs != nil then\n labs.each do |lab|\n if !lab.residues.empty? then\n error_residuos_not_find = false\n end\n end\n end\n end\n end\n when 2 #teste por laboratórios\n report_params[:list].each do |lab_name|\n if lab_name == \"\" then\n next\n end\n if !Laboratory.find_by(name: lab_name).residues.empty? then\n error_residuos_not_find = false\n end\n end\n when 3\n error_residuos_not_find = false\n end\n \n if error_inconsistent_data_time\n @report.errors.add(:begin_dt, :blank, message: \"intervalo de data invalido: a data e hora de inicio esta posterior ou iqual a data e hora de final do intervalo requerido.\")\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n elsif error_residuos_not_find\n @report.errors.add(:list, :blank, message: \"Não há residuos associados a esse(s) departamento(s)/laboratório(s)!\")\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n elsif @report.save\n format.html { redirect_to @report, notice: 'O Relatório foi criado com sucesso!' }\n format.json { render :show, status: :created, location: @report }\n case report_params[:generate_by].to_i\n when 0 #relatório por coleção\n generate_by_collection\n when 1 #relatório por departamento\n generate_by_department\n when 2 #relatório por laboratórios\n generate_by_laboratory\n when 3 #relatório por residuos\n generate_by_residue\n end\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def report\n # generate_report()\n ReportWorker.perform_async(\"07-01-2018\", \"08-01-2018\")\n render \\\n json: {status: 'SUCCESS', message:'REQUEST TO GENERATE A REPORT ADDED TO THE QUEUE'},\n status: :ok\n end",
"def reports_hours_users \n @initial_date = Date.strptime(params[:initial_date], \"%m/%d/%Y\")\n @final_date = Date.strptime(params[:final_date], \"%m/%d/%Y\")\n @count = @project.count_confirmed_users\n\n respond_to do |format|\n format.json\n end \n end",
"def report_params\n params.require(:report).permit(:date, :time, :occ_place, :sus_age, :sus_gen, :sus_inf, :vic_age, :vic_gen, :crime_type, :content, :sido_id, :sigungu_id, :latitude, :longitude, :video)\n end",
"def reports\n\n \t if params[\"from_date\"].present? and params[\"to_date\"].present?\n @date=params[:from_date]\n @data=JSON.parse RestClient.get $api_service+\"/claims/data_report?from_date=#{params[\"from_date\"]}&to_date=#{params[\"to_date\"]}\"\n elsif params[:date]\n @data=JSON.parse RestClient.get $api_service+\"/claims/data_report?from_date=#{params[\"date\"]}&to_date=#{params[\"date\"]}\"\n @date=params[:date]\n else \n @date=Date.today \n @data=JSON.parse RestClient.get $api_service+'/claims/data_report'\n end\n\n end",
"def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n \n @report.test_suite.test_cases.each do |test_case|\n @report.results.create({ status: 'Queued', report_id: @report, test_case_id: test_case.id})\n end\n \n format.html { redirect_to [:admin, @report], notice: 'Report was successfully created.' }\n format.json { render action: 'show', status: :created, location: @report }\n else\n format.html { render action: 'new' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_report }\n end\n end",
"def create\n #not sure why this was here...? @trips = Trip.all\n\n @expense_report = ExpenseReport.new(expense_report_params)\n authorize @expense_report\n @expense_report.submitter = current_account.accountable\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n\n\n respond_to do |format|\n if @expense_report.save\n format.html { redirect_to home_index_path, notice: 'Expense report was successfully created.' }\n format.json { render :show, status: :created, location: @expense_report }\n else\n format.html { render :new }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_tracker = TimeTracker.new({ started_at: Time.current, status: 'running' }.merge(time_tracker_params))\n\n respond_to do |format|\n if @time_tracker.save\n format.html { redirect_to @time_tracker, notice: 'Time tracker was successfully created.' }\n format.json { render :show, status: :created, location: @time_tracker }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @time_tracker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def report\n @report = Report.create(reports_params)\n if @report.valid?\n render json: {}, status: :created\n else\n render json: { error: 'failed to create report' }, status: :internal_server_error\n end\n end",
"def reports_tasks_project\n @initial_date = Date.strptime(params[:initial_date], \"%m/%d/%Y\")\n @final_date = Date.strptime(params[:final_date], \"%m/%d/%Y\")\n \n respond_to do |format|\n format.json\n end\n end",
"def update\n respond_to do |format|\n if @time_time_report.update(time_time_report_params)\n format.html { redirect_to @time_time_report, notice: 'Time report was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_time_report }\n else\n format.html { render :edit }\n format.json { render json: @time_time_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reports_schedule\n \n @schedule = ReportSchedule.find(params[:schedule_id])\n \n respond_to do |format|\n format.html\n format.json { render json: @schedule }\n end\n end",
"def show\n reports = Hash.new \n hours_trackers = HoursTracker.where(report_id: params[:report_id]) \n HoursTracker.where(report_id: params[:report_id]).find_each do |hours_tracker|\n Report.add_hours_tracked(hours_tracker)\n end\n @reports = Report.generate_report\n end",
"def index\n @stage_id = params[:stage_id].present? ? params[:stage_id] : nil\n @classification = params[:class].present? ? params[:class] : nil\n @time_type = params[:type].present? ? params[:type] : nil\n if @time_type == '1'\n @stage_times = RallyEventStageTime.stage_times(@rally.id, @stage_id, @classification)\n else\n @stage_times = RallyEventStageTime.final_times(@rally.id, @stage_number, @stage_id, @classification)\n end\n end",
"def create\n @report = Report.new(report_params)\n @report.user = current_user\n\n # the report period is based on the created_at date\n # need to have current period be an enum or boolean for period - current, findby\n current_period = Period.first\n @report.period = current_period\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: \"Report was successfully created.\" }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @time_report = TimeReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def create\n @timing = Timing.new(params[:timing].slice(:start, :stop, :days, :parent_class, :parent_id, :active))\n if @timing.save\n render json: @timing\n else\n render json: { error: 'error: could not save timing' }\n end\n end",
"def report_params\n \t\tparams.require(:report).permit(:title, :time, :description, :address, :latitude, :longitude, :report_type)\n\tend",
"def create\n @timechart = Timechart.new(params[:timechart])\n\n respond_to do |format|\n if @timechart.save\n format.html { redirect_to @timechart, notice: 'Timechart was successfully created.' }\n format.json { render json: @timechart, status: :created, location: @timechart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timechart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"count_of_table_sid_by_field_sid\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = AccessReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def create\n @timing = Timing.new(timing_params)\n\n if @timing.save\n render :show, status: :created, location: @timing\n else\n render json: @timing.errors, status: :unprocessable_entity\n end\n end",
"def reportSubmit \n @date = Hash.new\n @service = Service.find(params[:id])\n if !checkService(@service)\n redirect_to services_path, alert: \"You do not have the privileges required to view this service.\"\n else\n @date[\"start\"] = Date.new(params[:syr].to_i, params[:smth].to_i, params[:sday].to_i)\n @date[\"end\"] = Date.new(params[:eyr].to_i, params[:emth].to_i, params[:eday].to_i)\n @date[\"step\"] = params[:step]\n @service = Service.find(params[:id])\n respond_to do |format|\n format.html {render :layout=>false}\n format.json { render json: @service }\n end\n end\n end",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = UserReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to admin_reports_path, notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.report', count: 1)) }\n format.json { render :show, status: :created, location: @report }\n else\n set_date\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_user.company.reports.any?\n if [\"Queued\", \"Running\"].include? current_user.company.reports.last.status\n redirect_to dashboard_path, notice: \"Looks like you already have a report queued. We'll get to it asap, promise!\"\n return\n end\n end\n \n @report = Report.new(report_params) \n\n respond_to do |format|\n if @report.save\n \n @report.test_suite.test_cases.order('id ASC').each do |test_case|\n @report.results.create({ status: 'Queued', report_id: @report, test_case_id: test_case.id})\n end\n \n ReportMailer.admin_requested_report_triggered_email(@report).deliver\n #ReportMailer.requested_report_triggered_email(@report).deliver\n \n format.html { redirect_to dashboard_path }\n format.json { render action: 'show', status: :created, location: @report }\n else\n format.html { render action: 'new' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def overtime_params\n params.require(:overtime).permit(:start_date, :end_date, :employee_id, :report_id, :hours)\n end",
"def send_reports(type, reports)\n dir = File.join(\"/tmp\", type, \"#{@start_date.strftime(\"%Y-%m\")}_to_#{@end_date.strftime(\"%Y-%m\")}\")\n FileUtils.mkdir_p dir\n reports.each do |name, report|\n file = File.join(dir, name)\n File.write(file, CounterReporterService.csv(report))\n Rails.logger.info(\"[ROYALTY REPORTS] wrote #{file}\")\n end\n rescue StandardError => e\n \"[ROYALTY REPORTS] Error: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end",
"def report_time time\n end",
"def create\n @time_trial = TimeTrial.new(time_trial_params)\n @time_trial.save\n end",
"def create\n @user = User.find(params[:user_id])\n @report = @user.reports.create(report_params)\n @report.date = prepare_date(params[:date])\n prepare_report()\n @report.balance = @report_summary.working_hours_balance\n @report.workingHours = @report_summary.working_hours\n\n success = false\n begin\n if @report.save\n success = true\n end\n rescue ActiveRecord::RecordNotUnique\n flash[:alert] = I18n.t('controllers.reports.already_exists_for_date')\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to [@report.user, @report], notice: I18n.t('controllers.reports.successfully_created') }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = BgWorkerReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def report\n @service = Service.find(params[:id])\n \n if !checkService(@service)\n redirect_to services_path, alert: \"You do not have the privileges required to view this service.\"\n else\n @date = Hash.new\n @date[\"start\"] = DateTime.now - 5.months\n @date[\"end\"] = DateTime.now\n @date[\"step\"] = \"Months\"\n \n respond_to do |format|\n format.html # report.html.erb\n format.json { render json: @service }\n end\n end\n end",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = DevFeedbackReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def report_params\n params.require(:report).permit(:date, :target_species, :general_location, :catch_keepers, :catch_total, :trip_summary, :primary_method, :tide, :weather, :wind, :spot, :picture, :best_bait, :trip_description, :location_id)\n end",
"def create\n data_report = DataReport.new(data_report_params)\n\n # For now the worker is synchronous. Eventually it can be run asynchronously\n if data_report.save && report_worker.perform(data_report.id)\n render json: {}, status: :ok\n elsif data_report.errors.present\n render json: data_report.errors, status: :unprocessable_entity\n else\n render json: {}, status: :internal_server_error\n end\n end",
"def new\n @date = Date.new params[:y].to_i, params[:m].to_i, params[:d].to_i\n @title = \"Add time entry for #{@date}\"\n @timesheet = Timesheet.new :day => @date, :hours => 8\n @accounts = Account.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timesheet }\n end\n end",
"def time_tracker_params\n params.require(:time_tracker).permit(:time, :desc)\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def create\n @report = Report.new(report_params)\n @report.update(work_started_at: @report.schedule.work_started_at)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n\n #Todo生成\n name = current_user.name\n title = params[:report][:title]\n day = Schedule.find(params[:report][:schedule_id]).work_started_at.strftime(\"%m月%d日\")\n generate_todo(users_id:staffs_id_arr, companies_id:companies_id_arr, body:\"#{name}さんが#{day}出社分の日報「#{title}」を作成しました。確認してスタンプを押しましょう。\", associate_type:\"report\", associate_id: @report.id)\n\n #update Todo\n update_todo(associate_type:\"schedule\", associate_id: @report.schedule.id)\n end",
"def getTimingDetails\n labels = [] # store links accessed during review\n percentages = [] # store percentage time per link for pie chart\n tables = [] # store timing data breakdown per link\n stats = [] # store class stat data\n\n # get total time spent on review\n totalTime = getTotalTime(params[:reponse_map_id], params[:round])\n\n # push relevant data for each row into arrays used to fill in JSON\n SubmissionViewingEvent.where(map_id: params[:reponse_map_id], round: params[:round]).each do |entry|\n labels.push(entry.link)\n percentages.push(entry.total_time.to_f / totalTime)\n tables.push({\n \"subject\" => entry.link,\n \"timeCost\" => secondsToHuman(entry.total_time.to_i),\n \"avgTime\" => secondsToHuman(getAvgRevTime(params[:reponse_map_id], params[:round], entry.link))\n })\n end\n\n tables.push({\n \"subject\" => \"Total\",\n # contains total time spent in human format\n \"timeCost\" => secondsToHuman(totalTime),\n # contains average review time for this submission in human format\n \"avgTime\" => secondsToHuman(getAvgRevTime(params[:reponse_map_id], params[:round]))\n })\n\n stats.push({\n \"title\" => 'Class Average',\n \"value\" => secondsToHuman(getClassAvgRevTime(params[:reponse_map_id], params[:round]))\n })\n\n stats.push({\n \"title\" => 'Median',\n \"value\" => secondsToHuman(getMedianRevTime(params[:reponse_map_id], params[:round]))\n })\n\n stats.push({\n \"title\" => 'Standard Deviation',\n \"value\" => secondsToHuman(getStdDevRevTime(params[:reponse_map_id], params[:round]))\n })\n\n # create JSON\n @timingDetails = {\n # contains links accessed in review\n 'Labels'=> labels,\n # contains percentage time spent per link\n 'Data' => percentages,\n # contains link name and time spent for display table\n 'tables' => tables,\n # contains class stats\n 'stats' => stats\n }\n\n # respond to request with JSON containing all data\n respond_to do |format|\n format.json { render json: @timingDetails }\n end\n end",
"def create\n @type_report = TypeReport.new(type_report_params)\n\n respond_to do |format|\n if @type_report.save\n format.html { redirect_to @type_report, notice: 'Type report was successfully created.' }\n format.json { render :show, status: :created, location: @type_report }\n else\n format.html { render :new }\n format.json { render json: @type_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_record = TimeRecord.new(params[:time_record])\n @time_record.value = (@time_record.ended_at - @time_record.started_at) / 1.hour\n @time_record.recorded_on = @time_record.started_at.to_date\n\n respond_to do |format|\n if @time_record.save\n format.html { redirect_to time_records_path, notice: 'Time record was successfully created.' }\n format.json { render json: @time_record.to_json, status: :created, location: @time_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_record.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def report_params\n params.require(:report).permit(:entry_date, :user_id, :report)\n end",
"def create\n @time_log = TimeLog.new(params[:time_log])\n \n puts \"Creating a new time_log\"\n\n respond_to do |format|\n if @time_log.save\n format.html { redirect_to @time_log, notice: 'Time log was successfully created.' }\n format.json { render json: @time_log, status: :created, location: @time_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n params[:timesheet].each do |key,value|\n Timesheet.create(:project_id => value[:project_id],:description => value[:description],:hours => value[:hours])\n end\n redirect_to \"/timesheets\",notice: \"Timesheet created successfully\" \n end",
"def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to police_index_path, notice: 'Report was successfully created.' }\n format.json { render :index, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_record = WorkTimeRecord.new(time_record_params)\n\n respond_to do |format|\n if @time_record.save\n format.html { redirect_to @time_record, notice: 'Time record was successfully created.' }\n format.json { render :show, status: :created, location: @time_record }\n else\n format.html { render :new }\n format.json { render json: @time_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weekly_report = WeeklyReport.new(weekly_report_params)\n @weekly_report.user = current_user\n @weekly_report.group = current_user.group\n @weekly_report.published = true if @weekly_report.reported_time < Time.now\n\n respond_to do |format|\n if @weekly_report.save\n format.html { redirect_to @weekly_report, notice: 'Weekly report was successfully created.' }\n format.json { render :show, status: :created, location: @weekly_report }\n else\n format.html { render :new }\n format.json { render json: @weekly_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @custom_report = CustomReport.new(params[:custom_report])\n\n if @custom_report.save\n render json: @custom_report, status: :created, location: @custom_report\n else\n render json: @custom_report.errors, status: :unprocessable_entity\n end\n end",
"def report_params\n params.require(:report).permit(:time, :size, :location, :city, :county, :state, :lat, :lon, :comments, :filename)\n end",
"def set_timesheet\n @timesheet = Logtime.find_by_id(params[:id])\n if @timesheet\n else\n \trender json: { valid: false}, status: 404\n end\n end",
"def weekly_report_params\n params.require(:weekly_report).permit(:user_id, :content, :reported_time)\n end",
"def create\n # if report is valid, save it and set flag (no need to run it b/c it will be redirected)\n @report.just_created = true if @report.errors.empty?\n \n # return data in json format\n render(:json => {:report => @report}.to_json)\n end",
"def index\n @timecharts = Timechart.find(:all, order: \"stop_time DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timecharts }\n end\n end",
"def report_params\n params.require(:report).permit(:consumedCalories, :burnedCalories, :diference, :diference_value, :creation_date)\n end",
"def reports_tasks_user\n @initial_date = Date.strptime(params[:initial_date], \"%m/%d/%Y\")\n @final_date = Date.strptime(params[:final_date], \"%m/%d/%Y\")\n @count = @project.count_confirmed_users\n respond_to do |format|\n format.json\n end\n end",
"def report_data\n EnergyConsume.average_temperature_timeline.each_with_object([]) do |data, report|\n year, month, temperature = data\n item = {\n name: \"#{year}/#{month}\",\n temperature: temperature.round(1).to_s,\n }\n report << item\n end\n end",
"def create\n @time_registration = TimeRegistration.create(time_registration_params)\n respond_to do |format|\n if @time_registration.save\n format.json { render :show, status: :created, location: @time_registration }\n else\n format.json { render json: @time_registration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def report_params\n params.require(:report).permit(:title, :description, :status_id, :email, :image, :lat, :lng, :observation)\n end",
"def report_params\n params.require(:report).permit(:date, :end_date, :category_id, :user_id, :excel, :uploaded_by)\n end",
"def report_params\n\t\tparams.require(:report).permit(:date, :species_id, :state_waters, :general_location, :catch_keepers, :catch_total, :trip_summary, :primary_method, :tide, :weather, :wind, :spot, :picture, :best_bait, :trip_description, :location_id)\n\tend",
"def index\n if params[:date].present?\n begin\n @date = Date.parse(params[:date])\n rescue => e\n Rails.logger.debug [e.class, e.message].join(' ')\n end\n end\n\n @date ||= (Report.latest_date.presence || Date.today)\n @reports = Report.date(@date).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end",
"def create\n @report_type = ReportType.new(update_report_type_params)\n @report_type.employee_ids.shift\n @report_type.component_ids.shift\n @report_type.project_ids.shift\n @report_type.business_ids.shift\n @report_type.status_ids.shift\n\n respond_to do |format|\n if @report_type.save!\n # flash[:success] = \"Report types has been created successfully\"\n # redirect_to report_types_path\n format.html do\n redirect_to report_types_path\n end\n format.json { render json: @report_type.to_json}\n else\n format.html { render :new }\n format.json { render json: @report_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def report\n @employees=Employee.all\n @routing_sheets=RoutingSheet.find(:all, :conditions=> \"routing_sheet_state_id=1\") ## 1 = \"En Proceso\"\n $routing_sheets_details=Array.new\n respond_to do |format|\n format.html # report.html.erb\n format.json {render json: @routing_sheet }\n end\n end",
"def update\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n if @time_report.update_attributes(params[:time_report])\n format.html { redirect_to @time_report, notice: 'Time report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_time_trial = MyTimeTrial.new(params[:my_time_trial])\n\n respond_to do |format|\n if @my_time_trial.save\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully created.' }\n format.json { render :json => @my_time_trial, :status => :created, :location => @my_time_trial }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def report_params\n params.require(:report).permit(:date1, :date2, :project_filter, :task_filter, :project_id, :task_id, :email)\n end",
"def report_params\n params.require(:report).permit(:report_data, :name, :report_type, :date_of_create)\n end",
"def report_review\n # load report\n @report_html_hash = Hash.new\n @report_html_hash[0] = @service_demand.report_html_as_google_chart(get_time_for_report(Time.now), get_time_for_report(Time.now + INLINE_REPORT_DURATION.day), true)\n\n @service_demand_breakdowns_paged.each do |service_demand_breakdown|\n @report_html_hash[service_demand_breakdown.id.to_s] = service_demand_breakdown.report_html_as_google_chart(get_time_for_report(Time.now), get_time_for_report(Time.now + INLINE_REPORT_DURATION.day), true)\n end\n\n respond_to do |format|\n format.html # report_review.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n\n end",
"def create\n raise \"Disabled\"\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def report\n \n end",
"def create_global_report \n @data = return_lines\n @data.each do |x,y|\n timestamp = y.string_between_markers(\"\",\"[[ACTIVE]\")\n user = y.string_between_markers(\"U:\",\"A:\")\n uri = y.string_between_markers(\"URI=[\",\"]\")\n method = y.string_between_markers(\"],\",\"time\")\n time = y.string_between_markers(\"time=\",\"ms\")\n # eliminates invalid entries\n if !timestamp.nil? && !user.nil? && !uri.nil? && !method.nil? && !time.nil?\n $all_user_data[$packet_count][:timestamp] = timestamp.strip unless timestamp.strip.empty? \n $all_user_data[$packet_count][:user] = user.strip unless user.strip.empty? \n $all_user_data[$packet_count][:uri] = uri.strip unless uri.strip.empty? \n $all_user_data[$packet_count][:method] = method.gsub(/,/,'').strip unless method.strip.empty? \n $all_user_data[$packet_count][:time] = time.strip unless time.strip.empty?\n # extracts hour data\n time_t = $all_user_data[$packet_count][:timestamp].split(\" \")\n time_t_2 = time_t[1].split(\":\")\n $all_user_data[$packet_count][:th_hour] = time_t_2[0].to_i + 1\n $packet_count += 1\n end \n end \n #pp $all_user_data \n end",
"def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def query_times_graphs\n controller = params[:controller_name]\n action = params[:action_name]\n data = redis(logger: true).zrangebyscore(\"request_timings/total/by_action/#{controller}##{action}\",\n 1.month.ago.to_i, '+inf',\n with_scores: true)\n .map { |y, x| [x.to_f, y.to_f] }\n throw 'No Data' if data.nil? || data.empty?\n smoothed = moving_avg(data)\n final = (params[:raw].present? ? data : smoothed).map { |x, y| [Time.at(x.to_i).to_datetime, y] }\n render json: [\n { name: 'Timings', data: final }\n ]\n end",
"def create\n @report = Report.new(params[:report])\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render json: @report, status: :created, location: @report }\n else\n format.html { render action: \"new\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @report = Report.new(params[:report])\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render json: @report, status: :created, location: @report }\n else\n format.html { render action: \"new\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def report(object)\n full_name = extract_full_name object\n post 'api/report', :id => full_name\n end",
"def create\n @action_report = ActionReport.new(action_report_params)\n\n respond_to do |format|\n if @action_report.save\n format.html { redirect_to @action_report, notice: 'Action report was successfully created.' }\n format.json { render :show, status: :created, location: @action_report }\n else\n format.html { render :new }\n format.json { render json: @action_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def download_report(name, request_time, format)\n response = @client.get('arborws/reports/configured',\n api_key: @api_key, name: name,\n request_time: request_time, format: format)\n\n response\n end",
"def timesheet_params\n params.require(:timesheet).permit(:log_date, :hours_spent, :employee_id)\n end",
"def index\n @timesheets = Timesheet.all\n render json: @timesheets\n end",
"def create\n # byebug\n @time_sheet = current_user.time_sheets.new(clock_in: DateTime.now.localtime)\n\n respond_to do |format|\n if @time_sheet.save\n format.html { redirect_to @time_sheet, notice: \"Time sheet was successfully created.\" }\n format.json { render :show, status: :created, location: @time_sheet }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @time_sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @timesheet = Timesheet.new(timesheet_params)\n respond_to do |format|\n if @timesheet.save\n format.html { redirect_to @timesheet, notice: 'Timesheet was successfully created.' }\n format.json { render :show, status: :created, location: api_v1_timesheet_url(@timesheet) }\n else\n format.html { render :new }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def report_test\n report_data = params.require(:api).permit(:code,:stdout,:project,:suite,:section)\n report = api_user.test_reports.create(report_data)\n if report.valid?\n render text: \"ok\"\n else\n raise \"Invalid report\"\n end\n end",
"def temp_report\n params[:school_year] = '2018/2019'\n params[:school_id] = [7, 8, 9, 27, 30, 31]\n params[:download] = false\n gen_report\n end",
"def create\n @tps_report = TpsReport.new(params[:tps_report])\n\n respond_to do |format|\n if @tps_report.save\n format.html { redirect_to(@tps_report, :notice => 'Tps report was successfully created.') }\n format.xml { render :xml => @tps_report, :status => :created, :location => @tps_report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tps_report.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def reports\n @node = resource\n @reports = params[:kind] == \"inspect\" ? @node.reports.inspections : @node.reports.applies\n respond_to do |format|\n format.html { @reports = paginate_scope(@reports); render 'reports/index' }\n end\n end",
"def list\n @reports_fetch = Report.all\n @reports = []\n\n @reports_fetch.each do |report|\n @reports << report if current_user == report.submitter\n end\n\n render status: 200, json: @reports.as_json(methods: [:url_title_string, :report_time_ms], include: { report_status_type: {}, report_type: {}, specified_submit_to_role: {} })\n end",
"def index\n #Make sure the form has been submitted\n unless params[:report].blank?\n\n #Reset the error to nil because it persists from a previous erroneous submission\n flash[:error] = nil\n\n #Find submitted params and set as instance vars\n @room = Room.find(params[:report][:room_id]) unless params[:report][:room_id].eql? \"all\" or params[:report][:room_id].blank?\n @type_of_room = params[:report][:type_of_room] unless params[:report][:type_of_room].eql? \"all\" or params[:report][:type_of_room].blank?\n @college_name = params[:report][:college_name] unless params[:report][:college_name].eql? \"all\" or params[:report][:college_name].blank?\n @college_code = params[:report][:college_code] unless params[:report][:college_code].eql? \"all\" or params[:report][:college_code].blank?\n @affiliation = params[:report][:affiliation] unless params[:report][:affiliation].eql? \"all\" or params[:report][:affiliation].blank?\n @major = params[:report][:major] unless params[:report][:major].eql? \"all\" or params[:report][:major].blank?\n @patron_status = params[:report][:patron_status] unless params[:report][:patron_status].eql? \"all\" or params[:report][:patron_status].blank?\n\n #TODO: Move these validations into a model\n\n # Check that the timeslots are in the expected format\n if params[:report][:start_dt].match(/\\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:(00|30)/) and\n params[:report][:end_dt].match(/\\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:(00|30)/) and\n DateTime.parse(params[:report][:start_dt]) and\n DateTime.parse(params[:report][:end_dt])\n\n # Convert to datetime objects\n @start_dt = DateTime.parse(params[:report][:start_dt]).to_datetime\n @end_dt = DateTime.parse(params[:report][:end_dt]).to_datetime\n\n # Check that the end date falls after the start date\n unless @start_dt > @end_dt\n # Generate an array of conditions to be joined with logical ANDs\n conditions = []\n # Add specific room\n conditions.push(\"(room_id = '#{@room.id}')\") unless @room.nil?\n # Add specific type of room\n conditions.push(\"(room_id in (select id from rooms where type_of_room = '#{@type_of_room}'))\") unless @type_of_room.nil?\n # Add specific college name\n conditions.push(\"(user_id in (select id from users where college_name like '%#{@college_name}%'))\") unless @college_name.nil?\n # Add specific college code\n conditions.push(\"(user_id in (select id from users where college_code like '%#{@college_code}%'))\") unless @college_code.nil?\n # Add specific affiliation\n conditions.push(\"(user_id in (select id from users where dept_name like '%#{@affiliation}%'))\") unless @affiliation.nil?\n # Add specific major\n conditions.push(\"(user_id in (select id from users where major like '%#{@major}%'))\") unless @major.nil?\n # Add specific user status\n conditions.push(\"(user_id in (select id from users where patron_status like '%#{@patron_status}%'))\") unless @patron_status.nil?\n\n # Find all reservations that fall between this selected date range\n @reservations_select = Reservation.active.no_blocks.accessible_by(current_ability).where(\"#{conditions.join(' AND ')}#{\" AND \" unless conditions.empty?}((start_dt BETWEEN ? AND ?) OR (end_dt BETWEEN ? AND ?) OR (start_dt <= ? AND end_dt >= ?))\", @start_dt, @end_dt, @start_dt, @end_dt, @start_dt, @end_dt)\n @reservations = @reservations_select.page(params[:page]).per(30)\n\n # Populate a 'no data found' error if no reservations were found\n flash[:error] = \"Could not find any data for the range you selected.\" if @reservations.empty?\n else\n flash[:error] = \"Please select a valid end date that is after your selected start date.\"\n end\n else\n # Print an error message if dates are invalid\n flash[:error] = \"Please select a valid date and time in the format YYYY-MM-DD HH:MM for start and end fields. Note that minutes must be either 00 or 30.\"\n end\n\n # If there were no errors from the above checks, render report grid\n if flash[:error].blank?\n respond_to do |format|\n format.html { render :report }\n format.csv { render :csv => @reservations_select, :filename => \"reservations_report.#{Time.now.strftime(\"%Y%m%d%H%m\")}\" }\n end\n else\n # If there were error messages, render with errors\n render :index\n end\n end\n end"
] | [
"0.70921266",
"0.6761054",
"0.64973444",
"0.6496163",
"0.62217873",
"0.62083626",
"0.61755913",
"0.6170444",
"0.61321265",
"0.59996265",
"0.59521925",
"0.5950501",
"0.591422",
"0.59066695",
"0.5901786",
"0.58856946",
"0.5881303",
"0.5850961",
"0.5844043",
"0.58260477",
"0.58247995",
"0.58176416",
"0.5816359",
"0.58002365",
"0.5799877",
"0.57996714",
"0.57964903",
"0.57778907",
"0.5772701",
"0.57702464",
"0.5747842",
"0.57303673",
"0.5724077",
"0.57220435",
"0.5720163",
"0.5716942",
"0.5706647",
"0.56940025",
"0.5685729",
"0.5679449",
"0.5677111",
"0.5675666",
"0.56737494",
"0.56712425",
"0.56689346",
"0.5667538",
"0.56615955",
"0.56559503",
"0.5649009",
"0.56446075",
"0.56428915",
"0.5640279",
"0.56376845",
"0.5610984",
"0.55985326",
"0.55951774",
"0.558405",
"0.5578459",
"0.5569502",
"0.5564592",
"0.55624855",
"0.5555148",
"0.55550283",
"0.5539004",
"0.5532291",
"0.5527174",
"0.5526933",
"0.5520714",
"0.55166286",
"0.55163354",
"0.55094767",
"0.5506848",
"0.5506123",
"0.5505979",
"0.55056626",
"0.5505082",
"0.55015177",
"0.5501303",
"0.55011094",
"0.54992473",
"0.5494291",
"0.5493984",
"0.5493984",
"0.5493984",
"0.5485962",
"0.5481494",
"0.5481494",
"0.5481355",
"0.54781425",
"0.54686725",
"0.5449012",
"0.5445938",
"0.54457235",
"0.54441464",
"0.5430345",
"0.5426316",
"0.54245794",
"0.5421534",
"0.5418298",
"0.54179734"
] | 0.7346389 | 0 |
PATCH/PUT /time/time_reports/1 PATCH/PUT /time/time_reports/1.json | def update
respond_to do |format|
if @time_time_report.update(time_time_report_params)
format.html { redirect_to @time_time_report, notice: 'Time report was successfully updated.' }
format.json { render :show, status: :ok, location: @time_time_report }
else
format.html { render :edit }
format.json { render json: @time_time_report.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n if @time_report.update_attributes(params[:time_report])\n format.html { redirect_to @time_report, notice: 'Time report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @statusreport = current_user.organization.statusreports.find(params[:id])\n#for update time change date format params\n #params[:statusreport][:report_date] = change_date_format(params[:statusreport][:report_date]) if !(params[:statusreport][:report_date]).blank?\n\n\n respond_to do |format|\n if @statusreport.update_attributes(params[:statusreport])\n format.html { redirect_to @statusreport, notice: 'Statusreport was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @statusreport.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @timechart = Timechart.find(params[:id])\n\n respond_to do |format|\n if @timechart.update_attributes(params[:timechart])\n format.html { redirect_to @timechart, notice: 'Timechart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timechart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_time_time_report\n @time_time_report = Time::TimeReport.find(params[:id])\n end",
"def update\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n if @my_time_trial.update_attributes(params[:my_time_trial])\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @timing = Timing.find(params[:id])\n if @timing.update_attributes(params[:timing].slice(:start, :stop, :days, :active))\n render json: @timing\n else\n render json: { error: 'error: could not update timing' }\n end\n end",
"def update\n respond_to do |format|\n if @time_tracker.update(time_tracker_params)\n format.html { redirect_to @time_tracker, notice: 'Time tracker was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_tracker }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @time_tracker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_clock.update(time_clock_params)\n format.html { redirect_to time_sheet_index_path(@time_clock), notice: 'Time clock entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @time_clock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @poi_time.update(poi_time_params)\n format.html { redirect_to @poi_time, notice: 'Poi time was successfully updated.' }\n format.json { render :show, status: :ok, location: @poi_time }\n else\n format.html { render :edit }\n format.json { render json: @poi_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.first\n @first_time = @site.first_time\n respond_to do |format|\n if @first_time.update(first_time_params)\n format.html { redirect_to backstage_index_path, notice: 'first_time was successfully updated.' }\n # format.json { render :show, status: :ok, location: @first_time }\n else\n format.html { render :edit }\n # format.json { render json: @first_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_trial.update(time_trial_params)\n format.html { redirect_to @time_trial, notice: 'Time trial was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_trial }\n else\n format.html { render :edit }\n format.json { render json: @time_trial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n if @time_log.update_attributes(params[:time_log])\n format.html { redirect_to @time_log, notice: 'Time log was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @timesheet = Timesheet.find(params[:id])\n\n respond_to do |format|\n if @timesheet.update_attributes(params[:timesheet])\n format.html { redirect_to @timesheet, notice: 'Timesheet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_off_request = TimeOffRequest.find(params[:id])\n respond_to do |format|\n if @time_off_request.update_attributes(params[:time_off_request])\n format.html { redirect_to admin_time_off_requests_url, notice: 'Time off request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_off_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cal_time.update(cal_time_params)\n format.html { redirect_to @cal_time, notice: 'Cal time was successfully updated.' }\n format.json { render :show, status: :ok, location: @cal_time }\n else\n format.html { render :edit }\n format.json { render json: @cal_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @timing.update(timing_params)\n render :show, status: :ok, location: @timing\n else\n render json: @timing.errors, status: :unprocessable_entity\n end\n end",
"def update\n @time_entry = current_firm.all_time_entries.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to firm_time_entry_path(current_firm, @time_entry), notice: 'Time entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { index }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @timesheet.update(timesheet_params)\n format.html { redirect_to @timesheet, notice: 'Timesheet was successfully updated.' }\n format.json { render :show, status: :ok, location: api_v1_timesheet_url(@timesheet) }\n else\n format.html { render :edit }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient = Patient.find(params[:patient_id])\n @schedule = @patient.schedules.find(params[:id])\n @pill_times = @schedule.pill_times\n\n # TODO can improve it to use nested attributes\n if params[:pill_time]\n params[:pill_time].each_with_index do |pill_time, idx|\n if @pill_times[idx]\n @pill_times[idx].update_attributes(pill_time)\n else\n @pill_times.create(pill_time)\n end\n end\n end\n\n # remove unused pill times\n if params[:pill_time]\n diff = @pill_times.size - params[:pill_time].size\n @pill_times.destroy(@pill_times.last(diff)) if diff > 0\n end\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to [@patient, @schedule],\n notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @timesheet.update(timesheet_params)\n format.html { redirect_to @timesheet, notice: 'Timesheet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @planned_time = PlannedTime.find(params[:id])\n\n respond_to do |format|\n if @planned_time.update_attributes(params[:planned_time])\n format.html { redirect_to @planned_time, notice: 'Planned time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @planned_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_sheet.update(time_sheet_params)\n format.html { redirect_to @time_sheet, notice: 'Time sheet was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_sheet }\n else\n format.html { render :edit }\n format.json { render json: @time_sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_control.update(time_control_params)\n format.html { redirect_to @time_control, notice: 'Time control was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @time_control.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to admin_reports_path, notice: t('shared.msgs.success_updated',\n obj: t('activerecord.models.report', count: 1)) }\n format.json { render :show, status: :ok, location: @report }\n else\n set_date\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @call = Call.find(params[:id])\n respond_to do |format|\n if @call.update_attributes(time: DateTime.strptime(params[:call][:time], '%m/%d/%Y %H:%M'))\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @custom_report = CustomReport.find(params[:id])\n\n if @custom_report.update(params[:custom_report])\n head :no_content\n else\n render json: @custom_report.errors, status: :unprocessable_entity\n end\n end",
"def update\n @working_time = WorkingTime.find(params[:id])\n\n respond_to do |format|\n if @working_time.update_attributes(params[:working_time])\n format.html { redirect_to time_tables_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @working_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @selected_time.update(selected_time_params)\n format.html { redirect_to @selected_time, notice: 'Selected time was successfully updated.' }\n format.json { render :show, status: :ok, location: @selected_time }\n else\n format.html { render :edit }\n format.json { render json: @selected_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if UpdateTeaTime.call(@tea_time, tea_time_params)\n format.html { redirect_to profile_path, notice: 'Tea time was successfully updated.' }\n format.json { render json: @tea_time, status: :ok, location: @tea_time }\n else\n format.html { render :edit }\n format.json { render json: @tea_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_sheet.update(time_sheet_params)\n format.html { redirect_to @time_sheet, notice: \"Time sheet was successfully updated.\" }\n format.json { render :show, status: :ok, location: @time_sheet }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @time_sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # authorize @timesheet\n respond_to do |format|\n if @timesheet.update(timesheet_params)\n format.html { redirect_to company_timesheet_path(@timesheet), notice: 'Timesheet was successfully updated.' }\n format.json { render :show, status: :ok, location: @timesheet }\n else\n format.html { render :edit }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:task][:time] = parse_task_time(params[:task][:time], params[:anytime][:anytime])\n \n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(tasks_url, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @timesheet = current_user.timesheets.find(params[:id])\n\n respond_to do |format|\n if @timesheet.update_attributes(params[:timesheet])\n format.html { redirect_to @timesheet, notice: 'Timesheet was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_track = TimeTrack.find(params[:id])\n\n respond_to do |format|\n if @time_track.update_attributes(params[:time_track])\n format.html { redirect_to @time_track, notice: 'Time track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_track.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @weekly_report.published = true if @weekly_report.reported_time < Time.now\n respond_to do |format|\n if @weekly_report.update(weekly_report_params)\n format.html { redirect_to @weekly_report, notice: 'Weekly report was successfully updated.' }\n format.json { render :show, status: :ok, location: @weekly_report }\n else\n format.html { render :edit }\n format.json { render json: @weekly_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rest = Rest.where([\"id = ? AND report_id = ?\" , params[:id], params[:report_id]]).first\n\n if @rest\n respond_to do |format|\n if @rest.update_attributes({ :location => params[:location], :ended_at => DateTime.now })\n @json = Hash[:rest => {\n :id => @rest.id,\n :report_id => @rest.report_id,\n :location => @rest.location,\n :latitude => @rest.latitude,\n :longitude => @rest.longitude,\n :address => @rest.address,\n :started_at => @rest.started_at,\n :ended_at => @rest.ended_at\n }]\n format.json { render json: @json }\n else\n format.json { render json: {:error => \"Rest update failed.\"}, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.json { render json:{ :error => \"Not Acceptable:rests#update\", :status => 406 } }\n end\n end\n end",
"def update\n @event = Event.from_param(params[:event_id])\n @time_table = @event.time_tables.where(:permalink => params[:id]).first\n success = params[:time_table] && params[:time_table][:times] && \n @time_table.update_attributes(:times => JSON.parse(params[:time_table][:times]))\n success ? update_success : update_failure\n rescue JSON::ParserError\n update_failure\n end",
"def update\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n if @time_record.update_attributes(params[:time_record])\n format.html { redirect_to time_records_path, notice: 'Time record was successfully updated.' }\n format.json { render json: @time_record.to_json }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @theft_report.update(theft_report_params)\n format.html { redirect_to @theft_report, notice: 'Theft report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @theft_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @timer = Timer.find(params[:id])\n\n if @timer.update(timer_params)\n head :no_content\n else\n render json: @timer.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @time_line.update(time_line_params)\n format.html { redirect_to @time_line, notice: 'Time line was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_line }\n else\n format.html { render :edit }\n format.json { render json: @time_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_time_params\n respond_to do |format|\n if @stage_order.update(stage_order_params)\n format.html { redirect_to @stage_order, notice: 'Stage order was successfully updated.' }\n format.json { render :show, status: :ok, location: @stage_order }\n else\n format.html { render :edit }\n format.json { render json: @stage_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n if @time_point.update_attributes(params[:time_point])\n format.html { redirect_to @time_point, notice: 'Time point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @allocated_time.update(allocated_time_params)\n format.html { redirect_to @allocated_time, notice: 'Allocated time was successfully updated.' }\n format.json { render :show, status: :ok, location: @allocated_time }\n else\n format.html { render :edit }\n format.json { render json: @allocated_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meeting_time.update(meeting_time_params)\n format.html { redirect_to @meeting_time, notice: 'Meeting time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @meeting_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_timesheet\n @timesheet = Logtime.find_by_id(params[:id])\n if @timesheet\n else\n \trender json: { valid: false}, status: 404\n end\n end",
"def update\n @service_time = ServiceTime.find(params[:id])\n\n respond_to do |format|\n if @service_time.update_attributes(params[:service_time])\n format.html { redirect_to @service_time, notice: 'Service time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # authorize @timesheet\n respond_to do |format|\n if @timesheet.update(timesheet_params)\n format.html { redirect_to @timesheet, notice: 'Timesheet was successfully updated.' }\n format.json { render :show, status: :ok, location: @timesheet }\n else\n format.html { render :edit }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # authorize @timesheet\n respond_to do |format|\n if @timesheet.update(timesheet_params)\n format.html { redirect_to @timesheet, notice: 'Timesheet was successfully updated.' }\n format.json { render :show, status: :ok, location: @timesheet }\n else\n format.html { render :edit }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @time_sheet = TimeSheet.find(params[:id])\n\n respond_to do |format|\n if @time_sheet.update_attributes(params[:time_sheet])\n if params[:logged_hours].present?\n @time_sheet.logged_hours = params[:logged_hours]\n end\n @time_sheet.save!\n format.html { redirect_to @time_sheet, notice: 'Time sheet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @report = Report.find(params[:id])\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rescue_time_chart.update(rescue_time_chart_params)\n format.html { redirect_to @rescue_time_chart, notice: 'Rescue time chart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rescue_time_chart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report_date.update(report_date_params)\n format.html { redirect_to @report_date, notice: 'Report date was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @report_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_time_sheet\n @time_sheet = ProjectTimeSheet.find_by_id(params[:id])\n if @time_sheet\n else\n \trender json: { valid: false}, status: 404\n end\n end",
"def update\n @report = Report.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @report = Report.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @work_time.update(work_time_params)\n format.html { redirect_to @work_time, notice: 'Work time was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_time }\n else\n format.html { render :edit }\n format.json { render json: @work_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @expense_report\n\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n\n\n respond_to do |format|\n if @expense_report.update(expense_report_params)\n format.html { redirect_to @expense_report, notice: 'Expense report was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_report }\n else\n format.html { render :edit }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @time_period.update(time_period_params)\n render :show, status: :ok, location: @time_period\n else\n render json: @time_period.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to reports_path, notice: 'Report was successfully updated.' }\n format.json { render :index, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n @task.whenever_reset unless task_params[:every].blank? && task_params[:at].blank?\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@team_report = TeamReport.find(params[:id])\n\n respond_to do |format|\n if @team_report.update_attributes(params[:team_report])\n format.html { redirect_to team_team_report_path(:team_id => @team.id,:id => @team_report.id), notice: 'Team report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @report = Report.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n # format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n # format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @p_time.update(p_time_params)\n format.html { redirect_to @p_time, notice: 'P time was successfully updated.' }\n format.json { render :show, status: :ok, location: @p_time }\n else\n format.html { render :edit }\n format.json { render json: @p_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to report_path(@report.id), notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: report_path(@report.id) }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_user\n set_time_off\n respond_to do |format|\n if @time_off.update(time_off_params)\n format.html { redirect_to user_time_off_path(@user, @time_off), notice: 'Time off was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @time_off.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_entry.update(time_entry_params)\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_entry }\n else\n format.html { render :edit }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @one_time_stop = OneTimeStop.find(params[:id])\n\n respond_to do |format|\n if @one_time_stop.update_attributes(params[:one_time_stop])\n format.html { redirect_to @one_time_stop, notice: 'One time stop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one_time_stop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @timelog.update(timelog_params)\n format.html { redirect_to @timelog, notice: 'Timelog was successfully updated.' }\n format.json { render :show, status: :ok, location: @timelog }\n else\n format.html { render :edit }\n format.json { render json: @timelog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wait_time = WaitTime.find(params[:id])\n\n respond_to do |format|\n if @wait_time.update_attributes(params[:wait_time])\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @report = Report.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n #format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.html { redirect_to action: \"index\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_report.update(type_report_params)\n format.html { redirect_to @type_report, notice: 'Type report was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_report }\n else\n format.html { render :edit }\n format.json { render json: @type_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @work_time = WorkTime.find(params[:id])\n\n # checks if work time is successfully updated in the database\n if @work_time.update(work_time_params)\n # if updated successfully, controller issues a response according to the format given\n respond_to do |format|\n # HTML redirects the user back to the work time index and makes a notice that editing was successful\n format.html { redirect_to api_work_time_path, notice: \"Successfully edited work time!\" }\n # JSON renders the work time updated in JSON\n format.json { render json: @work_time, status: :ok }\n # XML renders the work time updated in XML\n format.xml { render xml: @work_time, status: :ok }\n end\n else\n # if errors occured like wrong information/wrong format and so on, issues a response according to format\n respond_to do |format|\n # HTML redirects the user back to the work time edit page and shows a list of errors encountered\n format.html { redirect_to edit_api_work_time_path, notice: @work_times.errors.full_messages }\n # JSON renders all errors made and shows it in JSON and gives a negative response\n format.json { render json: @work_time.errors, status: :unprocessable_entity }\n # XML renders all errors made and shows it in XML and gives a negative response\n format.xml { render xml: @work_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to reports_url, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_report.update(event_report_params)\n format.html { redirect_to @event_report, notice: 'Event report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @quarterly_report = QuarterlyReport.find(params[:id])\n\n respond_to do |format|\n if @quarterly_report.update_attributes(params[:quarterly_report])\n format.html { redirect_to(@quarterly_report, :notice => 'Quarterly report was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quarterly_report.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_record.update(time_record_params)\n @time_record.save_attendance_state\n format.html { redirect_to work_time_records_path, notice: 'Time record was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_record }\n else\n format.html { render :edit }\n format.json { render json: @time_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @submitted_timesheet.update(submitted_timesheet_params)\n format.html { redirect_to accepted_timesheets_url, notice: 'Submitted timesheet was successfully updated.' }\n format.json { render :show, status: :ok, location: @submitted_timesheet }\n else\n format.html { render :edit }\n format.json { render json: @submitted_timesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @appointment_report.update(appointment_report_params)\r\n format.html { redirect_to @appointment_report, notice: 'Reporte actualizado con exito.' }\r\n format.json { render :show, status: :ok, location: @appointment_report }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @appointment_report.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @report = current_user.reports.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @timer = Timer.find(params[:id])\n\n respond_to do |format|\n if @timer.update_attributes(params[:timer])\n format.html { redirect_to @timer, notice: 'Timer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @failure_report.update(failure_report_params)\n format.html { redirect_to @failure_report, notice: 'Failure report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @failure_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render json: { message: 'Report was successfully updated.'}, status: :created }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @daily_timesheet\n @penalty = Penalty.new\n @work_types = WorkType.all\n @penalties = Penalty.all\n respond_to do |format|\n if @daily_timesheet.update(daily_timesheet_params)\n format.html { redirect_back_or_default daily_timesheets_url, t('Record has been saved') }\n format.json { render :show, status: :ok, location: @daily_timesheet }\n else\n format.html {\n @daily_timesheet.daily_timesheet_work_types.build if @daily_timesheet.daily_timesheet_work_types.blank?\n @daily_timesheet.daily_timesheet_penalties.build if @daily_timesheet.daily_timesheet_penalties.blank?\n render :edit\n }\n format.json { render json: @daily_timesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stop_time = StopTime.find(params[:id])\n\n respond_to do |format|\n if @stop_time.update_attributes(params[:stop_time])\n format.html { redirect_to @stop_time, notice: 'Stop time was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stop_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n self.unuse_pto_hours\n if @time_off_instance.update(time_off_instance_params)\n self.use_pto_hours\n format.html { redirect_to @time_off_instance, notice: 'Time off instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_off_instance }\n else\n format.html { render :edit }\n format.json { render json: @time_off_instance.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7290955",
"0.6576943",
"0.64213574",
"0.6377546",
"0.63269603",
"0.62979215",
"0.628985",
"0.6274075",
"0.62733537",
"0.6249891",
"0.6246424",
"0.6219413",
"0.62069434",
"0.62032944",
"0.6199899",
"0.6196775",
"0.61851215",
"0.6164271",
"0.61478305",
"0.61432433",
"0.6133678",
"0.6116304",
"0.61095685",
"0.6108683",
"0.6106781",
"0.61060727",
"0.61031276",
"0.609817",
"0.6095104",
"0.60936666",
"0.60918707",
"0.60892",
"0.6078277",
"0.6077911",
"0.60684884",
"0.60645473",
"0.6046092",
"0.60442513",
"0.60424894",
"0.60381854",
"0.6029252",
"0.6028368",
"0.60266274",
"0.6026442",
"0.60247505",
"0.60197234",
"0.6014777",
"0.60101956",
"0.60100126",
"0.60100126",
"0.6006885",
"0.6004228",
"0.59990436",
"0.599554",
"0.599554",
"0.59933925",
"0.59927756",
"0.598674",
"0.598674",
"0.5980464",
"0.59772944",
"0.59754235",
"0.59713525",
"0.596274",
"0.5957009",
"0.5954218",
"0.5953271",
"0.59514",
"0.5945237",
"0.59387416",
"0.5935266",
"0.593507",
"0.59323704",
"0.59323704",
"0.59323704",
"0.59323704",
"0.59323704",
"0.59323704",
"0.59323704",
"0.59323704",
"0.59323704",
"0.5931353",
"0.5927067",
"0.5925743",
"0.592247",
"0.592247",
"0.5916812",
"0.59164786",
"0.5911009",
"0.5908915",
"0.59039766",
"0.59032124",
"0.5900577",
"0.5893811",
"0.5893525",
"0.5891728",
"0.5890589",
"0.5888211",
"0.58881795",
"0.58808625"
] | 0.7261616 | 1 |
DELETE /time/time_reports/1 DELETE /time/time_reports/1.json | def destroy
@time_time_report.destroy
respond_to do |format|
format.html { redirect_to time_time_reports_url, notice: 'Time report was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @time_report = TimeReport.find(params[:id])\n @time_report.destroy\n\n respond_to do |format|\n format.html { redirect_to time_reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy!\n render json: {status: :ok}\n end",
"def destroy\n @time_log = TimeLog.find(params[:id])\n @time_log.destroy\n\n respond_to do |format|\n format.html { redirect_to time_logs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @time_clock.destroy\n respond_to do |format|\n format.html { redirect_to time_sheet_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_period.destroy\n format.json { head :no_content }\n end",
"def destroy\n @report_date.destroy\n respond_to do |format|\n format.html { redirect_to report_dates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_time_trial = MyTimeTrial.find(params[:id])\n @my_time_trial.destroy\n\n respond_to do |format|\n format.html { redirect_to my_time_trials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timechart = Timechart.find(params[:id])\n @timechart.destroy\n\n respond_to do |format|\n format.html { redirect_to timecharts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_report.destroy\n respond_to do |format|\n format.html { redirect_to daily_reports_url, notice: 'Daily report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_record = TimeRecord.find(params[:id])\n @time_record.destroy\n\n respond_to do |format|\n format.html { redirect_to time_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_record = TimeRecord.find(params[:id])\n @time_record.destroy\n\n respond_to do |format|\n format.html { redirect_to time_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timelog.destroy\n respond_to do |format|\n format.html { redirect_to timelogs_url, notice: 'Timelog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @theft_report.destroy\n respond_to do |format|\n format.html { redirect_to theft_reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report = Report.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report = Report.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report = Report.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report = Report.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to admin_reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report = Report.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to reports_url }\n #format.json { head :ok }\n end\n end",
"def destroy\n @titletime.destroy\n respond_to do |format|\n format.html { redirect_to titletimes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_report.destroy\n respond_to do |format|\n format.html { redirect_to event_reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timesheet.destroy\n respond_to do |format|\n format.html { redirect_to timesheets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_series.destroy\n\n respond_to do |format|\n format.html { redirect_to time_series_index_url(@owner), flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.time_series.one'))} }\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 @survey_report = SurveyReport.find(params[:id])\n @survey_report.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_record.destroy\n respond_to do |format|\n format.html { redirect_to time_records_url, notice: 'Time record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rescue_time_chart.destroy\n respond_to do |format|\n format.html { redirect_to rescue_time_charts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @custom_report = CustomReport.find(params[:id])\n @custom_report.destroy\n\n head :no_content\n end",
"def destroy\n @et_report.destroy\n respond_to do |format|\n format.html { redirect_to et_reports_url, notice: '削除が完了しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_off_request = TimeOffRequest.find(params[:id])\n @time_off_request.destroy\n \n respond_to do |format|\n format.html { redirect_to admin_time_off_requests_url}\n format.json { head :ok }\n end\n end",
"def destroy\n @time_trial.destroy\n respond_to do |format|\n format.html { redirect_to '/admin', notice: 'Time trial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dailyreport = Dailyreport.find(params[:id])\n @dailyreport.destroy\n\n respond_to do |format|\n format.html { redirect_to(dailyreports_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pod_report.destroy\n respond_to do |format|\n format.html { redirect_to pod_reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timing = Timing.find(params[:id])\n @timing.destroy\n\n respond_to do |format|\n format.html { redirect_to(timings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @timecontroll.destroy\n respond_to do |format|\n format.html { redirect_to timecontrolls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hivdrugreport = Hivdrugreport.find(params[:id])\n @hivdrugreport.destroy\n\n respond_to do |format|\n format.html { redirect_to hivdrugreports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_tracker.destroy\n respond_to do |format|\n format.html { redirect_to time_trackers_url, notice: 'Time tracker was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to user_reports_url, notice: I18n.t('controllers.reports.successfully_updated') }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@team_report = TeamReport.find(params[:id])\n @team_report.destroy\n\n respond_to do |format|\n format.html { redirect_to action: :index }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crunch_report.destroy\n respond_to do |format|\n format.html { redirect_to crunch_reports_url, notice: 'Crunch report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hivcontraceptionreport = Hivcontraceptionreport.find(params[:id])\n @hivcontraceptionreport.destroy\n\n respond_to do |format|\n format.html { redirect_to hivcontraceptionreports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dynamic_report.destroy\n respond_to do |format|\n format.html { redirect_to dynamic_reports_url, notice: 'Dynamic report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_find_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @allocated_time.destroy\n respond_to do |format|\n format.html { redirect_to allocated_times_url, notice: 'Allocated time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tbdotreport = Tbdotreport.find(params[:id])\n @tbdotreport.destroy\n\n respond_to do |format|\n format.html { redirect_to tbdotreports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_time = ServiceTime.find(params[:id])\n @service_time.destroy\n\n respond_to do |format|\n format.html { redirect_to service_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cal_time.destroy\n respond_to do |format|\n format.html { redirect_to cal_times_url, notice: 'Cal time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @action_report.destroy\n respond_to do |format|\n format.html { redirect_to action_reports_url, notice: 'Action report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quarterly_report = QuarterlyReport.find(params[:id])\n @quarterly_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(quarterly_reports_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @report_content.destroy\n respond_to do |format|\n format.html { redirect_to report_contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timesheet = Timesheet.find(params[:id])\n @date = @timesheet.day\n @timesheet.destroy\n\n @timesheets = current_user.timesheets\n @title = \"My Timesheets\"\n\n respond_to do |format|\n format.html { render :index }\n format.json { head :ok }\n end\n end",
"def destroy\n @time_entry = TimeEntry.with_deleted.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timer = Timer.find(params[:id])\n @timer.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_statistic = DailyStatistic.find(params[:id])\n @daily_statistic.destroy\n\n head :no_content\n end",
"def destroy\n @time_track = TimeTrack.find(params[:id])\n @time_track.destroy\n\n respond_to do |format|\n format.html { redirect_to time_tracks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reporte = Reporte.find(params[:id])\n @reporte.destroy\n\n respond_to do |format|\n format.html { redirect_to reportes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @failure_report.destroy\n respond_to do |format|\n format.html { redirect_to failure_reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_table.destroy\n respond_to do |format|\n format.html { redirect_to time_tables_url, notice: 'Time table was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report = current_user.reports.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weekly_report.destroy\n respond_to do |format|\n format.html { redirect_to weekly_reports_url, notice: 'Weekly report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @poi_time.destroy\n respond_to do |format|\n format.html { redirect_to poi_times_url, notice: 'Poi time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timesheet = Timesheet.find(params[:id])\n @timesheet.destroy\n\n respond_to do |format|\n format.html { redirect_to timesheets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: \"Report was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: \"Report was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clinic_timing = ClinicTiming.find(params[:id])\n @clinic_timing.destroy\n\n respond_to do |format|\n format.html { redirect_to clinic_timings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @appointment_report.destroy\r\n respond_to do |format|\r\n format.html { redirect_to appointment_reports_url, notice: 'Reporte borrado con exito.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @statusreport = current_user.organization.statusreports.find(params[:id])\n @statusreport.destroy\n respond_to do |format|\n format.html { redirect_to statusreports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wait_time = WaitTime.find(params[:id])\n @wait_time.destroy\n\n respond_to do |format|\n format.html { redirect_to wait_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to admin_reports_url, notice: t('shared.msgs.success_destroyed',\n obj: t('activerecord.models.report', count: 1)) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_gap = TimeGap.find(params[:id])\n @time_gap.destroy\n\n respond_to do |format|\n format.html { redirect_to time_gaps_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client_report.destroy\n respond_to do |format|\n format.html { redirect_to client_reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n# @trip_report = TripReport.find(params[:id])\n# @trip_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(trip_reports_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @all_report.destroy\n respond_to do |format|\n format.html { redirect_to all_reports_url, notice: 'All report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @log_load_time.destroy\n respond_to do |format|\n format.html { redirect_to log_load_times_url, notice: 'Log load time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_report.destroy\n respond_to do |format|\n format.html { redirect_to type_reports_url, notice: 'Type report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doctor_timing = DoctorTiming.find(params[:id])\n @doctor_timing.destroy\n\n respond_to do |format|\n format.html { redirect_to doctor_timings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_line.destroy\n respond_to do |format|\n format.html { redirect_to time_lines_url, notice: 'Time line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def report_delete(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tdocxml=nessus_request('report/delete', post)\r\n\t\treturn docxml\r\n\tend"
] | [
"0.772896",
"0.7103305",
"0.7072272",
"0.695569",
"0.6955369",
"0.69498515",
"0.6926362",
"0.6880567",
"0.68741995",
"0.6863329",
"0.6863329",
"0.68536603",
"0.68531406",
"0.68531406",
"0.68531406",
"0.67923605",
"0.6771732",
"0.67691076",
"0.67691076",
"0.67691076",
"0.67691076",
"0.67580163",
"0.6755752",
"0.6750924",
"0.67246985",
"0.67242354",
"0.6716341",
"0.6711759",
"0.67111105",
"0.67055297",
"0.66958946",
"0.6693367",
"0.66905546",
"0.6687234",
"0.6687018",
"0.66837054",
"0.6679141",
"0.6669745",
"0.6666866",
"0.6664566",
"0.6652364",
"0.6648161",
"0.66477484",
"0.664198",
"0.66416013",
"0.66329384",
"0.662925",
"0.6627976",
"0.66265094",
"0.6622783",
"0.6617934",
"0.66167235",
"0.6615063",
"0.66114223",
"0.6610871",
"0.6607183",
"0.66012293",
"0.65992314",
"0.659626",
"0.6595724",
"0.65927947",
"0.65927947",
"0.65904915",
"0.658594",
"0.65845364",
"0.6582569",
"0.6580593",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65788835",
"0.65764844",
"0.6572336",
"0.6572336",
"0.65716475",
"0.65643066",
"0.65625626",
"0.65625536",
"0.65565825",
"0.65550894",
"0.6549721",
"0.6542843",
"0.65416676",
"0.6538891",
"0.6532725",
"0.6532468",
"0.6532392",
"0.65213823"
] | 0.7533543 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_time_time_report
@time_time_report = Time::TimeReport.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_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 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 action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; 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 before_dispatch(env); end",
"def process_action(...)\n send_action(...)\n end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def action\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def config(action, *args); end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def setup_signals; 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 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 setup\n #implement in subclass;\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; 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 setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def call\n setup_context\n super\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def duas1(action)\n action.call\n action.call\nend"
] | [
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.5328757",
"0.5310255",
"0.5300339",
"0.5298796",
"0.5295774",
"0.5256034",
"0.5243039",
"0.5236007",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.52321917",
"0.5227032",
"0.52216744",
"0.5216349",
"0.52161187",
"0.5210265",
"0.5207244",
"0.5177388",
"0.5177142",
"0.51747334",
"0.516293",
"0.51629275",
"0.5155534",
"0.51540613",
"0.515197",
"0.5151636",
"0.5145279",
"0.51380795",
"0.5135777",
"0.5117378",
"0.5115066",
"0.5115066",
"0.5110235",
"0.5106418",
"0.50917816",
"0.50909185",
"0.50855017",
"0.5082105",
"0.506359",
"0.5055345",
"0.50546116",
"0.50523037",
"0.50523037",
"0.50327307",
"0.5024364",
"0.5021113",
"0.50174654",
"0.50163317",
"0.5000553",
"0.50002855",
"0.49991882",
"0.49905527",
"0.49905527",
"0.49849054",
"0.4982546",
"0.4980941",
"0.4979153",
"0.49693102",
"0.4967172",
"0.49594432",
"0.49564302",
"0.49552485",
"0.49533385",
"0.49506924",
"0.49452737",
"0.49442786",
"0.49347955",
"0.49341312",
"0.49295264",
"0.49261844",
"0.4925649",
"0.49251428",
"0.4920729",
"0.49177617",
"0.4916373",
"0.49158472",
"0.4915794",
"0.49156648"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def time_time_report_params
params.require(:time_report).permit(:repdate, :hours, :note,:user_id,:time_reason_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def 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 |
overrides the session role key from Cul::Omniauth::RemoteIpAbility | def current_ability
@current_ability ||= Ability.new(current_user, roles: session["cul.roles"], remote_ip:request.remote_ip)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_session_role!\n unless params[:r].blank?\n if params[:r]== 'clear'\n session[:role] = nil\n session[:role_id] = nil\n else\n session[:role] = params[:r]\n session[:role_id] = params[:r_id]\n end\n end\n end",
"def session_key\n\t\treturn \"voters\"\n\tend",
"def key\n 'roleid'\n end",
"def session_passwd\n super\n end",
"def session_passwd\n super\n end",
"def session_ip\n session[:ip] = request.remote_ip\n end",
"def after_ip_authentication(_remote_ip); end",
"def role; end",
"def role; end",
"def current_role\n session.has_key?(:role) ? session[:role] : nil\n end",
"def cache_key(env)\n super(env) + env[:request_headers][Restforce::Middleware::Authorization::AUTH_HEADER].gsub(/\\s/, '')\n end",
"def cache_key(env)\n super(env) + env[:request_headers][Force::Middleware::Authorization::AUTH_HEADER].gsub(/\\s/, '')\n end",
"def session_id\n super\n end",
"def session_id\n super\n end",
"def user_role(user)\n :guest\n end",
"def current_sign_in_ip; end",
"def current_sign_in_ip; end",
"def session_key\n \"#{bot.username}:#{chat['id']}:#{from['id']}\" if chat && from\n end",
"def session_key\n\t\treturn \"candidates\"\n\tend",
"def role_auth (full_profile, full_profile_parent, profile_data, session_role_user)\n # Cleanup the current env variables, so we don't get confused\n ENV.delete('AWS_ACCESS_KEY_ID')\n ENV.delete('AWS_SECRET_ACCESS_KEY')\n ENV.delete('AWS_SESSION_TOKEN')\n ENV['AWS_ACCESS_KEY_ID'] = @token_data[full_profile_parent]['aws_access_key_id']\n ENV['AWS_SECRET_ACCESS_KEY'] = @token_data[full_profile_parent]['aws_secret_access_key']\n ENV['AWS_SESSION_TOKEN'] = @token_data[full_profile_parent]['aws_session_token']\n aws_session_json = %x( aws --output json sts assume-role --role-arn arn:aws:iam::#{profile_data['iam_number']}:role/#{profile_data['iam_role']} --role-session-name #{session_role_user} 2>&1 )\n begin\n aws_session_data = JSON.parse(aws_session_json)\n rescue Exception => e\n puts 'Failed to parse JSON from amazon. Role auth failure most likely occured.'\n puts aws_session_json\n exit 1\n end\n\n # Push this to our tokenization hash\n @token_data[full_profile] = {\n 'aws_access_key_id' => aws_session_data['Credentials']['AccessKeyId'],\n 'aws_secret_access_key' => aws_session_data['Credentials']['SecretAccessKey'],\n 'aws_session_token' => aws_session_data['Credentials']['SessionToken'],\n 'expiration' => aws_session_data['Credentials']['Expiration']\n }\nend",
"def session_key\n MfaLog.get_mfa_session_key(self.admin_id, self.ip_address)\n end",
"def admin_mode_requested_rs_key\n @admin_mode_requested_rs_key ||= { res: :current_user_mode, user: user.id, method: :admin_mode_requested? }\n end",
"def user_role\n USER_ROLE[role]\n end",
"def require_role_for(method_name)\n :anonymous\n end",
"def auth_agent_channel(session, channel, packet); end",
"def admin_mode_rs_key\n @admin_mode_rs_key ||= { res: :current_user_mode, user: user.id, method: :admin_mode? }\n end",
"def set_logged_in(ip)\n @id = BeEF::Core::Crypto::secure_token\n @nonce = BeEF::Core::Crypto::secure_token\n @ip = ip\n end",
"def rucaptcha_sesion_key_key\n warning_when_session_invalid if rucaptcha_session_id.blank?\n\n # With https://github.com/rack/rack/commit/7fecaee81f59926b6e1913511c90650e76673b38\n # to protected session_id into secret\n session_id_digest = Digest::SHA256.hexdigest(rucaptcha_session_id.inspect)\n [\"rucaptcha-session\", session_id_digest].join(\":\")\n end",
"def user_role(params)\n role = nil\n key = params.is_a?(String) ? params : (params && params.has_key?(:key) ? params[:key] : nil)\n\n unless key.blank?\n if self.moderator_key == key\n role = :moderator\n elsif self.attendee_key == key\n if BigbluebuttonRails.configuration.guest_support\n role = :guest\n else\n role = :attendee\n end\n end\n end\n role\n end",
"def session_key\n\t\treturn \"elections\"\n\tend",
"def role_name=(value)\n if value == @defaults['ai.device.roleName']\n @values.delete 'ai.device.roleName' if @values.key? 'ai.device.roleName'\n else\n @values['ai.device.roleName'] = value\n end\n end",
"def role_symbols\n [:user]\n end",
"def session_key\n @session_key\n end",
"def set_ckfinder_session\n if user_signed_in?\n roles = current_user.roles\n roles.sort_by! { |r| r.id }\n session[:ckfinder_role] = { :value => roles[0].name.downcase }\n end\n end",
"def set_ckfinder_session\n if user_signed_in?\n roles = current_user.roles\n roles.sort_by! { |r| r.id }\n session[:ckfinder_role] = { :value => roles[0].name.downcase }\n end\n end",
"def resident_key?; end",
"def authorization_mode=(mode); end",
"def session_id_key\n @session_id_key\n end",
"def session_key=(key)\n @session_key = key\n end",
"def update_session_key\n @parameters['sessionKey'] = get_session_key\n end",
"def role_data\n APP_CONFIG['roles'].find { |role| role['name'] == self.role }\n end",
"def role_name\n @values.fetch('ai.device.roleName') { \n @values['ai.device.roleName'] = nil\n }\n end",
"def login_attribute\n super\n end",
"def session_id; end",
"def session_id; end",
"def session_id; end",
"def aria_role; end",
"def authorization_mode; end",
"def authenticatable_salt\n \"#{super}#{session_token}\"\n end",
"def authenticatable_salt\n \"#{super}#{session_token}\"\n end",
"def set_session_key(key) \n if self.new_record?\n @session_key=key\n else\n ActiveRecord::Base.session_keys[session_key_id]=key\n end\n decrypt_attributes if self.class.include? Encrypted #if respond_to?(:decrypt_attributes)\n \n end",
"def authenticatable_salt\n session_id.presence || reset_session_id!\n end",
"def curAuth\n current_user.role_ids[0]\n end",
"def clear_role_switch_session\n m_logger = MarkusLogger.instance\n\n # The real_uid field of session keeps track of the uid of the original\n # user that is logged in if there is a role switch\n if !session[:real_uid].nil? && !session[:uid].nil?\n # An admin was logged in as a student or grader\n m_logger.log(\"Admin '#{User.find_by_id(session[:real_uid]).user_name}' logged out from '#{User.find_by_id(session[:uid]).user_name}'.\")\n else\n #The user was not assuming another role\n m_logger.log(\"WARNING: Possible break in attempt from '#{current_user.user_name}'.\")\n end\n clear_session\n cookies.delete :auth_token\n reset_session\n redirect_to action: 'login'\n end",
"def current_role\n \treturn @current_role if defined? @current_role\n \t@current_role = current_user && current_user.role_symbol\n end",
"def assign_role\n #self.role = Role.find_by name: '訪客' if self.role.nil?\n self.role = Role.find_by name: 'Guest' if self.role.nil?\n end",
"def role_instance\n @values.fetch('ai.device.roleInstance') { \n @values['ai.device.roleInstance'] = nil\n }\n end",
"def resident_key; end",
"def login!(session)\n session[:user_id] = self.id\n end",
"def set_session_key(key) \n @session_key=key\n self.decrypt_attributes if self.class.include? Encrypted\n end",
"def get_ip\n session_gc\n session_create\n\n ip = @sessions.keys[Kernel.rand(@sessions.length)]\n @sessions[ip] += 1\n return ip\n end",
"def role_instance=(value)\n if value == @defaults['ai.device.roleInstance']\n @values.delete 'ai.device.roleInstance' if @values.key? 'ai.device.roleInstance'\n else\n @values['ai.device.roleInstance'] = value\n end\n end",
"def after_ip_authentication\n end",
"def check_session_ip_binding\n return true unless logged_in?\n if !session[:session_ip].nil? && session[:session_ip] != request.headers['REMOTE_ADDR']\n # client IP has changed\n session_log(\"IP changed from #{session[:session_ip]} to #{request.headers['REMOTE_ADDR']}\")\n expire_session\n else\n # Assign client IP\n session[:session_ip] = request.headers['REMOTE_ADDR']\n return true\n end\n end",
"def roles_with_permission\n shift.location.loc_group.roles\n end",
"def roleid\n [ account, kind, identifier ].join(':')\n end",
"def block_ip_in_session\n # Checks, exists or not\n if session[:count_card_validation].blank?\n session[:count_card_validation] = 1\n elsif session[:count_card_validation] < 2\n # Increment a count of validation\n session[:count_card_validation] += 1\n else\n # Set inactive the account\n @account.attributes = {:active => 0}\n @account.save\n\n # Clear session\n session[:count_card_validation] = nil\n\n # Add ip to blocked ip\n @blocked_ip = BlockedIp.new(:ip => request.remote_ip)\n @blocked_ip.save\n end\n end",
"def load_permissions_from_guest_role\n guest_permission_sets = PortAuthority::guest_role.permission_sets.entries\n\n Hash.new do |h, k|\n h[k] = guest_permission_sets.detect { |set| set.name == k } || SessionPermissionSet.new(k, 0)\n end\n end",
"def default_role\n self.role_id = Role.user.id\n end",
"def edit_password\n @session_user = current_session_user\n end",
"def method_missing(sym, *args, &blk)\n if authenticated? and delegating?(sym)\n current_session.send(sym, *args, &blk)\n else\n super\n end\n end",
"def role(role, server)\n @roles[role] ||= []\n @roles[role] << server\n end",
"def role_symbols\n @location.present? ? [:live_location] : []\n end",
"def host_authorization=(_arg0); end",
"def host_authorization=(_arg0); end",
"def authen_method_guest!()\n @authen_method = TAC_PLUS_AUTHEN_METH_GUEST\n end",
"def restore_previous_session\n # Assume previous session belongs to user\n restore_previous_non_admin_session\n current_user.setRole('admin') if user_project_admin?\n end",
"def resident_credential; end",
"def name\n\t\t\"Incognito\"\n\tend",
"def current_ability\n\t\t\t@current_ability ||= Ability.new(current_user, roles: session[\"cul.roles\"], remote_ip: request.remote_ip)\n\t\tend",
"def authenticate_by_ip\n return true if CACM::CRAWLER_IPS.include?(request.remote_ip)\n return false if CACM::CRAWLER_AGENTS =~ request.user_agent\n current_member.authenticate_ip(request.remote_ip) if current_member.inst?.nil?\n end",
"def check_role\n user_id = session[:user_id]\n redirect_to '/auth/bauth' unless user_id.present? &&\n session[:expires_at] > Time.current\n end",
"def guild_role\n\t\t@guild_role\n\tend",
"def capable_login_auth?; end",
"def role_symbols\n # Think trice before changing this!\n [:soker]\n end",
"def role\n if self.admin || (Setting.no_security == \"true\")\n return :admin\n elsif self.reviewer\n return :reviewer\n else\n return :default\n end\n end",
"def create\n if params and params[:user]\n @role = params[:user][:role] \n \n user_session[\"role\"] = @role if user_session\n end\n super\n end",
"def set_role_url(url, role_index=0)\n implementation[\"roles\"][role_index][\"role_url\"]=url\n end",
"def set_session\n \n end",
"def user_roles=(value)\n roles[:user_roles]=value\n end",
"def host_authorization; end",
"def host_authorization; end",
"def get_role\n\t\tself.role\n\tend",
"def resident_credential?; end",
"def setup_ip\n @request = ActionController::TestRequest.create(self.class.controller_class)\n @request.remote_addr = \"127.0.0.1\"\n session[:user_id] = 1\n end",
"def edit\n if params[:invitation_token]\n session[:invitation_token] = params[:invitation_token]\n end\n super\n end",
"def choose_password\n session_scoped_by_site do\n @user_session = UserSession.new\n end\n end",
"def r_key_auth_code\n \"auth_code:#{telephone}\"\n end",
"def cracker_session_id\n @session_id ||= ::Rex::Text.rand_text_alphanumeric(8)\n end",
"def kube2iam_params(config)\n {\n 'host' => {\n 'iptables' => true,\n 'interface' => 'eni+'\n },\n 'extraArgs' => {\n 'base-role-arn' => \"arn:aws:iam::#{account_number}:role/\",\n 'default-role' => Create::NodeRoleFinder.call(config)\n }.compact\n }\n end"
] | [
"0.57071483",
"0.55735743",
"0.5524688",
"0.5394851",
"0.5394851",
"0.5393864",
"0.53375196",
"0.5287679",
"0.5287679",
"0.5272336",
"0.5268222",
"0.5217467",
"0.5199451",
"0.5199451",
"0.5177186",
"0.5172258",
"0.5172258",
"0.5126305",
"0.510549",
"0.5102342",
"0.50966513",
"0.50895554",
"0.50707835",
"0.50672287",
"0.5052613",
"0.5049735",
"0.50367796",
"0.5026201",
"0.5014991",
"0.50063103",
"0.4999585",
"0.49912712",
"0.49762836",
"0.4975446",
"0.4975446",
"0.49590766",
"0.49590233",
"0.49484637",
"0.4946798",
"0.49464825",
"0.49291417",
"0.49262285",
"0.4923372",
"0.4921346",
"0.4921346",
"0.4921346",
"0.49180907",
"0.48970205",
"0.48959422",
"0.48959422",
"0.48824558",
"0.4874376",
"0.4870394",
"0.48681915",
"0.4854124",
"0.48402628",
"0.48328453",
"0.4832437",
"0.48313352",
"0.4826839",
"0.48155582",
"0.47822836",
"0.47742337",
"0.47605458",
"0.4758815",
"0.47481793",
"0.47444245",
"0.47421074",
"0.47414967",
"0.47411218",
"0.47407255",
"0.4734845",
"0.47267848",
"0.47014198",
"0.47014198",
"0.46969315",
"0.46957064",
"0.46950957",
"0.4692589",
"0.46846884",
"0.46805206",
"0.4672895",
"0.46692866",
"0.4667253",
"0.4666191",
"0.46580005",
"0.4654972",
"0.46537092",
"0.4645742",
"0.46430364",
"0.46397772",
"0.46397772",
"0.46355233",
"0.46253994",
"0.4618605",
"0.46179223",
"0.46154168",
"0.461501",
"0.46026185",
"0.45935658"
] | 0.46817338 | 80 |
translate a label into a rfc5987 encoded header value see also | def label_to_content_disposition(label,attachment=false)
value = attachment ? 'attachment; ' : 'inline'
value << "; filename*=utf-8''#{label.gsub(' ','%20').gsub(',','%2C')}"
value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate_header(header, value)\n value\n end",
"def encode_header(s); s; end",
"def download_label(value)\n value.tr(\"-\", \" \").capitalize\n end",
"def label=(label)\n @label = label.to_s.gsub(\" \",\"_\").without_superscript_characters.to_sym\n end",
"def markup_header(header, value, translate)\n value\n end",
"def decode_hostname(hostname); end",
"def value\n @header.input.value.to_s.strip\n end",
"def parsed_label_uri(value)\n value.split('$').first\n end",
"def parse_header(io)\n\t variable_name = nil\n\t parse_pairs io do |code, value|\n\t\tcase code\n\t\t when '0' then next\n\t\t when '9'\n\t\t\tvariable_name = value\n\t\t else\n\t\t\theader[variable_name] = value\n\t\tend\n\t end\n\tend",
"def sanitize_label(label); end",
"def convert_header(h)\n changed_header = h.to_s.downcase.gsub('-', '').gsub(' ','_')\n (User::HEADERS[changed_header].present? ? User::HEADERS[changed_header] : changed_header).intern\n end",
"def sanitize_header(header, value)\n value\n end",
"def header_to_id(given)\n return '' unless given.is_a?(String)\n return '' unless given.match(/\\A[a-z\\d]{16,32}\\z/i)\n given\n end",
"def header(h, buffer = \"\")\n rep = HEADREP[h[:type]]\n\n if h[:type] == :indexed\n buffer << integer(h[:name], rep[:prefix])\n\n else\n if h[:name].is_a? Integer\n buffer << integer(h[:name]+1, rep[:prefix])\n else\n buffer << integer(0, rep[:prefix])\n buffer << string(h[:name])\n end\n\n if h[:type] == :substitution\n buffer << integer(h[:index], 0)\n end\n\n if h[:value].is_a? Integer\n buffer << integer(h[:value], 0)\n else\n buffer << string(h[:value])\n end\n end\n\n # set header representation pattern on first byte\n fb = buffer[0].unpack(\"C\").first | rep[:pattern]\n buffer.setbyte(0, fb)\n\n buffer\n end",
"def id_to_header(id)\n id.to_s(16)\n end",
"def compose_header(key, value)\n Util.escape_zero_byte(\"#{key}: #{value}\")\n end",
"def label_as label\n @label = label\n end",
"def handle_label(label, lineno_column)\n Literal.new label[0..-2].to_sym\n end",
"def label_to_content_disposition(label, attachment = false)\n safe_label = label.gsub(' ', '%20').gsub(',', '%2C')\n # The two adjacent single quotes in the line below look weird, but are correct:\n (attachment ? 'attachment; ' : 'inline') + \"; filename*=utf-8''\" + safe_label\n end",
"def id_to_header(id)\n return '' unless id.is_a?(String)\n # Only send 64bit IDs downstream for now\n id.length == 32 ? id[16..-1] : id\n end",
"def prepare_label_for_translator(label)\n validate_language_rule\n \n substitution_value = \"\" \n substitution_value << sanitized_name if allowed_in_translation?\n substitution_value << \" \" unless substitution_value.blank?\n substitution_value << language_rule.default_transform(self, piped_params)\n \n label.gsub(full_name, substitution_value) \n end",
"def header(buf)\n peek = buf.readbyte(0)\n\n header = {}\n header[:type], type = HEADREP.select do |t, desc|\n mask = (peek >> desc[:prefix]) << desc[:prefix]\n mask == desc[:pattern]\n end.first\n\n header[:name] = integer(buf, type[:prefix])\n if header[:type] != :indexed\n header[:name] -= 1\n\n if header[:name] == -1\n header[:name] = string(buf)\n end\n\n if header[:type] == :substitution\n header[:index] = integer(buf, 0)\n end\n\n header[:value] = string(buf)\n end\n\n header\n end",
"def write_custom_label_str(label)\n value = label[:value]\n font = label[:font]\n is_y_axis = 0\n has_formatting = has_fill_formatting(label)\n\n # Write the c:layout element.\n write_layout\n\n @writer.tag_elements('c:tx') do\n # Write the c:rich element.\n write_rich(value, font, is_y_axis, !has_formatting)\n end\n\n # Write the c:cpPr element.\n write_sp_pr(label)\n end",
"def canonicalize_header(header)\n header.to_s.split(/[\\-_]/).map(&:capitalize).join('-')\n end",
"def label(lname)\n $labels[lname] = $iptr\nend",
"def convert text\n label = convert_flow @am.flow text\n\n CGI.escape(label).gsub('%', '-').sub(/^-/, '')\n end",
"def normalize_header(str)\n str.upcase.gsub('-', '_')\n end",
"def label\n @params['label']\n end",
"def header_id\n @pairs.fetch(\"id\") { header_value.downcase.gsub(/[^\\w]|_/, \"-\") }\n end",
"def label= value\n @fedora_object.label = value\n end",
"def normalize_header(header)\n return nil if header.nil?\n header.downcase.split.join(\"_\").chomp('?')\nend",
"def label\r\n\t\tname.match(/\\?$/) ? name : name + \":\"\r\n\tend",
"def rfc_2045_value; end",
"def label\n raise \"Label provider key :label must be set to produce the text of the message!\" unless @data[:label]\n @data[:label]\n end",
"def header(h, buffer = Buffer.new)\n rep = HEADREP[h[:type]]\n\n if h[:type] == :indexed\n buffer << integer(h[:name], rep[:prefix])\n\n else\n if h[:name].is_a? Integer\n buffer << integer(h[:name]+1, rep[:prefix])\n else\n buffer << integer(0, rep[:prefix])\n buffer << string(h[:name])\n end\n\n if h[:type] == :substitution\n buffer << integer(h[:index], 0)\n end\n\n if h[:value].is_a? Integer\n buffer << integer(h[:value], 0)\n else\n buffer << string(h[:value])\n end\n end\n\n # set header representation pattern on first byte\n fb = buffer[0].unpack(\"C\").first | rep[:pattern]\n buffer.setbyte(0, fb)\n\n buffer\n end",
"def label_translation; end",
"def normalize_header!\n @gsi.dsc = HeaderOption::DSC::TELETEXT_LEVEL_2\n @gsi.lc = @gsi.lc.to_i.to_s.rjust(2,'0')\n @gsi.tnb = @gsi.tnb.to_i.to_s.rjust(5,'0')\n @gsi.tns = @gsi.tns.to_i.to_s.rjust(5,'0')\n @gsi.tng = @gsi.tng.to_i.to_s.rjust(3,'0')\n @gsi.tcp = @gsi.tcp[0..1].to_i.to_s.ljust(2,'0') + \n @gsi.tcp[2..3].to_i.to_s.ljust(2,'0') +\n @gsi.tcp[4..5].to_i.to_s.ljust(2,'0') +\n @gsi.tcp[6..7].to_i.to_s.ljust(2,'0')\n @gsi.tcf = @gsi.tcf[0..1].to_i.to_s.ljust(2,'0') +\n @gsi.tcf[2..3].to_i.to_s.ljust(2,'0') +\n @gsi.tcf[4..5].to_i.to_s.ljust(2,'0') +\n @gsi.tcf[6..7].to_i.to_s.ljust(2,'0')\n @gsi.co = @gsi.co.upcase\n end",
"def rfc_name\n RFC_NAMES[name]\n end",
"def label=(label)\n @label = label.to_sym\n end",
"def label=(label)\n @label = label.to_sym\n end",
"def update_label(label, bytepos); end",
"def parse_header(string)\n {\n # identificação do registro header (conteúdo 0)\n :tipo_registro => string[0..0].to_i,\n # identificação do arquivo retorno\n :codigo_retorno => string[1..1],\n # identificação por extenso do tipo de movimento\n :literal_retorno => string[2..8],\n # identificação do tipo de serviço\n :codigo_servico => string[9..10],\n # identificação por extenso do tipo de serviço\n :literal_servico => string[11..25],\n # código da empresa no bradesco\n :codigo_empresa => string[26..45].strip,\n # razão social da empresa\n :razao_social => string[46..75],\n # número do banco na câmara de compensação\n :codigo_banco => string[76..78],\n # nome por extenso do banco cobrador\n :nome_banco => string[79..93].strip,\n # data de geração do arquivo\n :data_geracao => convert_date(string[94..99]),\n # brancos\n #:brancos1 => string[100..107],\n # número aviso bancário\n :numero_aviso_bancario => string[108..112],\n # brancos\n #:brancos2 => string[113..378],\n # data de crédito dos lançamentos\n :data_credito => convert_date(string[379..384]),\n # brancos\n #:brancos3 => string[385..393],\n # número sequencial do registro no arquivo\n :numero_sequencial => string[394..399]\n }\n end",
"def label\r\n\t\t\tname.match(/\\?$/) ? name : name + \":\"\r\n\t\tend",
"def store_header #:nodoc:\n record = 0x0014 # Record identifier\n # length # Bytes to follow\n\n str = @header # header string\n cch = str.length # Length of header string\n encoding = @header_encoding # Character encoding\n\n\n # Character length is num of chars not num of bytes\n cch /= 2 if encoding != 0\n\n # Change the UTF-16 name from BE to LE\n str = str.unpack('v*').pack('n*') if encoding != 0\n\n length = 3 + str.length\n\n header = [record, length].pack('vv')\n data = [cch, encoding].pack('vC')\n\n prepend(header, data, str)\n end",
"def header(buf)\n peek = buf.getbyte\n buf.seek(-1, IO::SEEK_CUR)\n\n header = {}\n header[:type], type = HEADREP.select do |t, desc|\n mask = (peek >> desc[:prefix]) << desc[:prefix]\n mask == desc[:pattern]\n end.first\n\n header[:name] = integer(buf, type[:prefix])\n if header[:type] != :indexed\n header[:name] -= 1\n\n if header[:name] == -1\n header[:name] = string(buf)\n end\n\n if header[:type] == :substitution\n header[:index] = integer(buf, 0)\n end\n\n header[:value] = string(buf)\n end\n\n header\n end",
"def is_label?(tok)\n #a label is defined as: 1st character = letter, followed by upto 10 chars/digits, followed by \":\"\n return tok.chop if ( (tok =~ /[A-Z_a-z]\\w{0,10}:$/) == 0) and tok[-1] == 58\n return nil\n end",
"def sanitize_header_field(value)\n value.to_s\n .gsub(\"\\r\\n\", \"\\n\")\n .gsub(HEADER_FIELD_SANITIZER_PATTERN, HEADER_FIELD_SANITIZER_MAPPING)\n end",
"def normalize_header_name(header)\n header.delete_prefix(\"HTTP_\").split(\"_\").map(&:capitalize).join(\"-\")\n end",
"def label value\n @grpc.apply_label_transformer = value\n self\n end",
"def rack_helper(header)\n \"HTTP_#{header.to_s.upcase.gsub(/[-\\s]/, '_')}\"\n end",
"def label_for_table\r\n label.to_s.gsub(/ /, '_').downcase\r\n end",
"def to_s(raw_name = nil)\n r = raw_name || (block_given? ? yield(key) : raw)\n \"#{r}#{Redhead::HEADER_NAME_VALUE_SEPARATOR_CHARACTER} #{value}\"\n end",
"def normalize_header_name(name)\n name.\n # remove heading HTTP if present\n sub(/^#{RACK_PREFIX}/, '').\n # split on underscore\n split('_').\n # transform UPCASE to Upcase\n map(&:capitalize).\n # join back on a dash\n join('-')\n end",
"def header(name)\n @responseheaders[name.downcase]\n end",
"def parse_header(string)\n {\n # identificação do registro header\n :tipo_registro => string[0..0].to_i,\n # identificação do arquivo retorno\n :codigo_retorno => string[1..1],\n # identificação por extenso do tipo de movimento\n :literal_retorno => string[2..8],\n # identificação do tipo de serviço\n :codigo_servico => string[9..10],\n # identificação por extenso do tipo de serviço\n :literal_servico => string[11..25],\n # agência mantenedora da conta\n :agencia => string[26..29],\n # complemento de registro\n :zeros => string[30..31],\n # número da conta corrente da empresa\n :conta => string[32..36],\n # dígito de auto-conferência ag/conta empresa\n :dac => string[37..37],\n # complemento do registro\n #:brancos1 => string[38..45],\n # nome por extenso da \"empresa mãe\"\n :nome_empresa => string[46..75],\n # número do banco na câmara de compensação\n :codigo_banco => string[76..78],\n # nome por extenso do banco cobrador\n :nome_banco => string[79..93].strip,\n # data de geração do arquivo\n :data_geracao => string[94..99],\n # unidade de densidade\n :densidade => string[100..104],\n # densidade de gravação do arquivo\n :unidade_densidade => string[105..107],\n # número sequencial do arquivo retorno\n :numero_sequencial_arquivo_retorno => string[108..112],\n # data de crédito dos lançamentos\n :data_credito => string[113..118],\n # complemento do registro\n #:brancos2 => string[119..393],\n # número sequencial do registro no arquivo\n :numero_sequencial => string[394..399]\n }\n end",
"def label_as_filename\n str = label.to_s\n if str.empty?\n str.object_id\n else\n str.sub(/\\W+/, '-')\n end\n end",
"def transform_headers( str, rs )\n\t\t\t@log.debug \" Transforming headers\"\n\n\t\t\t# Setext-style headers:\n\t\t\t#\t Header 1\n\t\t\t#\t ========\n\t\t\t#\n\t\t\t#\t Header 2\n\t\t\t#\t --------\n\t\t\t#\n\n\t\t\tsection_numbers = [nil, nil, nil, nil, nil]\n\n\t\t\tstr.\n\t\t\t\tgsub( HeaderRegexp ) {|m|\n\t\t\t\t\tif $1 then\n\t\t\t\t\t\t@log.debug \"Found setext-style header\"\n\t\t\t\t\t\ttitle, id, hdrchar = $1, $2, $3\n\n\t\t\t\t\t\tcase hdrchar\n\t\t\t\t\t\twhen '='\n\t\t\t\t\t\t\tlevel = 1\n\t\t\t\t\t\twhen '-'\n\t\t\t\t\t\t\tlevel = 2\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t@log.debug \"Found ATX-style header\"\n\t\t\t\t\t\thdrchars, title, id = $4, $5, $6\n\t\t\t\t\t\tlevel = hdrchars.length\n\n\t\t\t\t\t\tif level >= 7 then\n\t\t\t\t\t\t\trs.warnings << \"illegal header level - h#{level} ('#' symbols are too many)\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tprefix = ''\n\t\t\t\t\tif rs.numbering? then\n\t\t\t\t\t\tif level >= rs.numbering_start_level and level <= 6 then\n\t\t\t\t\t\t\tdepth = level - rs.numbering_start_level\n\n\t\t\t\t\t\t\tsection_numbers.each_index do |i|\n\t\t\t\t\t\t\t\tif i == depth and section_numbers[depth] then\n\t\t\t\t\t\t\t\t\t# increment a deepest number if current header's level equals last header's\n\t\t\t\t\t\t\t\t\tsection_numbers[i] += 1\n\t\t\t\t\t\t\t\telsif i <= depth then\n\t\t\t\t\t\t\t\t\t# set default number if nil\n\t\t\t\t\t\t\t\t\tsection_numbers[i] ||= 1\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t# clear discardeds\n\t\t\t\t\t\t\t\t\tsection_numbers[i] = nil\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\tno = ''\n\t\t\t\t\t\t\t(0..depth).each do |i|\n\t\t\t\t\t\t\t\tno << \"#{section_numbers[i]}.\"\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\tprefix = \"#{no} \"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\ttitle_html = apply_span_transforms( title, rs )\n\n\t\t\t\t\tunless id then\n\t\t\t\t\t\tcase rs.header_id_type\n\t\t\t\t\t\twhen HeaderIDType::ESCAPE\n\t\t\t\t\t\t\tid = escape_to_header_id(title_html)\n\t\t\t\t\t\t\tif rs.headers.find{|h| h.id == id} then\n\t\t\t\t\t\t\t\trs.warnings << \"header id collision - #{id}\"\n\t\t\t\t\t\t\t\tid = \"bfheader-#{Digest::MD5.hexdigest(title)}\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tid = \"bfheader-#{Digest::MD5.hexdigest(title)}\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\ttitle = \"#{prefix}#{title}\"\n\t\t\t\t\ttitle_html = \"#{prefix}#{title_html}\"\n\n\n\t\t\t\t\tunless id =~ IdRegexp then\n\t\t\t\t\t\trs.warnings << \"illegal header id - #{id} (legal chars: [a-zA-Z0-9_-.] | 1st: [a-zA-Z])\"\n\t\t\t\t\tend\n\n\t\t\t\t\tif rs.block_transform_depth == 1 then\n\t\t\t\t\t\trs.headers << RenderState::Header.new(id, level, title, title_html)\n\t\t\t\t\tend\n\n\t\t\t\t\tif @use_header_id then\n\t\t\t\t\t\t%{<h%d id=\"%s\">%s</h%d>\\n\\n} % [ level, id, title_html, level ]\n\t\t\t\t\telse\n\t\t\t\t\t\t%{<h%d>%s</h%d>\\n\\n} % [ level, title_html, level ]\n\t\t\t\t\tend\n\t\t\t\t}\n\t\tend",
"def to_s!(raw_name = nil)\n r = raw_name || (block_given? ? yield(key) : TO_RAW[key])\n \"#{r}#{Redhead::HEADER_NAME_VALUE_SEPARATOR_CHARACTER} #{value}\"\n end",
"def label\n key.sub('fullname', 'full name').capitalize\n end",
"def header(name, value)\n name = name.upcase\n name.tr!('-', '_')\n name = \"HTTP_#{name}\" unless name == 'CONTENT_TYPE' || name == 'CONTENT_LENGTH'\n env(name, value)\n end",
"def decode(msg)\n if(msg.to_s(2).length == 112)\n df, ca, icao, me, pi = self.parse_segment_msg(msg)\n if(self.is_identification_tc(me))\n return (error, tc, ca, name = self.decode_icao_value(me))\n end\n\n else\n return \"NOT_VALID_LENGTH_TRAME\", nil\n end\n end",
"def encode_hostname(hostname); end",
"def OPRLabel(text:)\n {\n type: \"label\",\n text: text\n }\nend",
"def label\n parse_normal_range\n if self.critical? \n return \"critical\" \n elsif self.warning? \n return \"warning\"\n else\n return \"\"\n end\n end",
"def label=(value)\n @label = value\n end",
"def view_label(value)\n value.tr(\"-\", \" \").capitalize\n end",
"def match_hostname( val )\n\t\tmatch = RFC1738Hostname.match( val )\n\t\treturn match ? match[0] : nil\n\tend",
"def id_to_header(id)\n unless id.is_a?(Integer) || id.is_a?(String)\n Instana.logger.debug \"id_to_header received a #{id.class}: returning empty string\"\n return String.new\n end\n [id.to_i].pack('q>').unpack('H*')[0].gsub(/^0+/, '')\n rescue => e\n Instana.logger.info \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n end",
"def header(buf)\n peek = buf.readbyte(0)\n\n header = {}\n header[:type], type = HEADREP.find do |_t, desc|\n mask = (peek >> desc[:prefix]) << desc[:prefix]\n mask == desc[:pattern]\n end\n\n fail CompressionError unless header[:type]\n\n header[:name] = integer(buf, type[:prefix])\n\n case header[:type]\n when :indexed\n fail CompressionError if (header[:name]).zero?\n header[:name] -= 1\n when :changetablesize\n header[:value] = header[:name]\n else\n if (header[:name]).zero?\n header[:name] = string(buf)\n else\n header[:name] -= 1\n end\n header[:value] = string(buf)\n end\n\n header\n end",
"def format _label, _value\n raise NotImplementedError, self\n end",
"def locale_from_http_header\n language = request.env['HTTP_ACCEPT_LANGUAGE']\n unless language.blank?\n http_locale = language.scan(/^[a-z]{2}-[A-Z]{2}/)\n unless http_locale.blank?\n http_locale = http_locale.first\n else\n http_locale = language.scan(/^[a-z]{2}/).first\n end\n end\n end",
"def parse_header(raw)\n header = {}\n field = nil\n\n raw.each_line do |line|\n case line\n when /^([A-Za-z0-9!\\#$%&'*+\\-.^_`|~]+):\\s*(.*?)\\s*\\z/om\n field, value = $1, $2\n header[field] = value\n when /^\\s+(.*?)\\s*\\z/om\n value = $1\n fail \"bad header '#{line}'.\" unless field\n\n header[field][-1] << ' ' << value\n else\n fail \"bad header '#{line}'.\"\n end\n end\n\n header.each do |key, value|\n value.strip!\n value.gsub!(/\\s+/, ' ')\n end\n\n header\n end",
"def label(rule, label, &block)\n ext(Label.new(label, rule), block)\n end",
"def prep_header_str(entity:)\n TraceHeader.from_entity(entity: entity).header_string\n end",
"def map_protocol_value(protocol)\n protocol = protocol.downcase\n case protocol\n when \"other\"\n return \"\"\n when \"other-tls\"\n return \"\"\n end\n return protocol\n end",
"def header(h, buffer = Buffer.new)\n rep = HEADREP[h[:type]]\n\n case h[:type]\n when :indexed\n buffer << integer(h[:name] + 1, rep[:prefix])\n when :changetablesize\n buffer << integer(h[:value], rep[:prefix])\n else\n if h[:name].is_a? Integer\n buffer << integer(h[:name] + 1, rep[:prefix])\n else\n buffer << integer(0, rep[:prefix])\n buffer << string(h[:name])\n end\n\n buffer << string(h[:value])\n end\n\n # set header representation pattern on first byte\n fb = buffer.ord | rep[:pattern]\n buffer.setbyte(0, fb)\n\n buffer\n end",
"def label(rule, label, &block)\n rule = ext(rule, block)\n rule.label = label\n rule\n end",
"def label_plain\n Redcap::Utilities.html_to_plain_text label\n end",
"def label=(val)\n @label << val\n end",
"def decode_raw_header\n decoded_header = Ether.new\n decoded_header.read(payload)\n end",
"def label\n @attributes[:label]\n end",
"def name label\n label(label)\n end",
"def convert_header_to_ms(str)\n str = str.gsub(/t=|\\./, '')\n \"#{str[0,10]}.#{str[10,13]}\".to_f\n end",
"def convert_header_to_ms(str)\n str = str.gsub(/t=|\\./, '')\n \"#{str[0,10]}.#{str[10,13]}\".to_f\n end",
"def format_header(header, close: ':', upcase: true)\n header.squish!\n header[0] = header[0].upcase if upcase\n header += close\nend",
"def get_http_header line\n return nil if not is_http_header? line\n parts = line.split(':')\n {parts[0].strip => parts[1].strip}\n end",
"def rdf_label\n labels = Array.wrap(self.class.rdf_label)\n labels += default_labels\n labels.each do |label|\n values = get_values(label)\n return values unless values.empty?\n end\n node? ? [] : [rdf_subject.to_s]\n end",
"def []=(k, v) @headers[translate_header_to_sym(k)] = v end",
"def unescape(s); s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n){[$1.delete('%')].pack('H*')} end",
"def title() headers['title'] end",
"def header_for_string string\n header = string.length << 1 # make room for a low bit of 1\n header = header | 1 # set the low bit to 1\n pack_int header\n end",
"def get_utf8_of(character)\n character.unpack('H*').first.upcase\nend",
"def label_with_id\n text_and_id( :label )\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def header(string, replace=true, http_response_code=nil)\n name, value = string.split(': ', 2)\n headers[name] = value\n end",
"def header(label)\n @lines << ''\n @lines << TColor.blue { label }\n end",
"def header_to_id(header_id)\n header_id.to_i(16)\n end",
"def unquote_header(value)\n if value =~ QUOTED\n $1\n else\n value\n end\n end",
"def canonize_header_value(value)\n value = value.first if value.is_a?(Array) && value.count == 1 # ary with 1 could be hidden multi-val\n value = value.split(',').map(&:strip) if value.is_a?(String) # multi-vals can hide as ','-separated String\n value\n end"
] | [
"0.6996217",
"0.6041654",
"0.5584373",
"0.55744535",
"0.5564824",
"0.5467604",
"0.54429823",
"0.5427848",
"0.54235256",
"0.541773",
"0.53974086",
"0.5383139",
"0.5373882",
"0.53735423",
"0.5372769",
"0.53723717",
"0.5364748",
"0.5357917",
"0.53317016",
"0.5314928",
"0.5265331",
"0.5213785",
"0.5210823",
"0.52068007",
"0.5197124",
"0.51940644",
"0.5188892",
"0.51794046",
"0.517804",
"0.5169412",
"0.51648736",
"0.5152819",
"0.5140727",
"0.51335716",
"0.51306576",
"0.5128558",
"0.51180416",
"0.5108979",
"0.5104917",
"0.5104917",
"0.51005334",
"0.5097066",
"0.5093119",
"0.50785863",
"0.5076499",
"0.50690955",
"0.505603",
"0.5040672",
"0.502962",
"0.50195485",
"0.5017953",
"0.5016762",
"0.5011612",
"0.5009387",
"0.5001151",
"0.49930418",
"0.49895865",
"0.4980652",
"0.49752223",
"0.49588665",
"0.49508816",
"0.4945381",
"0.4935196",
"0.491635",
"0.49117088",
"0.4903364",
"0.4882165",
"0.48753205",
"0.48750767",
"0.48731688",
"0.48724532",
"0.48719475",
"0.48713675",
"0.48664123",
"0.4865203",
"0.48612532",
"0.48566684",
"0.48321867",
"0.48298454",
"0.48271418",
"0.48200864",
"0.48193982",
"0.4818464",
"0.4818464",
"0.48143157",
"0.4814061",
"0.48087534",
"0.48068744",
"0.48046976",
"0.48039228",
"0.48029837",
"0.4799396",
"0.4798167",
"0.4798167",
"0.4798167",
"0.47929534",
"0.47792536",
"0.47764507",
"0.47749403",
"0.47706547"
] | 0.5250433 | 21 |
shims from Blacklight 6 controller fetch to BL 7 search service | def search_service
Blacklight::SearchService.new(config: blacklight_config, user_params: {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_custom_search_params; end",
"def service\n :search\n end",
"def search(builder)\n send_and_receive connection_config[:url], builder.blacklight_params\n end",
"def search_implementation(args)\n\n # 'args' should be a normalized search arguments hash including the following elements:\n # :query, :per_page, :start, :page, :search_field, :sort\n Rails.logger.debug(\"mjc12test: BlacklightEngine search called. Query is #{args[:query]}}\")\n bento_results = BentoSearch::Results.new\n\n # Format is passed to the engine using the configuration set up in the bento_search initializer\n # If not specified, we can maybe default to books for now.\n format = configuration[:blacklight_format] || 'Digital Collections'\n base = Addressable::URI.parse(\"https://digital.library.cornell.edu\")\n uri = URI( base + \"catalog.bento\")\n params = {\n :q => args[:oq],\n :utf8 => \"✓\",\n :search_field => \"all_fields\",\n :rows => 3\n }\n uri.query = URI.encode_www_form(params)\n url = Addressable::URI.parse(uri)\n url.normalize\n portal_response = JSON.load(URI.open(url))\n\n # Rails.logger.debug \"mjc12test: #{portal_response}\"\n if portal_response.nil? || portal_response['response'].nil? || portal_response['response']['docs'].nil?\n results = []\n else\n results = portal_response['response']['docs']\n end\n\n results.each do |i|\n\n item = BentoSearch::ResultItem.new\n item.title = i['title_tesim'][0].to_s\n [i['creator_facet_tesim']].each do |a|\n item.authors << a\n end\n if i['collection_tesim'].present? && i['solr_loader_tesim'].present? && i['solr_loader_tesim'][0] == \"eCommons\"\n item.abstract = i['collection_tesim'][0].to_s + \" Collection in eCommons\"\n elsif i['collection_tesim'].present?\n item.abstract = i['collection_tesim'][0].to_s\n elsif i['description_tesim'].present?\n item.abstract = i['description_tesim'][0].to_s\n end\n if i['media_URL_size_0_tesim'].present?\n item.format_str = i['media_URL_size_0_tesim'][0].to_s\n end\n if i['date_tesim'].present?\n item.publication_date = i['date_tesim'][0].to_s\n end\n if i['solr_loader_tesim'].present? && i['solr_loader_tesim'][0] == \"eCommons\"\n item.link =i['handle_tesim'][0]\n else\n url = URI(base + \"catalog/#{i['id']}\")\n url.normalize\n item.link = url.to_s\n end\n bento_results << item\n end\n\n if portal_response.nil? || portal_response['response'].nil? || portal_response['response']['pages'].nil? || portal_response['response']['pages']['total_count'].nil?\n bento_results.total_items = 0\n else\n bento_results.total_items = portal_response['response']['pages']['total_count']\n end\n\n return bento_results\n\n end",
"def model_param\n 'remote_search'\n end",
"def search\n send_request\n parse_response\n end",
"def search_for_item\n search_service.fetch(params[:id], { fl: ['visibility_ssi'] })\n end",
"def get_search_results(extra_controller_params={})\n Blacklight.solr.find self.solr_search_params(extra_controller_params)\n end",
"def search_builder_class\n Hyrax::HomepageSearchBuilder\n end",
"def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end",
"def make_search(url)\n #make the web request\n data = RestClient.get url\n JSON.parse(data)\nend",
"def search_model\n end",
"def getResultsFromSearch(query, type, guts, ppOverride)\n request('getResultsFromSearch', {'query' => query, 'type' => type, 'guts' => guts, 'ppOverride' => ppOverride})\nend",
"def search_api\n engine = requested_engine(SearchService)\n # noinspection RubyMismatchedReturnType\n engine ? SearchService.new(base_url: engine) : api_service(SearchService)\n end",
"def classes_supported_by_rest_api\n [\n 'Search'\n ]\n end",
"def search\n find_clients\n render_clients\n end",
"def search\n\n end",
"def run\n super\n\n # Make sure the key is set\n raise \"API KEY MISSING: bing_api_key\" unless $intrigue_config[\"bing_api_key\"]\n\n entity_name = _get_entity_attribute \"name\"\n\n # Attach to the google service & search\n bing = Client::Search::Bing::SearchService.new($intrigue_config['bing_api_key'],50,'Web',{:Adult => 'Off'})\n\n results = bing.search(entity_name)\n results.first[:Web].each do |result|\n\n # a result will look like:\n #\n # {:__metadata=>\n # {:uri=>\"https://api.datamarket.azure.com/Data.ashx/Bing/Search/v1/ExpandableSearchResultSet(guid'3033f6e3-d175-418c-a201-4a0c2c643384')/Web?$skip=0&$top=1\", :type=>\"WebResult\"},\n # :ID=>\"d30722c1-3fab-4ad6-90b1-aa136224afe4\",\n # :Title=>\"Speedtest.net by Ookla - The Global Broadband Speed Test\",\n # :Description=>\"Test your Internet connection bandwidth to locations around the world with this interactive broadband speed test from Ookla\",\n # :DisplayUrl=>\"www.speedtest.net\",\n # :Url=>\"http://www.speedtest.net/\"}\n #\n\n ###\n ### SECURITY - take care, result might include malicious code?\n ###\n\n # Create the specific page\n _create_entity(\"Uri\", { :name => result[:Url],\n :uri => result[:Url],\n :description => result[:Description],\n :title => result[:Title],\n :source => \"Bing\"\n })\n\n # Create a domain\n dns_name = result[:Url].split(\"/\")[2]\n if Regexp.new(entity_name).match dns_name\n _create_entity(\"DnsRecord\", { :name => dns_name })\n end\n\n ###\n ### XXX - this actually picks up a lot more than it should. Tighten\n ### this up when there are cycles. Thinking this needs to be stuck\n ### in a library somewhere too\n ###\n\n # Handle Twitter search results\n if result[:Url] =~ /https?:\\/\\/twitter.com\\/.*$/\n account_name = result[:Url].split(\"/\")[3]\n _create_entity(\"WebAccount\", {\n :domain => \"twitter.com\",\n :name => account_name,\n :uri => \"http://www.twitter.com/#{account_name}\",\n :type => \"full\"\n })\n\n # Handle Facebook public profile results\n elsif result[:Url] =~ /https?:\\/\\/www.facebook.com\\/(public|pages)\\/.*$/\n account_name = result[:Url].split(\"/\")[4]\n _create_entity(\"WebAccount\", {\n :domain => \"facebook.com\",\n :name => account_name,\n :uri => \"#{result[:Url]}\",\n :type => \"public\"\n })\n\n # Handle Facebook search results\n elsif result[:Url] =~ /https?:\\/\\/www.facebook.com\\/.*$/\n account_name = result[:Url].split(\"/\")[3]\n _create_entity(\"WebAccount\", {\n :domain => \"facebook.com\",\n :name => account_name,\n :uri => \"http://www.facebook.com/#{account_name}\",\n :type => \"full\"\n })\n\n # Handle LinkedIn public profiles\n elsif result[:Url] =~ /^https?:\\/\\/www.linkedin.com\\/in\\/pub\\/.*$/\n account_name = result[:Url].split(\"/\")[5]\n _create_entity(\"WebAccount\", {\n :domain => \"linkedin.com\",\n :name => account_name,\n :type => \"public\"\n })\n\n # Handle LinkedIn public directory search results\n elsif result[:Url] =~ /^https?:\\/\\/www.linkedin.com\\/pub\\/dir\\/.*$/\n account_name = \"#{result[:Url].split(\"/\")[5]} #{result[:Url].split(\"/\")[6]}\"\n _create_entity(\"WebAccount\", {\n :domain => \"linkedin.com\",\n :name => account_name,\n :uri => result[:Url],\n :type => \"public\"\n })\n\n # Handle LinkedIn world-wide directory results\n elsif result[:Url] =~ /^http:\\/\\/[\\w]*.linkedin.com\\/pub\\/.*$/\n\n # Parses these URIs:\n # - http://za.linkedin.com/pub/some-one/36/57b/514\n # - http://uk.linkedin.com/pub/some-one/78/8b/151\n\n account_name = result[:Url].split(\"/\")[4]\n _create_entity(\"WebAccount\", {\n :domain => \"linkedin.com\",\n :name => account_name,\n :uri => \"#{result[:Url]}\",\n :type => \"public\" })\n\n # Handle LinkedIn profile search results\n elsif result[:Url] =~ /^https?:\\/\\/www.linkedin.com\\/in\\/.*$/\n account_name = result[:Url].split(\"/\")[4]\n _create_entity(\"WebAccount\", {\n :domain => \"linkedin.com\",\n :name => account_name,\n :uri => \"http://www.linkedin.com/in/#{account_name}\",\n :type => \"public\" })\n\n # Handle Google Plus search results\n elsif result[:Url] =~ /https?:\\/\\/plus.google.com\\/.*$/\n account_name = result[:Url].split(\"/\")[3]\n _create_entity(\"WebAccount\", {\n :domain => \"google.com\",\n :name => account_name,\n :uri => result[:Url],\n :type => \"full\" })\n\n # Handle Hackerone search results\n elsif result[:Url] =~ /https?:\\/\\/hackerone.com\\/.*$/\n account_name = result[:Url].split(\"/\")[3]\n _create_entity(\"WebAccount\", {\n :domain => \"hackerone.com\",\n :name => account_name,\n :uri => result[:Url],\n :type => \"full\" }) unless account_name == \"reports\"\n\n # Check for Phone Number\n elsif result[:Description].match(/(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4}/)\n\n # Grab all matches\n matches = result[:Description].scan(/((\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4})/)\n matches.each do |match|\n _create_entity(\"PhoneNumber\", { :name => \"#{match[0]}\" })\n end\n\n\n # Check for Email Address\n elsif result[:Description].match(/\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b/i)\n\n # Grab all matches\n matches = result[:Description].scan(/((\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4})/)\n matches.each do |match|\n _create_entity(\"EmailAddress\", { :name => \"#{match[0]}\" })\n end\n\n end\n\n end # end results.each\n end",
"def search; end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def omdb_pull(search_key, search_val)\n\n result = Typhoeus.get(\"http://www.omdbapi.com/\", :params => {search_key => search_val})\n result = JSON.parse(result.body)\n result\n\nend",
"def search\r\nend",
"def search_builder_class\n Cul::Ac3::SearchBuilder\n end",
"def search_builder_class\n Hyrax::HomepageSearchBuilder\n end",
"def search\n end",
"def search\n @binCenters_response= invoke_webservice method: 'get', class: 'custInv/', action:'binCenters', query_string: { custNo: current_user }\n unless @binCenters_response[\"errMsg\"].blank?\n flash.now[:alert] = @binCenters_response[\"errMsg\"]\n render 'index'\n else\n @qc_lab_response = invoke_webservice method: 'get',action: 'trackingInfo', query_string: {custNo: current_user,searchType: params[:search_type],searchValue: params[:id] || params[\"txtPartNo\"] }\n if params[:search_type] == \"PartNo\"\n @part_no = params[:id].blank? ? params[\"txtPartNo\"] : params[:id]\n else\n @part_no = params[:id].blank? ? @qc_lab_response[\"partNo\"].first : params[:id]\n end\n @partNums_response = invoke_webservice method: 'get',class: 'custInv/',action: 'partNums', query_string: {custNo: current_user, partNo: @part_no }\n # test getBinParts is not on bin map get prime via getAllPartNums\n # match inv PN, set cust forecast number\n @my_prime_pn = @partNums_response[\"primePNList\"] && !@partNums_response[\"primePNList\"].join().blank? ? @partNums_response[\"primePNList\"] : @part_no\n @fc_cust_part_no = (@partNums_response[\"invPNList\"].include? @part_no) ? @part_no : @partNums_response[\"invPNList\"].first\n @whse_cust_part_no = (@partNums_response[\"custPartNoList\"].include? @part_no) ? @part_no : @partNums_response[\"invPNList\"].first\n #convert arr value to string\n @prime_pn = EngineeringCheck.get_covert_arr_to_str @partNums_response[\"primePNList\"]\n @fc_cust_part_no = EngineeringCheck.get_covert_arr_to_str @fc_cust_part_no\n @whse_prime_part_no = EngineeringCheck.get_covert_arr_to_str @my_prime_pn\n # fuzzy search for part number render fuzzy search page\n if @partNums_response[\"searchPartList\"] && !@partNums_response[\"searchPartList\"].join().blank?\n render 'fuzzy_search'\n else\n @partNums_response[\"searchPartList\"] = @part_no if @partNums_response[\"searchPartList\"] && @partNums_response[\"searchPartList\"].join().blank? && @partNums_response[\"searchPartList\"].blank?\n unless @qc_lab_response[\"errMsg\"].blank?\n flash.now[:alert] = @qc_lab_response[\"errMsg\"]\n @superSedenceSearch_response = invoke_webservice method: 'get',class: 'custInv/',action: 'superSedenceSearch', query_string: {custNo: current_user, partNo: @my_inv_pn || @part_no }\n else\n unless @partNums_response[\"errMsg\"].blank?\n @my_inv_pn = @whse_cust_part_no = @part_no\n @whse_prime_part_no = EngineeringCheck.get_covert_arr_to_str @partNums_response[\"primePNList\"]\n flash.now[:alert] = @partNums_response[\"errMsg\"]\n @superSedenceSearch_response = invoke_webservice method: 'get',class: 'custInv/',action: 'superSedenceSearch', query_string: {custNo: current_user, partNo: @my_inv_pn || @part_no }\n else\n if @partNums_response[\"custPartNoList\"].include? @part_no\n @my_inv_pn = @whse_cust_part_no = @part_no\n @whse_prime_part_no = EngineeringCheck.get_covert_arr_to_str @partNums_response[\"primePNList\"]\n elsif @partNums_response[\"scancodeList\"].include? @part_no\n my_index = @partNums_response[\"scancodeList\"].index(@part_no)\n @whse_cust_part_no = @my_cust_pn = @partNums_response[\"custPartNoList\"][my_index]\n @my_inv_pn = @partNums_response[\"invPNList\"][my_index]\n @whse_prime_part_no = EngineeringCheck.get_covert_arr_to_str @partNums_response[\"primePNList\"]\n else\n @superSedenceSearch_response = invoke_webservice method: 'get',class: 'custInv/',action: 'superSedenceSearch', query_string: {custNo: current_user, partNo: @my_inv_pn || @part_no }\n flash.now[:notice] = (\"#{@part_no} not on Bin Map or Contract. Please contact your KLX representative.<br>\" + @superSedenceSearch_response[\"errMsg\"] +\"\").html_safe\n end\n if((@partNums_response[\"custPartNoList\"].include? @part_no) || (@partNums_response[\"scancodeList\"].include? @part_no))\n @superSedenceSearch_response = invoke_webservice method: 'get', class: 'custInv/',action: 'superSedenceSearch', query_string: {custNo: current_user, partNo: @my_inv_pn || @part_no }\n @lead_times_response = invoke_webservice method: 'get', class: 'custInv/',action: 'leadTimes', query_string: {custNo: current_user,custPartNo: @prime_pn }\n @whse_on_hand_qty_response = invoke_webservice method: 'get',class: 'custInv/',action: 'whseOnHandQty', query_string: {custNo: current_user,partNo: @whse_prime_part_no,custPartNo: @whse_cust_part_no }\n @binParts_response = invoke_webservice method: 'get',class: 'custInv/',action: 'binParts', query_string: {custNo: current_user,partNo: @part_no }\n end\n end\n end\n render 'search_result'\n end\n end\n end",
"def load_bills_search(query, enacted = true)\n query = URI.escape(query)\n params = {'query' => query}\n params['history.enacted'] = true if enacted\n @bills = process('bills', 'bills/search', params) \n end",
"def lookup_action; end",
"def index\n respond_with Official.search(official_search_params)\n end",
"def search\n Api.search_all_apis params[:postcode]\n end",
"def autocomplete\r\n # table parameter must be defined. If not, get it from search parameter\r\n if params['table'].nil? && params['search'].match(/\\./)\r\n name = params['search'].split('.').first\r\n params['table'] = name.underscore\r\n end\r\n if params['table'].match('_control')\r\n # it must be at least logged on\r\n return render json: { label: t('drgcms.not_authorized') } unless dc_user_can(DcPermission::CAN_VIEW, 'dc_memory')\r\n else\r\n return render json: { label: t('drgcms.not_authorized') } unless dc_user_can(DcPermission::CAN_VIEW)\r\n end\r\n\r\n table = params['table'].classify.constantize\r\n input = params['input'].gsub(/\\(|\\)|\\[|\\]|\\{|\\|\\.|\\,}/, '')\r\n # call method in class if search parameter contains . This is for user defined searches\r\n a = if params['search'].match(/\\./)\r\n #method, additional_params = params['search'].split('.')\r\n #data = additional_params ? table.send(method, input, additional_params, self) : table.send(method, input)\r\n name, method = params['search'].split('.')\r\n data = table.send(method, input)\r\n data.map do |v|\r\n { label: v[0], value: v[0], id: (v[1] || v[0]).to_s }\r\n end\r\n # will search and return field_name defined in params['search']\r\n else\r\n table.where(params['search'] => /#{input}/i).limit(20).map do |v|\r\n { label: v[params['search']], value: v[params['search']], id: v.id.to_s }\r\n end\r\n end\r\n\r\n render json: a\r\nend",
"def search\nend",
"def fetch\n end",
"def search\n status_not_acceptable && return unless accept_header?\n\n resource_type = params.permit(:resource_type)[:resource_type]&.downcase\n search_params = params.slice('family', 'given', 'telecom', 'email', 'subject', 'active',\n '_count', '_id')\n case resource_type\n when 'patient'\n resources = search_patients(search_params)\n resource_type = 'Patient'\n when 'observation'\n resources = search_laboratories(search_params) || []\n resource_type = 'Observation'\n when 'questionnaireresponse'\n resources = search_assessments(search_params) || []\n resource_type = 'QuestionnaireResponse'\n else\n status_bad_request && return\n end\n\n page_size = params.permit(:_count)[:_count].nil? ? 10 : params.permit(:_count)[:_count].to_i\n page_size = 500 if page_size > 500\n summary_mode = page_size.zero?\n page = params.permit(:page)[:page].to_i\n page = 1 if page.zero?\n results = []\n unless summary_mode || resources.blank?\n results = resources.paginate(per_page: page_size, page: page).collect do |r|\n FHIR::Bundle::Entry.new(fullUrl: full_url_helper(r.as_fhir), resource: r.as_fhir)\n end\n end\n\n # Construct bundle from search query\n bundle = FHIR::Bundle.new(\n id: SecureRandom.uuid,\n meta: FHIR::Meta.new(lastUpdated: DateTime.now.strftime('%FT%T%:z')),\n type: 'searchset',\n total: resources&.size || 0,\n link: summary_mode ? nil : bundle_search_links(page, page_size, resources, resource_type, search_params),\n entry: results\n )\n\n status_ok(bundle) && return\n rescue StandardError\n render json: operation_outcome_fatal.to_json, status: :internal_server_error\n end",
"def search \n\n end",
"def index\n @search_name = params[:search_name]\n\n # INICIO RANSACK\n @query = TypeClient.ransack(params[:q]) \n @query.name_cont = @search_name if @search_name.present?\n\n # PAGINACION Y ORDEN\n @results = @query.result(distinct: true).paginate(:page => params[:page] )\n \n # RESULTADO FINAL\n @type_clients = @results \n end",
"def search\n @features = Central::Storage.search(_params_search)\n end",
"def fetch_search\n @search = Question.find_by_id(params[:id])\n end",
"def bi_service\n end",
"def autocomplete\n @response, = search_service.search_results do |builder|\n builder.with(builder.blacklight_params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field, public: true, rows: 100))\n end\n\n respond_to do |format|\n format.json do\n render json: { docs: autocomplete_json_response(@response.documents) }\n end\n end\n end",
"def macro_search\n @cities_search = City.ransack(name_cont: params[:q]).result(distinct: true).limit(5)\n @users_search = User.ransack(name_cont: params[:q]).result(distinct: true).limit(6)\n respond_to do |format|\n format.json # Renders json for the macro_search.json.jbuilder file in views/searches folder\n format.html {\n flash[:alert] = \"Please select a search result from the dropdown\"\n redirect_to request.referrer\n }\n end \n end",
"def search\n # TODO: uncomment when we have html and js to implement the test variants\n # unless user_signed_in?\n # # A/B test - only for anonymous users\n # @search_landing_banner_appear = ab_test :search_landing_banner_appear\n # end\n render '/home/app'\n end",
"def fetchControllerForTableView(tableView)\n Cliente.searchController(@searchString, withScope:nil) \n end",
"def search\n unless params[:query].blank?\n @listings = custom_search(params[:query])\n #print \"\\n\\n\\n***203 #{@listings}***\\n\\n\\n\"\n @header_type = \"Search for \\\"\" + params[:query] + \"\\\"\"\n \n #will render search.rhtml by default\n else\n browse\n end\n end",
"def search params = {}\n send_and_receive search_path(params), params.reverse_merge(qt: blacklight_config.qt)\n end",
"def search\n Settings.record_activity \n if @params['show_results'] == 'true' && (@last_search = SearchContacts.last_search)\n @contacts_already_on_device = @last_search.find_contacts_on_device\n end\n render :action => :search, :back => 'callback:', :layout => 'layout_JQM_Lite'\n end",
"def index\n # Generate sunspot search\n @records = record_default_search\n\n respond_with(@records)\n end",
"def searches\n Boundary.get(@url)\n end",
"def search_bing\n search_results = bing_search.first_50\n #set_reports\n return search_results\n end",
"def search_for_item\n search_service.fetch(params[:solr_document_id])\n end",
"def index\n @search = @klass.search(params[:q])\n @entities = @search.result.includes(@klass::ADMIN_INCLUDES).page(params[:page])\n @count = @search.result.count\n @search.build_condition\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entities }\n end\n end",
"def run\n super\n _log \"Running 42matters mobile app search.\"\n \n entity_name = _get_entity_name\n api_key = _get_task_config(\"42matters_api_key\")\n \n unless api_key\n _log_error \"Failed to retrieve api key. Exiting\"\n return\n end\n \n # search for android app via apptweak api\n find_ios_apps(api_key, entity_name)\n find_android_apps(api_key, entity_name)\n \n end",
"def index\n @services = Services::Search.for(params[:term], params[:sort], params[:page], { is_admin: true})\n end",
"def raw\n raise(ActionController::RoutingError, 'Not Found') unless blacklight_config.raw_endpoint.enabled\n\n @document = search_service.fetch(params[:id])\n render json: @document\n end",
"def vendor_search\n convention = Convention.find(params[\"id\"])\n @search_results = convention.convention_vendor_search(params[\"search\"])\n end",
"def search\n part_number = params[\"txt_part_number\"].try(:strip).try(:upcase)\n @page_action = params[\"read\"]\n @response_stock_lookup = invoke_webservice method: 'get',\n action: 'partsOnHand',\n query_string: { partNo: part_number}\n\n if @response_stock_lookup\n if @response_stock_lookup[\"errCode\"] == \"1\"\n flash[:notice] = @response_stock_lookup[\"errMsg\"]\n end\n else\n flash[:notice] = I18n.translate(\"Service temporary unavailable\",:scope => \"rma.error\")\n end\n render :index\n end",
"def get; end",
"def search(term, location)\n url = \"#{API_HOST}#{SEARCH_PATH}\"\n params = {\n term: term,\n location: location,\n limit: SEARCH_LIMIT\n }\n#this takes info from params hash\n response = HTTP.auth(bearer_token).get(url, params: params)\n response.parse[\"businesses\"]\nend",
"def index\n @docs = SearchController.search(params[:query]) if params[:query].present?\n end",
"def run\n super\n\n entity_name = _get_entity_name\n\n # Search users\n search_uri = \"https://api.github.com/search/users?q=#{entity_name}\"\n response = _get_response(search_uri)\n _parse_items(response[\"items\"],\"GithubUser\")\n\n # Search respositories\n search_uri = \"https://api.github.com/search/repositories?q=#{entity_name}\"\n response = _get_response(search_uri)\n _parse_items(response[\"items\"],\"GithubRepository\")\n\n #search_uri = \"https://api.github.com/search/issues?q=#{entity_name}\"\n #response = _search_github(search_uri,\"GithubIssue\")\n #_parse_items response[\"items\"]\n\n\n end",
"def index\n @search = Quirk.accessible_by(current_ability).search(params[:search])\n @quirks = @search.result(:order => 'name', :include=>[:servers])\n if request.xhr?\n render :partial => 'listing'\n else\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @quirks }\n format.json { render :json => @quirks}\n end\n end\n end",
"def search_fields\n Blacklight.config[:search_fields]\n end",
"def search\n\n end",
"def retrieve\n if params[:query] == \"\"\n flash[:Error] = \"Please Enter Query\"\n redirect_to search_path\n else\n params[:query] = params[:query].strip\n @urls = Url.custom_search(search_params)\n if !@urls.first\n flash[:Error] = \"Not Found Anything\"\n redirect_to search_path\n else\n render 'show'\n end\n end\n end",
"def service_request(service); end",
"def index\n # FOR SEARCH FORM TO USE LIKE IN DEVELOPMENT\n if Rails.env.development?\n if params[:q]\n search_term = params[:q]\n @products = Product.where(\"name LIKE ?\", \"%#{search_term}%\")\n \n # ANGULAR\n #respond_with @products\n \n else\n @products = Product.all\n# SHOPPING CART\n @order_item = current_order.order_items.new\n# SHOPPING CART \n end\n end\n # FOR SEARCH FORM TO USE ILIKE IN PRODUCTION\n if Rails.env.production?\n if params[:q]\n search_term = params[:q]\n @products = Product.where(\"name ILIKE ?\", \"%#{search_term}%\")\n else\n @products = Product.all\n# SHOPPING CART\n @order_item = current_order.order_items.new\n# SHOPPING CART \n end\n end\n end",
"def remote_search(*args)\n params = args.extract_options!\n collection = args.flatten\n ::FactoryGirl::RemoteStrategy.register_request(:get, FactoryGirl::RemoteStrategy.collection_url(collection, params),\n body: (collection.first.is_a?(Class) ? \"[]\" : collection.map { |e| FactoryGirl::RemoteStrategy.entity_hash(e, params) }.to_json))\nend",
"def search(params = {})\n @api.get(\"api.json\", params)\n end",
"def fetch; end",
"def fetch; end",
"def search\n @term = sname = request.query_parameters[\"search\"].to_s.downcase\n @data = search_term(sname)\n render partial: \"shared/search\"\n end",
"def fetch\n raise \"not implemented\"\n end",
"def index\n @search = params[\"search\"]\n if @search.present?\n client = Client.new(@search)\n response = client.call\n\n new_results = StoreSearch.new(@search, response).run\n if new_results\n scope_to_use = client.find_search_key || \"random\"\n\n if scope_to_use == \"category\"\n searches = Search.with_category(@search[\"category\"])\n @searches = Search.paginate(page: params[:page], per_page: 5).where(id: searches.map(&:id))\n # TODO recover former sintax\n # @searches = Search.paginate(page: params[:page], per_page: 5)\n # .with_category(@search[\"category\"])\n elsif scope_to_use == \"text\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .with_text(@search[\"text\"])\n elsif scope_to_use == \"random\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .created_randomly\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n end\n \n @searches ||= Search.paginate(page: params[:page], per_page: 5)\n @search = Search.new()\n end",
"def set_search\n @search_adie = Adie.search(params[:q])\n @search_company = Company.search(params[:q])\n @search_employee = Employee.search(params[:q])\n end",
"def search_load\n @search = current_user.saved_page_infos.find(params[:id]).load(@sssn).model\n draw_search_form\n end",
"def index\n @back_link = admin_path\n #@state_provs = StateProv.all\n respond_to do |format|\n format.html { @state_provs = StateProv.all }\n format.json { @state_provs = StateProv.search(params[:term]) }\n end\n end",
"def autocomplete_game_search \t\t\t\t \n #@games = Game.name_like(params[\"q\"])[0..10]\n #platform_result = Game.platform_like(params[\"q\"])[0..10] \n @games = Game.search({\"name_cont\" => params[\"q\"]}).result[0..10]\n platform_games = Game.search({\"platform_cont\" => params[\"q\"]}).result[0..10]\n @games = @games | platform_games\n render :json => @games.collect {|game| [game[\"name\"] + \" [\"+game[\"platform\"]+\"]\", game[\"platform\"]]}\n end",
"def getSearchObjName\r\n\t\t\treturn \"mfiforce__Search__c\"\r\n\t\tend",
"def fetch\n raise NotImplementedError\n end",
"def get_search\n\t\t\t@search = Search.find(params[:id])\n\t\tend",
"def search\n @q = params[:q]\n @results = Series.external_search(@q)\n\n respond_to do |format|\n format.html # search.html.haml\n format.json { render json: @results.to_json }\n end\n end",
"def index\n ## BUILD MASTER HASH WITH ALL SUB-PARAMS ##\n allparams = {}\n allparams[:mainmodel] = ServiceServiceAssignment\n allparams[:webparams] = params\n results = Search.new(allparams).search\n\n flash[:error] = results[:errors].join('<br />') unless results[:errors].empty?\n includes = results[:includes]\n results[:requested_includes].each_pair{|k,v| includes[k] = v}\n @objects = results[:search_results]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @objects.to_xml(:dasherize => false) }\n end\n end",
"def index\n\n extra_head_content << '<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS for results\" href=\"'+ url_for(params.merge(\"format\" => \"rss\")) + '\">'\n extra_head_content << '<link rel=\"alternate\" type=\"application/atom+xml\" title=\"Atom for results\" href=\"'+ url_for(params.merge(\"format\" => \"atom\")) + '\">'\n\n (@response, @document_list) = get_search_results\n @filters = params[:f] || []\n\n if Blacklight.config[:data_augmentation][:enabled] and !(params[:q].blank? and params[:f].blank? and params[:search_field].blank?)\n get_gdata_for_result_list\n end\n\n respond_to do |format|\n format.html { save_current_search_params }\n format.mobile { save_current_search_params }\n format.rss { render :layout => false }\n format.atom { render :layout => false }\n end\n end",
"def index\n #@apps = App.all\n name = params[:name]\n platform = params[:platform]\n category = params[:category]\n @apps = App.search(name, platform, category)\n #@apps = App.search(params[:search])\n end",
"def search_designer\n end",
"def run\n super\n\n entity_name = _get_entity_name\n entity_type = _get_entity_type_string\n\n api_key =_get_task_config(\"apility_api_key\")\n\n headers = { \"Accept\" => \"application/json\", \"X-Auth-Token\" => api_key }\n\n if entity_type == \"IpAddress\"\n search_apility_by_ip entity_name, headers\n elsif entity_type == \"Domain\"\n search_apility_by_domain entity_name, headers\n else\n _log_error \"Unsupported entity type\"\n end\n\n end",
"def index\n @response = search_service.search_results\n\n respond_to do |format|\n format.html { store_preferred_view }\n format.rss { render layout: false }\n format.atom { render layout: false }\n format.json do\n @presenter = Blacklight::JsonPresenter.new(@response,\n blacklight_config)\n end\n additional_response_formats(format)\n document_export_formats(format)\n end\n end",
"def GET; end",
"def fetch\n raise NotImplementedError\n end",
"def index\n @search = Client.ransack(params[:q])\n @search.sorts = 'id desc' if @search.sorts.empty?\n @clients = @search.result.includes(:favorites, :restocks).paginate(page: params[:page], per_page: 50)\n end",
"def show_search_index \n WebView.navigate(url_for(:action => :search, :controller => :SearchContacts, :query => {:show_results => 'true'}), Constants::TAB_INDEX['Contacts'])\n end"
] | [
"0.6300988",
"0.6218276",
"0.616826",
"0.60939366",
"0.5896516",
"0.5875381",
"0.585296",
"0.5824424",
"0.57832783",
"0.5767981",
"0.5749384",
"0.5748537",
"0.5744475",
"0.570369",
"0.56970006",
"0.569167",
"0.56652063",
"0.5658615",
"0.5651207",
"0.56440043",
"0.56440043",
"0.56440043",
"0.56440043",
"0.56440043",
"0.56440043",
"0.56440043",
"0.56440043",
"0.56440043",
"0.56440043",
"0.56258583",
"0.56075126",
"0.5596474",
"0.557799",
"0.55723983",
"0.5562204",
"0.5558617",
"0.55533004",
"0.55499935",
"0.5548659",
"0.5541924",
"0.5540538",
"0.55363137",
"0.5532572",
"0.5530424",
"0.55241984",
"0.551604",
"0.55104774",
"0.55097693",
"0.55006343",
"0.5497927",
"0.549443",
"0.5490442",
"0.54904413",
"0.5484591",
"0.5472119",
"0.5469665",
"0.54673237",
"0.5465615",
"0.54505074",
"0.54462475",
"0.54271406",
"0.5423041",
"0.54070807",
"0.54058915",
"0.5402952",
"0.5401106",
"0.53854984",
"0.53846556",
"0.5379484",
"0.53722733",
"0.53661793",
"0.5364977",
"0.5357345",
"0.5352334",
"0.53485614",
"0.5339697",
"0.53369486",
"0.5335468",
"0.5335468",
"0.53352374",
"0.53342205",
"0.5334124",
"0.5331176",
"0.53295636",
"0.5320113",
"0.5318454",
"0.53133327",
"0.5313148",
"0.5308919",
"0.5305512",
"0.52965015",
"0.5293302",
"0.5290713",
"0.528963",
"0.5286437",
"0.52836055",
"0.52798164",
"0.5269838",
"0.5269322",
"0.52685195"
] | 0.68247706 | 0 |
:only=>[:edit, :index, :new, :show] GET /user_device_configurations GET /user_device_configurations.json | def index
@user_device_configurations = UserDeviceConfiguration.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @user_device_configurations }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @user_device_configuration = UserDeviceConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_device_configuration }\n end\n end",
"def new\n @user_device_configuration = UserDeviceConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_device_configuration }\n end\n end",
"def get_all_device_info\n # @device = Device.where(\"user_id = ?\",current_user[:id])\n # render json: @device\n @devices = User.get_all_user_devices(current_user[:id])\n render json: @devices\n end",
"def show\n #@config_file = ConfigFile.find(params[:id])\n @config_file = current_user.developer.config_files.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @config_file }\n end\n end",
"def update\n @user_device_configuration = UserDeviceConfiguration.find(params[:id])\n\n respond_to do |format|\n if @user_device_configuration.update_attributes(params[:user_device_configuration])\n format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_device_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @api_v1_user_device_infos = Api::V1::UserDeviceInfo.all\n end",
"def show\n # @mydevice = Mydevice.find(params[:id])\n\t@user = User.find(params[:id])\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mydevice }\n end\n end",
"def show\n @default_check_out_duration = Settings.default_check_out_duration\n @clients_can_see_equipment_outside_their_groups = Settings.clients_can_see_equipment_outside_their_groups\n @attendants_can_self_check_out = Settings.attendants_can_self_check_out\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @app_config }\n end\n end",
"def show\n @my_configuration = MyConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_configuration }\n end\n end",
"def show\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_configuration }\n end\n end",
"def show\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_configuration }\n end\n end",
"def index\n @devices = current_user.devices\n end",
"def create\n @user_device_configuration = UserDeviceConfiguration.new(params[:user_device_configuration])\n\n respond_to do |format|\n if @user_device_configuration.save\n format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully created.' }\n format.json { render json: @user_device_configuration, status: :created, location: @user_device_configuration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_device_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @device_user = DeviceUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @device_user }\n end\n end",
"def index\n if current_user\n if current_user.is_admin?\n @devices = Device.all\n else\n @devices = Device.where(:user_id => current_user.id)\n end\n else\n redirect_to login_url, :notice => \"Please login to manage your devices\"\n end\n end",
"def index\n @devices = current_user.devices\n end",
"def device\r\n logger.info(\"UserController::device:---#{params}\")\r\n end",
"def index\n @devices = @user.devices\n end",
"def show\n @app_config = AppConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app_config }\n end\n end",
"def index\n @devices = Device.where(:user_id, auth_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devices }\n end\n end",
"def show\n @clientconfig = Clientconfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientconfig }\n end\n end",
"def show\n\t\t@launch_configuration = LaunchConfiguration.find(params[:id], :include => [ :security_groups, :block_device_mappings ])\n\t\t@provider_account = @launch_configuration.provider_account\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @launch_configuration }\n\t\tend\n\tend",
"def show\n json_response(@device)\n end",
"def index\n @graphium_configurations = Graphium::Configuration.all\n end",
"def index\n if current_user.role.title != 'admin'\n if current_user.developer.nil?\n @config_files = []\n else\n @config_files = current_user.developer.config_files(:order => 'created_at DESC')\n end\n else\n @config_files = ConfigFile.all(:order => 'created_at DESC')\n end\n #@config_files = ConfigFile.all(:order => 'created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @config_files }\n end\n end",
"def index\n @system_configurations = SystemConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @system_configurations }\n end\n end",
"def index\n @userconfigs = Userconfig.all\n end",
"def configuration\n _get(\"/system/configuration\") { |json| json }\n end",
"def show\n render json: @user_page_setting\n end",
"def index\n authorize!(:view_configuration_management)\n end",
"def show\n @install_tracking_device_user = InstallTracking::DeviceUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @install_tracking_device_user }\n end\n end",
"def get_config_infos\n configinfo =\n {\n :init_one_appointment_price => Settings.init_one_appointment_price,\n :income_call_number => Settings.income_call_number,\n :call_length => Settings.call_length,\n :tutor_online_time => Settings.tutor_online_time,\n :call_delay_time => Settings.call_delay_time,\n :tutor_single_price => Settings.tutor_single_price\n }\n render :json => configinfo.to_json(), :status => 200\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @device }\n end\n end",
"def show\n @settings = current_user.settings\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @settings }\n end\n end",
"def get_profile_configuration(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/configuration\", args)\nend",
"def show\n @configuration = current_host.configuration_parameters.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @configuration.to_xml }\n end\n end",
"def show\n @global_config = AppConfig.where(:section => params[:sect])\n @global_config.each do |conf|\n puts conf.confkey\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @global_config }\n end\n end",
"def device_configuration_user_activity()\n return MicrosoftGraph::Reports::DeviceConfigurationUserActivity::DeviceConfigurationUserActivityRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def kernel_config_params\n params.require(:kernel_config).permit(:user_id, :config_url)\n end",
"def device_configuration=(value)\n @device_configuration = value\n end",
"def show\n @configuration_set = ConfigurationSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @configuration_set }\n end\n end",
"def device_configuration\n return @device_configuration\n end",
"def device_configuration_states()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::DeviceConfigurationStates::DeviceConfigurationStatesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def destroy\n @user_device_configuration = UserDeviceConfiguration.find(params[:id])\n @user_device_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to user_device_configurations_url }\n format.json { head :ok }\n end\n end",
"def index\n @product_configurations = ProductConfiguration.all\n end",
"def update\n @configuration.user_id = current_user.id\n respond_to do |format|\n if @configuration.update(configuration_params)\n format.html { redirect_to @configuration, notice: 'Configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: @configuration }\n else\n format.html { render :edit }\n format.json { render json: @configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_params\n params.require(:device).permit(:auth_key, :parse_token, :profile_url)\n end",
"def show\n begin\n @user_id = get_auth_token_user_id()\n @settings = Setting.find_by_user_id(@user_id)\n if (params[:id].to_s != @settings.id.to_s)\n @data = ApplicationHelper.jsonResponseFormat(1, \"Error\", {:error => \"Must be the owner\"})\n else\n @data = ApplicationHelper.jsonResponseFormat(0, \"success\", {:settings => @settings})\n end\n rescue ActiveRecord::RecordNotFound => e\n @data = ApplicationHelper.jsonResponseFormat(1, \"Error\", {:error => e.message})\n end\n respond_to do |format|\n format.json { render json: @data, :except=> [:updated_at, :created_at, :user_id]}\n end\n end",
"def uv_config\n v = visibility_lookup(resource_id_param)\n config = if v == \"open\"\n uv_config_liberal\n elsif v == \"authenticated\" && user_signed_in?\n uv_config_liberal\n elsif v == \"emory_low\" && user_signed_in?\n uv_config_liberal_low\n else\n default_config\n end\n\n respond_to do |format|\n format.json { render json: config }\n end\n end",
"def show\n\t\t@list_config = current_user.list_configs.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @list_config }\n\t\t\tformat.json { render :json => @list_config }\n\t\t\tformat.yaml { render :text => @list_config.to_yaml, :content_type => 'text/yaml' }\n\t\tend\n\tend",
"def index\n @admin_devices = AdminDevice.all\n end",
"def index\n @configurations = ::Configuration.all\n end",
"def show\n @sysconfig = Sysconfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sysconfig }\n end\n end",
"def index\n @install_tracking_device_users = InstallTracking::DeviceUser.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @install_tracking_device_users }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @configurations }\n end\n end",
"def show\n @version = Version.find(params[:id])\n @versionconfig= @version.version_configurations.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @version }\n end\n end",
"def show\n @configtable = Configtable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @configtable }\n end\n end",
"def config_user\n atts = {}\n u = @device.user\n unless params[:name].blank?\n return render json: {:status=>11, :message=>'用户名已经设置,不能修改'} if u.name\n return render json: {:status=>12, :message=>'用户名已存在'} if User.find_by_name params[:name]\n atts[:name] = params[:name]\n end\n unless params[:email].blank?\n unless u.email.eql?(params[:email])\n return render json: {:status=>13, :message=>'邮箱已经注册过'} if User.find_by_email params[:email]\n end\n atts[:email] = params[:email]\n end \n unless params[:pass].blank?\n return render json: {:status=>14, :message=>'密码已经设置'} if u.password\n atts[:password] = params[:pass] \n end\n\n atts[:score_mode] = params[:score_mode] unless params[:score_mode].blank?\n atts[:tee] = params[:default_tee] unless params[:default_tee].blank?\n \n u.update_attributes(atts) \n \n ret = {:status=>0}\n unless params[:password].blank?\n @device.update_token\n ret[:token] = @device.token\n end\n render json: ret\n end",
"def show\n @sm_backend_config = SmBackendConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm_backend_config }\n end\n end",
"def show\n @kf_global_config = Kf::GlobalConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_global_config }\n end\n end",
"def show\n @device = Device.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @device }\n end\n end",
"def show\n @device = Device.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @device }\n end\n end",
"def show\n @device = Device.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @device }\n end\n end",
"def edit_config\n Log.add_info(request, params.inspect)\n\n if @login_user.admin?(User::AUTH_DESKTOP)\n @yaml = ApplicationHelper.get_config_yaml\n end\n\n @desktop = Desktop.get_for(@login_user)\n\n render(:layout => (!request.xhr?))\n end",
"def devices\r\n DevicesController.instance\r\n end",
"def api_v1_user_device_info_params\n params.require(:api_v1_user_device_info).permit(:user_id, :os, :device_type, :device_model, :system_version, :app_version, :device_locale, :bundle_device)\n end",
"def show\n @org_settings = current_user.organization.settings\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @settings }\n end\n end",
"def show\n @site_config = SiteConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_config }\n end\n end",
"def all_merchant_configs\n profile.merchant_configs\n end",
"def index\n @configuration_details = ConfigurationDetail.all\n end",
"def show\n @configure = Configure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @configure }\n end\n end",
"def device_params\n params[:device]\n end",
"def show\n @sims_instrument_configuration = SimsInstrumentConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sims_instrument_configuration }\n end\n end",
"def show\n respond_with(@device)\n end",
"def index\n @admin_configuration_identifiers = Admin::ConfigurationIdentifier.all\n end",
"def show\n @device = Device.find(params[:id], :include => [:button, :picture])\n unless @device.application\n get_device_data(@device)\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @device }\n end\n end",
"def device_params\n params.require(:device).permit(:user_id, :token, :app_id, :locale, :inactivated_at, :banner, :badge, :sound, :app_name, :app_version, :os_name, :os_version, :device_name, :device_version)\n end",
"def device_params\n params.permit(:macaddress, :nickname, :description, :user_id, :stolen, :secret_key, :format)\n end",
"def show\n @lab_device = LabDevice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_device }\n end\n end",
"def index\n @device_attributes = @device.device_attributes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @device_attributes }\n end\n end",
"def index\n @devis_configurations = DevisConfiguration.all\n end",
"def index\n @system_configs = SystemConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @system_configs }\n end\n end",
"def show\n @conf = Conf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conf }\n end\n end",
"def get_asset_device_configuration_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AssetApi.get_asset_device_configuration_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/asset/DeviceConfigurations'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].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', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\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] || 'AssetDeviceConfigurationResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AssetApi.get_asset_device_configuration_list\",\n :header_params => 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: AssetApi#get_asset_device_configuration_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @app_configs = AppConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @app_configs }\n end\n end",
"def user_device_params\n params.require(:user_device).permit(:username, :device_id)\n end",
"def show\n @individual_device = IndividualDevice.find(params[:id])\n respond_to do |format|\n format.html \n end\n end",
"def index\n# @devices = Device.all\n end",
"def set_api_v1_user_device_info\n @api_v1_user_device_info = Api::V1::UserDeviceInfo.find(params[:id])\n end",
"def settings\n get('/account/settings.json')\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource_name, resource)\n if resource\n device_id = params[:user][:device_id]\n if current_user.block?\n sign_out resource\n render json: { error: 'Your account is inactive. Contact admin.' } and return\n elsif device_id.nil? || Setting.limit_devices.nil?\n resource.authentication_token = nil\n resource.save\n respond_to do |format|\n format.html { redirect_to admin_admin_dashboard_path }\n format.json { render json: resource }\n end\n elsif current_user.device_id.nil?\n user = User.where(device_id: device_id)\n if user.count === 0\n resource.device_id = device_id\n resource.authentication_token = nil\n resource.save\n respond_to do |format|\n format.html { redirect_to admin_admin_dashboard_path }\n format.json { render json: resource }\n end\n elsif user.first.id === resource.id\n resource.device_id = device_id\n resource.authentication_token = nil\n resource.save\n respond_to do |format|\n format.html { redirect_to admin_admin_dashboard_path }\n format.json { render json: resource }\n end\n else\n sign_out resource\n render json: { error: 'Unauthorized device' } and return\n end\n elsif current_user.device_id == device_id\n resource.authentication_token = nil\n resource.save\n respond_to do |format|\n format.html { redirect_to admin_admin_dashboard_path }\n format.json { render json: resource }\n end\n else\n sign_out resource\n render json: { error: 'Unauthorized device' } and return\n end\n end\n end",
"def device_params\n params.require(:device).permit(:User_id, :Register_id)\n end",
"def show\n @dns_device_assoc = DnsDeviceAssoc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dns_device_assoc }\n end\n end",
"def show\n @pdevice = Pdevice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pdevice }\n end\n end",
"def get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\")\n end",
"def new\n if current_user.admin?\n @device = Device.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @device }\n end\n else\n redirect_to unauthorized_path\n end\n end",
"def show\n user = User.find(params[:id])\n respond_to do |format|\n format.mobile { render :json => user.attributes_for_app }\n end\n end",
"def server_devices_list\n if !ccl_active? or (session[:usertype] != \"admin\" and ccl_active?)\n dont_be_so_smart\n redirect_to :controller => \"callc\", :action => \"main\" and return false\n end\n @page_title = _('Server_devices')\n @page_icon = 'server.png'\n @help_link = \"http://wiki.kolmisoft.com/index.php/Multi_Server_support\"\n # ip_auth + server_devices.server_id is null + server_devices.server_id is not that server + not server device(which were created with server creation)\n @devices = Device.select(\"devices.*,server_devices.server_id AS serv_id\").joins(\"LEFT JOIN server_devices ON (server_devices.device_id = devices.id AND server_devices.server_id = #{params[:id].to_i}) LEFT JOIN users ON (users.id = devices.user_id)\").where(\"(host != 'dynamic' OR device_type != 'SIP') AND users.owner_id = #{current_user.id} AND server_devices.server_id is null AND user_id != -1 AND name not like 'mor_server_%'\").order(\"extension ASC\").all\n end",
"def index\n @devices = Device.all\n render json: @devices\n end",
"def viewer_config\n resource = find_resource(resource_id_param)\n respond_to do |format|\n format.json { render json: viewer_config_value(resource) }\n end\n end"
] | [
"0.77152336",
"0.68687224",
"0.6436471",
"0.64328855",
"0.625644",
"0.62446505",
"0.6229039",
"0.6210126",
"0.62084097",
"0.6168424",
"0.6168424",
"0.6134404",
"0.6129831",
"0.6116969",
"0.6111193",
"0.6098484",
"0.6050534",
"0.6049359",
"0.6025359",
"0.6021061",
"0.60040593",
"0.6002416",
"0.5953299",
"0.5917982",
"0.5912507",
"0.58990675",
"0.5897298",
"0.5882143",
"0.5870269",
"0.58661973",
"0.5851036",
"0.584467",
"0.58343726",
"0.58328736",
"0.5829171",
"0.581872",
"0.581234",
"0.576855",
"0.5765562",
"0.5764086",
"0.5754592",
"0.5751992",
"0.5734435",
"0.57331246",
"0.5726001",
"0.5720693",
"0.57198393",
"0.5713492",
"0.5707524",
"0.5695656",
"0.5694997",
"0.56942606",
"0.5690821",
"0.5688277",
"0.56667036",
"0.56656355",
"0.5656979",
"0.5653704",
"0.56257606",
"0.5616059",
"0.5615817",
"0.5615817",
"0.5615817",
"0.5610633",
"0.5608175",
"0.5594263",
"0.55886835",
"0.558856",
"0.558824",
"0.55854917",
"0.55711055",
"0.5565375",
"0.5565205",
"0.5556108",
"0.5550677",
"0.554764",
"0.55360293",
"0.5518171",
"0.5511661",
"0.55098426",
"0.5509587",
"0.55091697",
"0.54978114",
"0.54952455",
"0.54949886",
"0.5493057",
"0.54837394",
"0.5480937",
"0.547741",
"0.54732734",
"0.54666996",
"0.5462838",
"0.54625815",
"0.54625595",
"0.54569334",
"0.54545164",
"0.5449864",
"0.5430744",
"0.5429866",
"0.5426097"
] | 0.7609758 | 1 |
GET /user_device_configurations/1 GET /user_device_configurations/1.json | def show
@user_device_configuration = UserDeviceConfiguration.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @user_device_configuration }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @user_device_configurations = UserDeviceConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_device_configurations }\n end\n end",
"def new\n @user_device_configuration = UserDeviceConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_device_configuration }\n end\n end",
"def index\n @api_v1_user_device_infos = Api::V1::UserDeviceInfo.all\n end",
"def configuration\n _get(\"/system/configuration\") { |json| json }\n end",
"def get_all_device_info\n # @device = Device.where(\"user_id = ?\",current_user[:id])\n # render json: @device\n @devices = User.get_all_user_devices(current_user[:id])\n render json: @devices\n end",
"def get_profile_configuration(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/configuration\", args)\nend",
"def device_configuration\n return @device_configuration\n end",
"def set_api_v1_user_device_info\n @api_v1_user_device_info = Api::V1::UserDeviceInfo.find(params[:id])\n end",
"def create\n @user_device_configuration = UserDeviceConfiguration.new(params[:user_device_configuration])\n\n respond_to do |format|\n if @user_device_configuration.save\n format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully created.' }\n format.json { render json: @user_device_configuration, status: :created, location: @user_device_configuration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_device_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\")\n end",
"def device_configuration=(value)\n @device_configuration = value\n end",
"def device_configuration_user_activity()\n return MicrosoftGraph::Reports::DeviceConfigurationUserActivity::DeviceConfigurationUserActivityRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def destroy\n @user_device_configuration = UserDeviceConfiguration.find(params[:id])\n @user_device_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to user_device_configurations_url }\n format.json { head :ok }\n end\n end",
"def index\n @graphium_configurations = Graphium::Configuration.all\n end",
"def get_resource_configurations(user_id)\n self.class.available_hosts.map do |host|\n {name: short_name.to_sym, params: {plgrid_host: host}}\n end\n end",
"def get_config_infos\n configinfo =\n {\n :init_one_appointment_price => Settings.init_one_appointment_price,\n :income_call_number => Settings.income_call_number,\n :call_length => Settings.call_length,\n :tutor_online_time => Settings.tutor_online_time,\n :call_delay_time => Settings.call_delay_time,\n :tutor_single_price => Settings.tutor_single_price\n }\n render :json => configinfo.to_json(), :status => 200\n end",
"def update\n @user_device_configuration = UserDeviceConfiguration.find(params[:id])\n\n respond_to do |format|\n if @user_device_configuration.update_attributes(params[:user_device_configuration])\n format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_device_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_configuration }\n end\n end",
"def show\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_configuration }\n end\n end",
"def find_configurations\n @configurations = @user.configurations\n @config_by_key = @configurations.inject({}) do |map, cfg|\n values = map[cfg.api_key] || []\n values << cfg\n map[cfg.api_key] = values\n map\n end\n end",
"def get_resource_configurations(user_id)\n hosts = self.class.available_hosts\n grant_ids = PlGridFacade.retrieve_grants(GridCredentials.find_by_user_id(user_id))\n\n hosts.flat_map do |host|\n grant_ids.flat_map do |grant_identifier|\n {name: short_name.to_sym, params: {plgrid_host: host, grant_identifier: grant_identifier}}\n end\n end\n end",
"def show\n @app_config = AppConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app_config }\n end\n end",
"def get_serv_config\n\t\taction = \"configuration\"\n\t\tresponse = call_api(action)\n\tend",
"def show\n @global_config = AppConfig.where(:section => params[:sect])\n @global_config.each do |conf|\n puts conf.confkey\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @global_config }\n end\n end",
"def index\n @userconfigs = Userconfig.all\n end",
"def show\n @my_configuration = MyConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_configuration }\n end\n end",
"def mobile_app_configurations\n return @mobile_app_configurations\n end",
"def show\n @device_user = DeviceUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @device_user }\n end\n end",
"def index\n @system_configurations = SystemConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @system_configurations }\n end\n end",
"def index\n @devices = @user.devices\n end",
"def index\n @devices = Device.where(:user_id, auth_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devices }\n end\n end",
"def show\n @install_tracking_device_user = InstallTracking::DeviceUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @install_tracking_device_user }\n end\n end",
"def show\n # @mydevice = Mydevice.find(params[:id])\n\t@user = User.find(params[:id])\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mydevice }\n end\n end",
"def device_configuration_states()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::DeviceConfigurationStates::DeviceConfigurationStatesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def hm_device options\n id = options[:id] || 1\n {\n id: id,\n device_type: options[:device_type] || 'Mobile',\n operating_system_name: options[:os] || 'android',\n operating_system_version: options[:os_version] || '1.2.3',\n serial: \"serial#{id}\",\n model: options[:model] || 'Test Model',\n brand: options[:brand] || 'Test Brand',\n }\nend",
"def phone_configuration\n MfaContext.new(current_user).phone_configurations.first\n end",
"def uv_config\n v = visibility_lookup(resource_id_param)\n config = if v == \"open\"\n uv_config_liberal\n elsif v == \"authenticated\" && user_signed_in?\n uv_config_liberal\n elsif v == \"emory_low\" && user_signed_in?\n uv_config_liberal_low\n else\n default_config\n end\n\n respond_to do |format|\n format.json { render json: config }\n end\n end",
"def mobile_app_configurations=(value)\n @mobile_app_configurations = value\n end",
"def all_merchant_configs\n profile.merchant_configs\n end",
"def get(udid)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'udid', udid)\n\t\t\tclient.queue_service_action_call('configurationgroupdevice', 'get', 'KalturaConfigurationGroupDevice', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def index_configurations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.index_configurations ...'\n end\n # resource path\n local_var_path = '/users/me/configurations'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'UserConfigurationCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#index_configurations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_network_sm_user_device_profiles(options = {})\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'network_id' => options['network_id'],\r\n 'user_id' => options['user_id']\r\n )\r\n # Prepare query url.\r\n _path_url = '/networks/{networkId}/sm/user/{userId}/deviceProfiles'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'networkId' => options['network_id'],\r\n 'userId' => options['user_id']\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def all\n JSON.parse(@client.call('config.get'))\n end",
"def devices(params={})\n res = @client.get(\"#{path}/devices\", params)\n\n res.json[\"devices\"].map{ |atts| ::M2X::Client::Device.new(@client, atts) } if res.success?\n end",
"def show\n @clientconfig = Clientconfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientconfig }\n end\n end",
"def get_device_keys\n begin\n decoded_access_token = JWT.decode(params[:accessToken], 's3cr3t', true, algorithm: 'HS256')\n if decoded_access_token\n @device_keys = User.pluck(:device_key)\n render json: {device_keys: @device_keys}\n end\n\n rescue => exception\n render json: {status: \"Invalid Token\"}\n end\n\n end",
"def index\n @devices = current_user.devices\n end",
"def configuration\n JSON.parse @gapi.configuration.to_json\n end",
"def get_config_data_for_resource(resource_path)\n path = resource_path.is_a?(CanonicalPath) ? resource_path : CanonicalPath.parse(resource_path)\n resource_path = path.resource_ids.join('/')\n feed_id = path.feed_id\n query = generate_query_params dataType: 'configuration'\n http_get(\"feeds/#{feed_id}/resources/#{resource_path}/data#{query}\")\n rescue\n {}\n end",
"def index\n @install_tracking_device_users = InstallTracking::DeviceUser.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @install_tracking_device_users }\n end\n end",
"def get_asset_device_configuration_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AssetApi.get_asset_device_configuration_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/asset/DeviceConfigurations'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].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', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\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] || 'AssetDeviceConfigurationResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AssetApi.get_asset_device_configuration_list\",\n :header_params => 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: AssetApi#get_asset_device_configuration_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n #@config_file = ConfigFile.find(params[:id])\n @config_file = current_user.developer.config_files.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @config_file }\n end\n end",
"def mobile_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::MobileAppConfigurations::MobileAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def show\n @kf_global_config = Kf::GlobalConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_global_config }\n end\n end",
"def show\n @configuration_set = ConfigurationSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @configuration_set }\n end\n end",
"def server_configurations\n response = get \"server_size\"\n response[\"server_sizes\"][\"server_size\"]\n end",
"def users_profile\n @usersProfile = User.find(params[:id]).to_json(:include => :user_connections)\n render json: { data: @usersProfile }\n end",
"def show\n json_response(@device)\n end",
"def index\n @devices = current_user.devices\n end",
"def show\n @version = Version.find(params[:id])\n @versionconfig= @version.version_configurations.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @version }\n end\n end",
"def device_configuration_device_activity()\n return MicrosoftGraph::Reports::DeviceConfigurationDeviceActivity::DeviceConfigurationDeviceActivityRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def users_id_user_config_get_with_http_info(id_user, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersManagementApi.users_id_user_config_get ...'\n end\n # verify the required parameter 'id_user' is set\n if @api_client.config.client_side_validation && id_user.nil?\n fail ArgumentError, \"Missing the required parameter 'id_user' when calling UsersManagementApi.users_id_user_config_get\"\n end\n # resource path\n local_var_path = '/users/{id_user}/config'.sub('{' + 'id_user' + '}', id_user.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersManagementApi#users_id_user_config_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show_configuration_with_http_info(configuration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.show_configuration ...'\n end\n # verify the required parameter 'configuration_id' is set\n if @api_client.config.client_side_validation && configuration_id.nil?\n fail ArgumentError, \"Missing the required parameter 'configuration_id' when calling UsersApi.show_configuration\"\n end\n # resource path\n local_var_path = '/users/me/configurations/{configuration_id}'.sub('{' + 'configuration_id' + '}', CGI.escape(configuration_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'UserConfiguration' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#show_configuration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_device\n p \"------------------------->>>>>>>>>>>>>>>>>>>>>.. #{params[:devise_id]}\"\n @device = Mobdevise.where(:devise_id => params[:devise_id]).first\n # @device = Mobdevise.find_by_devise_id(params[:device_id])\n end",
"def get_settings\n return @client.raw(\"get\", \"/config/settings\")\n end",
"def configuration\n headers = {\n accept: 'application/json',\n api_key: ENV['TMDB_API_KEY']\n }\n\n response = RestClient.get \"https://api.themoviedb.org/3/configuration\", { params: headers }\n json_response = JSON.parse(response)\n\n return json_response\nend",
"def config_data\n {}\n end",
"def index\n @configurations = ::Configuration.all\n end",
"def device_list\n @devices = Device.all\n end",
"def get_user_connections\n request(Route.new(:GET, '/users/@me/connections'))\n end",
"def get_resource_configurations(user_id)\n security_groups_list = security_groups\n super(user_id).flat_map do |subinfrastructure|\n security_groups_list.flat_map do |security_group|\n subinfrastructure[:params].merge({security_group: security_group})\n end\n end\n end",
"def show\n @configuration = current_host.configuration_parameters.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @configuration.to_xml }\n end\n end",
"def api_v1_user_device_info_params\n params.require(:api_v1_user_device_info).permit(:user_id, :os, :device_type, :device_model, :system_version, :app_version, :device_locale, :bundle_device)\n end",
"def for_user(user_id)\n request(:get, \"/users/#{user_id}/connections\")\n end",
"def show\n @sysconfig = Sysconfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sysconfig }\n end\n end",
"def update_configuration\n if @@initialized\n url = 'http://'+ENV['CONSUL_IP']+':8500/v1/kv/docker_nodes?raw'\n #log_message('Updating configuration from: ' + url)\n response = HTTPService.get_request(url)\n log_message('Dynamo changed, updating configuration to: ' + response.body)\n response = JSON.parse(response.body)\n replicate_data(response)\n end\n respond_to do |format|\n format.json { render :json => { :configuration => @@dynamo_nodes } }\n end\n end",
"def create\n @api_v1_user_device_info = Api::V1::UserDeviceInfo.new(api_v1_user_device_info_params)\n\n respond_to do |format|\n if @api_v1_user_device_info.save\n format.html { redirect_to @api_v1_user_device_info, notice: 'User device info was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_user_device_info }\n else\n format.html { render :new }\n format.json { render json: @api_v1_user_device_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user\n conf['api']['user']\n end",
"def get(base_url, options)\n System::GeneralConfiguration.new(\"#{base_url}/api/system/configuration\", options)\n end",
"def show\n @dns_device_assoc = DnsDeviceAssoc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dns_device_assoc }\n end\n end",
"def load_config()\n rspec_file = '.rspec'\n full_config = YAML::load(File.open('./config/users.yaml')) # full YML\n puts \"\\n>Loaded user configuration for: \" + ENV['env_name'].to_s # only section of YML that is relevant for the particular environment\n return full_config[ENV['env_name']] # only section of YML that is relevant for the particular environment\nend",
"def index\n @app_configs = AppConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @app_configs }\n end\n end",
"def devices\n @devices\n end",
"def get_network_sm_device_profiles(options = {})\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'network_id' => options['network_id'],\r\n 'device_id' => options['device_id']\r\n )\r\n # Prepare query url.\r\n _path_url = '/networks/{networkId}/sm/{deviceId}/deviceProfiles'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'networkId' => options['network_id'],\r\n 'deviceId' => options['device_id']\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def get_user(id)\n @client.raw('get', \"/config/users/#{id}\")\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def config_user\n atts = {}\n u = @device.user\n unless params[:name].blank?\n return render json: {:status=>11, :message=>'用户名已经设置,不能修改'} if u.name\n return render json: {:status=>12, :message=>'用户名已存在'} if User.find_by_name params[:name]\n atts[:name] = params[:name]\n end\n unless params[:email].blank?\n unless u.email.eql?(params[:email])\n return render json: {:status=>13, :message=>'邮箱已经注册过'} if User.find_by_email params[:email]\n end\n atts[:email] = params[:email]\n end \n unless params[:pass].blank?\n return render json: {:status=>14, :message=>'密码已经设置'} if u.password\n atts[:password] = params[:pass] \n end\n\n atts[:score_mode] = params[:score_mode] unless params[:score_mode].blank?\n atts[:tee] = params[:default_tee] unless params[:default_tee].blank?\n \n u.update_attributes(atts) \n \n ret = {:status=>0}\n unless params[:password].blank?\n @device.update_token\n ret[:token] = @device.token\n end\n render json: ret\n end",
"def create\n @user = User.external(user_params, request.headers[\"HTTP_APP_VERSION\"].to_i)\n if @user.errors.blank?\n render json: @user.user_show, status: :created\n if params[:device].present? and params[:device][:device_id].present?\n @device_data=Device.where(\"device_id\": params[:device][:device_id]).first\n @device_data.update(\"user_id\": @user.id) if @device_data.present?\n end\n else\n render_api_error(11, 401, \"error\", @user.try(:errors))\n end\n end",
"def devices; end",
"def devices=(value)\n @devices = value\n end",
"def show\n @site_config = SiteConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_config }\n end\n end",
"def show\n\t\t@list_config = current_user.list_configs.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @list_config }\n\t\t\tformat.json { render :json => @list_config }\n\t\t\tformat.yaml { render :text => @list_config.to_yaml, :content_type => 'text/yaml' }\n\t\tend\n\tend",
"def retriable_configuration\n Take2::Configuration::CONFIG_ATTRS.each_with_object({}) do |key, hash|\n hash[key] = send(key)\n end\n end",
"def show\n render json: @user_page_setting\n end",
"def list(filter, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter)\n\t\t\tclient.add_param(kparams, 'pager', pager)\n\t\t\tclient.queue_service_action_call('configurationgroupdevice', 'list', 'KalturaConfigurationGroupDeviceListResponse', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def scanConfig()\n configFile = @basePath + \".config.json\" ;\n open(configFile,\"r\"){|strm|\n @config = JSON.load(strm.read()) ;\n }\n return @config ;\n end",
"def get_uptime_check_config config_name\n require \"google/cloud/monitoring\"\n\n client = Google::Cloud::Monitoring.uptime_check_service\n config = client.get_uptime_check_config name: config_name\n pp config.to_h\n config\nend",
"def user_config(key)\n Autoproj.user_config(key)\nend",
"def set_userconfig\n @userconfig = Userconfig.find(params[:id])\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('configurations', 'get', 'KalturaConfigurations', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend"
] | [
"0.7492147",
"0.6698003",
"0.64019376",
"0.636954",
"0.6290901",
"0.62316716",
"0.6173154",
"0.60930663",
"0.6080835",
"0.60617256",
"0.6031278",
"0.5986048",
"0.59786606",
"0.5911146",
"0.58746797",
"0.58695865",
"0.5857259",
"0.5846473",
"0.5846473",
"0.5844806",
"0.5790104",
"0.5784713",
"0.5776229",
"0.57375234",
"0.57334036",
"0.5725059",
"0.5701192",
"0.56984144",
"0.56742215",
"0.56654704",
"0.5658554",
"0.5629561",
"0.5614853",
"0.5612207",
"0.5611713",
"0.56038314",
"0.560178",
"0.5589023",
"0.5579902",
"0.5578085",
"0.55702186",
"0.5556558",
"0.5543001",
"0.55259687",
"0.5525636",
"0.5507572",
"0.54944205",
"0.5486706",
"0.54617697",
"0.54574007",
"0.54472524",
"0.5443655",
"0.5401306",
"0.5399414",
"0.5390798",
"0.5378818",
"0.53737277",
"0.5373402",
"0.53603625",
"0.53556013",
"0.5353135",
"0.53480506",
"0.5346472",
"0.5344435",
"0.53089184",
"0.5308517",
"0.5307486",
"0.53015554",
"0.5297592",
"0.52923626",
"0.52782094",
"0.52766484",
"0.5274302",
"0.5269433",
"0.52537364",
"0.5253601",
"0.5251871",
"0.52466464",
"0.5236718",
"0.52271867",
"0.5220788",
"0.52156115",
"0.52119464",
"0.5201685",
"0.5201031",
"0.5193604",
"0.5187404",
"0.5182485",
"0.5172272",
"0.5168125",
"0.51613235",
"0.51526004",
"0.5149929",
"0.5148426",
"0.5146569",
"0.51374346",
"0.51373917",
"0.51354873",
"0.51228184",
"0.51207155"
] | 0.7543941 | 0 |
GET /user_device_configurations/new GET /user_device_configurations/new.json | def new
@user_device_configuration = UserDeviceConfiguration.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @user_device_configuration }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @user_device_configuration = UserDeviceConfiguration.new(params[:user_device_configuration])\n\n respond_to do |format|\n if @user_device_configuration.save\n format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully created.' }\n format.json { render json: @user_device_configuration, status: :created, location: @user_device_configuration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_device_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @system_configuration = SystemConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @system_configuration }\n end\n end",
"def new\n @device_user = DeviceUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @device_user }\n end\n end",
"def new\n if current_user.admin?\n @device = Device.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @device }\n end\n else\n redirect_to unauthorized_path\n end\n end",
"def new\n @system_config = SystemConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @system_config }\n end\n end",
"def new\n @my_configuration = MyConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_configuration }\n end\n end",
"def new\n @install_tracking_device_user = InstallTracking::DeviceUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @install_tracking_device_user }\n end\n end",
"def new\n @device = Device.new :name => params[:name], :deviceid => params[:deviceid]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @device }\n end\n end",
"def new\n @device = Device.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @device }\n end\n end",
"def new\n @device = Device.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @device }\n end\n end",
"def new\n @device = Device.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @device }\n end\n end",
"def new\n @conf = Conf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conf }\n end\n end",
"def new\n @configtable = Configtable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @configtable }\n end\n end",
"def create\n @graphium_configuration = Graphium::Configuration.new(graphium_configuration_params)\n\n respond_to do |format|\n if @graphium_configuration.save\n format.html { redirect_to @graphium_configuration, notice: 'Configuration was successfully created.' }\n format.json { render :show, status: :created, location: @graphium_configuration }\n else\n format.html { render :new }\n format.json { render json: @graphium_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\r\n @device = Device.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @device }\r\n end\r\n end",
"def new\n\t\t@provider_account = ProviderAccount.find(params[:provider_account_id])\n\t\t@launch_configuration = @provider_account.launch_configurations.build\n\t\t@users = User.find(:all, :order => :login)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @launch_configuration }\n\t\tend\n\tend",
"def new\n @sysconfig = Sysconfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sysconfig }\n end\n end",
"def new\n @global_config = AppConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @global_config }\n end\n end",
"def create\n @gpu_conf = GpuConf.new(gpu_conf_params)\n\n respond_to do |format|\n if @gpu_conf.save\n format.html { redirect_to @gpu_conf, notice: 'Gpu conf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gpu_conf }\n else\n format.html { render action: 'new' }\n format.json { render json: @gpu_conf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @device = @user.devices.new(device_params)\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to user_devices_path(@user), notice: 'Device was successfully added.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_user_device_info = Api::V1::UserDeviceInfo.new(api_v1_user_device_info_params)\n\n respond_to do |format|\n if @api_v1_user_device_info.save\n format.html { redirect_to @api_v1_user_device_info, notice: 'User device info was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_user_device_info }\n else\n format.html { render :new }\n format.json { render json: @api_v1_user_device_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @mydevice = Mydevice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mydevice }\n end\n end",
"def new\n @configuration_set = ConfigurationSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @configuration_set }\n end\n end",
"def create\n @device = Device.new(device_params)\n @device.user = current_user\n if @device.save\n render json: @device\n end\n end",
"def create\n @device = Device.new(:userid => current_user.id, :deviceid => params[:device][:deviceid], :hiveid => params[:device][:hiveid], \n :state => params[:device][:state], :version => params[:device][:version], :details => params[:device][:details])\n# @device = Device.new(params[:device])\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render json: @device, status: :created, location: @device }\n else\n format.html { render action: \"new\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create body = {}\n @connection.request(method: :post, path: \"/configs/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def new\n @configure = Configure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @configure }\n end\n end",
"def create\n # No permite registrar nada si el usuario ya creo su configuración\n @userconfig = current_user.build_userconfig(userconfig_params) unless current_user.userconfig\n\n respond_to do |format|\n if !@userconfig.nil? and @userconfig.save\n format.html { redirect_to taskstorages_path, notice: \"Userconfig was successfully created.\" }\n format.json { render :show, status: :created, location: taskstorages_path }\n else\n @userconfig = Userconfig.new\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: taskstorages_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @site_config = SiteConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site_config }\n end\n end",
"def new\n @dns_device_assoc = DnsDeviceAssoc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dns_device_assoc }\n end\n end",
"def new\n @pdevice = Pdevice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pdevice }\n end\n end",
"def create\n @device = Device.first\n if @device == nil\n @device = Device.new(device_params)\n @device.save!\n end\n render json: {\"device\": @device}, status: :created\n end",
"def new\n @current_config = ProjectConfig.create!(params[\"project\"].merge!(:user => @user))\n find_projects(params['project']['api_key'])\n flash.now[:notice] = \"The new configuration #{@current_config.name} has been added\"\n find_configurations\n end",
"def new\n @config_file = ConfigFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @config_file }\n end\n end",
"def create\n @device = Device.create!(device_params)\n json_response(@device, :created)\n end",
"def create\n @device = Device.where(user_id: auth_user.id, push_token: params[:device][:push_token] ).first if params[:device] && params[:device][:push_token].present?\n @device ||= Device.new(params[:device])\n @device.user_id = auth_user.id\n \n respond_to do |format|\n if @device.save\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render json: { device: @device.as_json, success: true } }\n else\n flash[:error] = @device.errors.values.join('. ')\n puts \" Errors: #{@device.errors.keys}\"\n\n format.html { render action: \"new\" }\n format.json { render json: make_json_status_hash(false) }\n end\n end\n end",
"def create\n @device_user = DeviceUser.new(params[:device_user])\n\n respond_to do |format|\n if @device_user.save\n format.html { redirect_to @device_user, notice: 'Device user was successfully created.' }\n format.json { render json: @device_user, status: :created, location: @device_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @device_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\tif signed_in?\n\t\t@current_client = current_user.username\n\t\tif current_user.username == 'admin'\n\t\t\t@clientconfig = Clientconfig.new\n\t\t\t@clients = Client.all.collect {|c| [c.name, c.id]}\n\t\telse\n\t\t\tredirect_to home_path\n\t\tend\n\telse\n\t\tredirect_to signin_path\n\tend\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clientconfig }\n end\n end",
"def create\n @device = Device.new(device_params)\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to devices_path, notice: 'Device was successfully created.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @app_config = AppConfig.new(params[:app_config])\n\n respond_to do |format|\n if @app_config.save\n format.html { redirect_to @app_config, notice: 'App config was successfully created.' }\n format.json { render json: @app_config, status: :created, location: @app_config }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @notify_config = NotifyConfig.new\n\n add_breadcrumb('Create Notification Configuration')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notify_config }\n end\n end",
"def create\n @system_configuration = SystemConfiguration.new(params[:system_configuration])\n\n respond_to do |format|\n if @system_configuration.save\n format.html { redirect_to @system_configuration, notice: 'System configuration was successfully created.' }\n format.json { render json: @system_configuration, status: :created, location: @system_configuration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @system_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @lab_device = LabDevice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_device }\n end\n end",
"def create\n @install_tracking_device_user = InstallTracking::DeviceUser.new(params[:install_tracking_device_user])\n\n respond_to do |format|\n if @install_tracking_device_user.save\n format.html { redirect_to @install_tracking_device_user, notice: 'Device user was successfully created.' }\n format.json { render json: @install_tracking_device_user, status: :created, location: @install_tracking_device_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @install_tracking_device_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @device = Device.new params[:device]\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render json: @device, status: :created, location: @device }\n else\n format.html { render action: \"new\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @configuration_detail = ConfigurationDetail.new(configuration_detail_params)\n\n respond_to do |format|\n if @configuration_detail.save\n format.html { redirect_to @configuration_detail, notice: 'Configuration detail was successfully created.' }\n format.json { render :show, status: :created, location: @configuration_detail }\n else\n format.html { render :new }\n format.json { render json: @configuration_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @device = Device.new(device_params)\n\n respond_to do |format|\n if @device.save\n format.json { render 'show', status: :created }\n else\n format.json { render json: {errors: @device.errors}, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @edge_configuration = model.new\n render :template => \"edge_configurations/new\"\n end",
"def new\n @gcm_device = GcmDevice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gcm_device }\n end\n end",
"def create\n @cdn_config = CdnConfig.new(params[:cdn_config])\n\n respond_to do |format|\n if @cdn_config.save\n @user = @cdn_config.cdn_user\n @response = {user:@user.edutorid,:password=>@user.plain_password,:deviceid=>@user.devices.last.deviceid}\n format.html { redirect_to @cdn_config, notice: 'Cdn config was successfully created.' }\n format.json { render json: @response }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cdn_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n data = ConfigurationTemplate.new(name: params[:name], description: params[:description],user: current_user)\n data.save\n render json: data\n\n end",
"def create\n @device_type = DeviceType.new(device_type_params)\n\n respond_to do |format|\n if @device_type.save\n format.html { redirect_to browse_url(protocol: redirect_protocol), notice: 'Device type was successfully created.' }\n format.json { render :show, status: :created, location: @device_type }\n else\n format.html { render :new }\n format.json { render json: @device_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @global_config = AppConfig.new(params[:global_config])\n\n respond_to do |format|\n if @global_config.save\n format.html { redirect_to @global_config, notice: 'Global config was successfully created.' }\n format.json { render json: @global_config, status: :created, location: @global_config }\n else\n format.html { render action: \"new\" }\n format.json { render json: @global_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @user_app = UserApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_app }\n end\n end",
"def new\n @car_configuration = CarConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @car_configuration }\n end\n end",
"def create\n @device = Device.new(device_params)\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @device = Device.new(device_params)\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @device = Device.new(device_params)\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @device = Device.new(device_params)\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @device = Device.new(params[:device])\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render json: @device, status: :created, location: @device }\n else\n format.html { render action: \"new\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # Save last known user's geo location\n if !params[:geo_lat].nil? && !params[:geo_lon].nil?\n @current_user.geo_lat = params[:geo_lat]\n @current_user.geo_lon = params[:geo_lon]\n if !params[:timezone].nil?\n @current_user.timezone = params[:timezone]\n end\n @current_user.save\n end\n\n @api_v1_device = Api::V1::Device.where('token = ? AND user_id = ? ', params[:token], @current_user.id).first\n\n if @api_v1_device.nil?\n @api_v1_device = Api::V1::Device.new(api_v1_device_params) \n @api_v1_device.user_id = @current_user.id \n \n if !@api_v1_device.save\n render json: @api_v1_device.errors, status: :unprocessable_entity\n else\n head :no_content\n end\n else\n head :no_content\n end\n end",
"def create\n @device = Device.new(device_params)\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render action: 'show', status: :created, location: @device }\n else\n format.html { render action: 'new' }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @app_config = AppConfig.new(app_config_params)\n\n respond_to do |format|\n if @app_config.save\n format.html { redirect_to @app_config, notice: 'App config was successfully created.' }\n format.json { render :show, status: :created, location: @app_config }\n else\n format.html { render :new }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @device = Device.new(device_params)\n respond_to do |format|\n if @device.save\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user\n @device = Device.find_by_token_and_user_id(params[:device][:token],@user.id)\n if @device\n\n # if the device was already in the db, return that entry so the app has the info anyway (refresh name first)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :device=>@device.as_json() \n } }\n end\n else\n \n # create\n @device = Device.create(params[:device])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :device=>@device.as_json() \n } }\n end\n end\n end",
"def create \n Configurations.create ( configurations_params)\n end",
"def create\n @mydevice = Mydevice.new(params[:mydevice])\n\n respond_to do |format|\n if @mydevice.save\n format.html { redirect_to @mydevice, notice: 'Mydevice was successfully created.' }\n format.json { render json: @mydevice, status: :created, location: @mydevice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mydevice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @conf = Conf.new(conf_params)\n canSave = true;\n\n if (request.format == :json)\n if (params[:params].blank?)\n canSave = false; \n logger.debug \"empty parameters\"\n else\n params[:params].each do |p|\n @conf.params.new(name: p[:name], value: p[:value])\n end\n end\n end\n\n respond_to do |format|\n if canSave && @conf.save\n format.html { redirect_to @conf, notice: 'Conf was successfully created.' }\n format.json { render :create, status: :created, location: @conf }\n else\n @conf = nil\n format.html { render :new }\n format.json { render :create, status: :not_implemented }\n end\n end\n end",
"def create\n @admin_configuration_identifier = Admin::ConfigurationIdentifier.new(admin_configuration_identifier_params)\n\n respond_to do |format|\n if @admin_configuration_identifier.save\n format.html { redirect_to @admin_configuration_identifier, notice: 'Configuration identifier was successfully created.' }\n format.json { render :show, status: :created, location: @admin_configuration_identifier }\n else\n format.html { render :new }\n format.json { render json: @admin_configuration_identifier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @system_config = SystemConfig.new(params[:system_config])\n\n respond_to do |format|\n if @system_config.save\n format.html { redirect_to @system_config, :notice => 'System config was successfully created.' }\n format.json { render :json => @system_config, :status => :created, :location => @system_config }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @system_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n # build a 'temporary' post which is written to DB later (create-method)\n @device = Device.new\n end",
"def new\n @device_attribute = @device.device_attributes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @device_attribute }\n end\n end",
"def show\n @user_device_configuration = UserDeviceConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_device_configuration }\n end\n end",
"def new\n @discovery_session = DiscoverySession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discovery_session }\n end\n end",
"def create\n @device = Device.new(device_params)\n org = Organization.where(:org_key => params[:secret_key]).take\n if !org.nil?\n @device.current_org = org.id\n # @device = Device.new\n end\n respond_to do |format|\n if !org.nil? and @device.save\n DeviceMembership.create(:device_id=>@device.id, :organization_id => org.id)\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { flash[:alert] = \"Invalid secret key. Ask your organization leader for the secret key!\"; render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def newprofile\n if params[\"auth_key\"] == nil or params[\"device_id\"] == nil or params[\"profile_url\"] == nil\n render :json => '{\"status\": \"failed\", \"reason\": \"incorrect parameters\"}'\n else\n device = Device.find(params[\"device_id\"])\n if device.auth_key == params[\"auth_key\"]\n device.profile_url = params[\"profile_url\"]\n if device.save\n render :json => '{\"status\": \"success\"}'\n else\n render :json => '{\"status\": \"failed\", \"reason\": \"save error\"}'\n end\n else\n render :json => '{\"status\": \"failed\", \"reason\": \"not authorized\"}'\n end\n end\n end",
"def new\n @kf_global_config = Kf::GlobalConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kf_global_config }\n end\n end",
"def new\n @conn = current_user.conns.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conn }\n end\n end",
"def create\n @admin_device = AdminDevice.new(admin_device_params)\n\n respond_to do |format|\n if @admin_device.save\n format.html { redirect_to @admin_device, notice: 'Admin device was successfully created.' }\n format.json { render :show, status: :created, location: @admin_device }\n else\n format.html { render :new }\n format.json { render json: @admin_device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @wp_dyna_config = WpDynaConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wp_dyna_config }\n end\n end",
"def create\n @room_config = RoomConfig.new(room_config_params)\n\n respond_to do |format|\n if @room_config.save\n format.html { redirect_to @room_config, notice: 'Room config was successfully created.' }\n format.json { render json: @room_config, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @room_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cfg = Cfg.new(cfg_params)\n\n respond_to do |format|\n if @cfg.save\n format.html { redirect_to @cfg, notice: 'Cfg was successfully created.' }\n format.json { render :show, status: :created, location: @cfg }\n else\n format.html { render :new }\n format.json { render json: @cfg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sm_backend_config = SmBackendConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sm_backend_config }\n end\n end",
"def create\r\n @device = Device.new(params[:device])\r\n\r\n respond_to do |format|\r\n if @device.save\r\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\r\n format.json { render json: @device, status: :created, location: @device }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @device.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def new\n @var_conf = VarConf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @var_conf }\n end\n end",
"def new\n @android_profile = @user.build_android_profile\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @android_profile }\n end\n end",
"def new\n\tadd_breadcrumb \"Nueva configuración\", :new_configuracion_path\n @configuracion = Configuracion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @configuracion }\n end\n end",
"def create\n @user = User.new(user_params)\n if @user_device_token = User.find_by_device_token(user_params['device_token'])\n @user_device_token.device_token = nil\n @user_device_token.save\n end\n\n if @user.save\n render json: @user, status: :created\n else\n @user = User.find_by_device_id(user_params['device_id'])\n if @user\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 else\n render json: @user.errors, status: :unprocessable_entity\n end\n end\n end",
"def index\n @user_device_configurations = UserDeviceConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_device_configurations }\n end\n end",
"def create\n @project_configuration = ProjectConfiguration.new(project_configuration_params)\n\n respond_to do |format|\n if @project_configuration.save\n format.html { redirect_to project_configurations_path, notice: 'Project configuration was successfully created.' }\n format.json { render action: 'show', status: :created, location: @project_configuration }\n else\n format.html { render action: 'new' }\n format.json { render json: @project_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @machine_config = MachineConfig.new(machine_config_params)\n\n respond_to do |format|\n if @machine_config.save\n format.html { redirect_to @machine_config, notice: 'Machine config was successfully created.' }\n format.json { render action: 'show', status: :created, location: @machine_config }\n else\n format.html { render action: 'new' }\n format.json { render json: @machine_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n require 'digest/md5'\n @user.device_id= Digest::MD5.hexdigest(User.random_string(10)).upcase\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to user_path(@user), :notice => @controller_name +t(:message_success_insert)}\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.external(user_params, request.headers[\"HTTP_APP_VERSION\"].to_i)\n if @user.errors.blank?\n render json: @user.user_show, status: :created\n if params[:device].present? and params[:device][:device_id].present?\n @device_data=Device.where(\"device_id\": params[:device][:device_id]).first\n @device_data.update(\"user_id\": @user.id) if @device_data.present?\n end\n else\n render_api_error(11, 401, \"error\", @user.try(:errors))\n end\n end",
"def create\n @product_configuration = ProductConfiguration.new(product_configuration_params)\n\n respond_to do |format|\n if @product_configuration.save\n format.html { redirect_to @product_configuration, notice: 'Product configuration was successfully created.' }\n format.json { render :show, status: :created, location: @product_configuration }\n else\n format.html { render :new }\n format.json { render json: @product_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @conf = Conf.new(params[:conf])\n\n respond_to do |format|\n if @conf.save\n format.html { redirect_to @conf, notice: 'Conf was successfully created.' }\n format.json { render json: @conf, status: :created, location: @conf }\n else\n format.html { render action: \"new\" }\n format.json { render json: @conf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @barn_configuration = BarnConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @barn_configuration }\n end\n end",
"def new\n @config_template = ConfigTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @config_template }\n format.xml { render :xml => @config_template }\n end\n end",
"def create\n @clientconfig = Clientconfig.new(params[:clientconfig])\n\n respond_to do |format|\n if @clientconfig.save\n format.html { redirect_to @clientconfig, notice: 'Clientconfig was successfully created.' }\n format.json { render json: @clientconfig, status: :created, location: @clientconfig }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clientconfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @device = Device.new(params[:device])\n #根据下拉列表中的设备类型创建一个设备详情表\n @device_type=DeviceType.find_by_name(params[:device][:device_type]).table\n @device_detail = Object.const_get(@device_type.classify).new(params[@device_type])\n\n unless [@device, @device_detail].map(&:valid?).include?(false)\n @device_detail.save\n @device.detail = @device_detail\n @device.save\n flash[:notice] = '新设备已经添加成功!'\n redirect_to(@device)\n else\n @provider=Provider.find(:all)\n render :action => \"new\"\n end\n end",
"def create\n @configtable = Configtable.new(params[:configtable])\n\n respond_to do |format|\n if @configtable.save\n format.html { redirect_to @configtable, notice: 'Configtable was successfully created.' }\n format.json { render json: @configtable, status: :created, location: @configtable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @configtable.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7416002",
"0.6693734",
"0.6640873",
"0.66044855",
"0.6557954",
"0.6548632",
"0.648198",
"0.642695",
"0.64139533",
"0.64139533",
"0.64139533",
"0.6399564",
"0.63916725",
"0.639119",
"0.6353396",
"0.63454413",
"0.63220626",
"0.6315711",
"0.62958187",
"0.6291078",
"0.62852484",
"0.6267671",
"0.6261729",
"0.6258027",
"0.62523335",
"0.6245677",
"0.6244615",
"0.62315893",
"0.6230707",
"0.6210843",
"0.6201571",
"0.61716276",
"0.61690533",
"0.61469907",
"0.61214465",
"0.6119452",
"0.6119384",
"0.61082757",
"0.60332346",
"0.602796",
"0.6016995",
"0.6012731",
"0.600961",
"0.60086787",
"0.60080445",
"0.6004033",
"0.598838",
"0.59759396",
"0.59670764",
"0.5966052",
"0.5949402",
"0.5944831",
"0.59414697",
"0.5932419",
"0.5921014",
"0.59165084",
"0.59165084",
"0.59165084",
"0.59165084",
"0.59160006",
"0.59136873",
"0.59135634",
"0.5906013",
"0.59047097",
"0.5903864",
"0.5901718",
"0.58999467",
"0.5899657",
"0.5890726",
"0.5885815",
"0.58811253",
"0.58803695",
"0.58745986",
"0.5868954",
"0.58534855",
"0.58499926",
"0.5837542",
"0.5837338",
"0.5834371",
"0.5822704",
"0.58087635",
"0.5802945",
"0.5793767",
"0.57933325",
"0.57889515",
"0.57872474",
"0.57866096",
"0.57838005",
"0.5777647",
"0.57709783",
"0.57701606",
"0.5766187",
"0.5760116",
"0.5759421",
"0.5758885",
"0.575802",
"0.5756573",
"0.57545483",
"0.57369494",
"0.57241905"
] | 0.7832908 | 0 |
POST /user_device_configurations POST /user_device_configurations.json | def create
@user_device_configuration = UserDeviceConfiguration.new(params[:user_device_configuration])
respond_to do |format|
if @user_device_configuration.save
format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully created.' }
format.json { render json: @user_device_configuration, status: :created, location: @user_device_configuration }
else
format.html { render action: "new" }
format.json { render json: @user_device_configuration.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @user_device_configuration = UserDeviceConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_device_configuration }\n end\n end",
"def index\n @user_device_configurations = UserDeviceConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_device_configurations }\n end\n end",
"def create\n # No permite registrar nada si el usuario ya creo su configuración\n @userconfig = current_user.build_userconfig(userconfig_params) unless current_user.userconfig\n\n respond_to do |format|\n if !@userconfig.nil? and @userconfig.save\n format.html { redirect_to taskstorages_path, notice: \"Userconfig was successfully created.\" }\n format.json { render :show, status: :created, location: taskstorages_path }\n else\n @userconfig = Userconfig.new\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: taskstorages_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_device_params\n params.require(:user_device).permit(:username, :device_id)\n end",
"def device_configuration=(value)\n @device_configuration = value\n end",
"def api_v1_user_device_info_params\n params.require(:api_v1_user_device_info).permit(:user_id, :os, :device_type, :device_model, :system_version, :app_version, :device_locale, :bundle_device)\n end",
"def user_params\n params.require(:user).permit(:device_id, :device_token, :device_type, :nickname, :profile_picture)\n end",
"def create\n @api_v1_user_device_info = Api::V1::UserDeviceInfo.new(api_v1_user_device_info_params)\n\n respond_to do |format|\n if @api_v1_user_device_info.save\n format.html { redirect_to @api_v1_user_device_info, notice: 'User device info was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_user_device_info }\n else\n format.html { render :new }\n format.json { render json: @api_v1_user_device_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_params\n params.require(:device).permit(:User_id, :Register_id)\n end",
"def create\n @user = User.new(user_params)\n if @user_device_token = User.find_by_device_token(user_params['device_token'])\n @user_device_token.device_token = nil\n @user_device_token.save\n end\n\n if @user.save\n render json: @user, status: :created\n else\n @user = User.find_by_device_id(user_params['device_id'])\n if @user\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 else\n render json: @user.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n @device = @user.devices.new(device_params)\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to user_devices_path(@user), notice: 'Device was successfully added.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def config_user\n atts = {}\n u = @device.user\n unless params[:name].blank?\n return render json: {:status=>11, :message=>'用户名已经设置,不能修改'} if u.name\n return render json: {:status=>12, :message=>'用户名已存在'} if User.find_by_name params[:name]\n atts[:name] = params[:name]\n end\n unless params[:email].blank?\n unless u.email.eql?(params[:email])\n return render json: {:status=>13, :message=>'邮箱已经注册过'} if User.find_by_email params[:email]\n end\n atts[:email] = params[:email]\n end \n unless params[:pass].blank?\n return render json: {:status=>14, :message=>'密码已经设置'} if u.password\n atts[:password] = params[:pass] \n end\n\n atts[:score_mode] = params[:score_mode] unless params[:score_mode].blank?\n atts[:tee] = params[:default_tee] unless params[:default_tee].blank?\n \n u.update_attributes(atts) \n \n ret = {:status=>0}\n unless params[:password].blank?\n @device.update_token\n ret[:token] = @device.token\n end\n render json: ret\n end",
"def device_params\n params.require(:device).permit(:user_id, :token, :app_id, :locale, :inactivated_at, :banner, :badge, :sound, :app_name, :app_version, :os_name, :os_version, :device_name, :device_version)\n end",
"def create\n @user = User.external(user_params, request.headers[\"HTTP_APP_VERSION\"].to_i)\n if @user.errors.blank?\n render json: @user.user_show, status: :created\n if params[:device].present? and params[:device][:device_id].present?\n @device_data=Device.where(\"device_id\": params[:device][:device_id]).first\n @device_data.update(\"user_id\": @user.id) if @device_data.present?\n end\n else\n render_api_error(11, 401, \"error\", @user.try(:errors))\n end\n end",
"def update\n @user_device_configuration = UserDeviceConfiguration.find(params[:id])\n\n respond_to do |format|\n if @user_device_configuration.update_attributes(params[:user_device_configuration])\n format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_device_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_params\n params.permit(:macaddress, :nickname, :description, :user_id, :stolen, :secret_key, :format)\n end",
"def show\n @user_device_configuration = UserDeviceConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_device_configuration }\n end\n end",
"def mobile_app_configurations=(value)\n @mobile_app_configurations = value\n end",
"def destroy\n @user_device_configuration = UserDeviceConfiguration.find(params[:id])\n @user_device_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to user_device_configurations_url }\n format.json { head :ok }\n end\n end",
"def kernel_config_params\n params.require(:kernel_config).permit(:user_id, :config_url)\n end",
"def device_registration_params\n params.require(:device_registration).permit(:device_id, :email, :registration_key, :user_id, :platform)\n end",
"def create body = {}\n @connection.request(method: :post, path: \"/configs/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def create\n @graphium_configuration = Graphium::Configuration.new(graphium_configuration_params)\n\n respond_to do |format|\n if @graphium_configuration.save\n format.html { redirect_to @graphium_configuration, notice: 'Configuration was successfully created.' }\n format.json { render :show, status: :created, location: @graphium_configuration }\n else\n format.html { render :new }\n format.json { render json: @graphium_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_params\n params.require(:device).permit(:auth_key, :parse_token, :profile_url)\n end",
"def device_configuration_user_activity()\n return MicrosoftGraph::Reports::DeviceConfigurationUserActivity::DeviceConfigurationUserActivityRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def config_user_params\n params.require(:config_user).permit(:user_id, :category_id, :nombre, :slogan, :descripcion, :direccion, :pagina, :facebook, :whatsapp, :telefono, :horario, :condiciones_higiene, :tipo_entrega, :costo_envio, :compra_minima, :metodo_pago, :factura, :beneficiario, :cuenta, :banco, :aviso, :comentario, :vista_card, :logo, :estado, :ciudad, :reparto, :mostrar_direccion, :recibir_whatsapp)\n end",
"def register_device\n user = User.find(params[:user_id])\n\n user.devices.find_or_create_by(token: params[:token], os: params[:os])\n\n head :ok\n end",
"def device_params\n params.require(:device).permit!\n end",
"def create\n @device_user = DeviceUser.new(params[:device_user])\n\n respond_to do |format|\n if @device_user.save\n format.html { redirect_to @device_user, notice: 'Device user was successfully created.' }\n format.json { render json: @device_user, status: :created, location: @device_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @device_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @device = Device.new(device_params)\n @device.user = current_user\n if @device.save\n render json: @device\n end\n end",
"def make_user_device(user, device,\n ua_token = '64ce3cbfb716c0eb61adc2d6da1f2781e8b74d39b49c1e521108db9109b1be35')\n @@user_device_start_count += 1\n UserDevice.create!(user_id: user.id,\n device_id: device.id,\n name: \"Test Device\",\n )\n end",
"def register_device_for_user(user, device_token, device_name, model, system_version, app_version, app_bundle_version, locale, development)\n device = Device.first(:device_token => device_token)\n if device.nil?\n # Create new device if it does not already exist\n device = Device.new\n user.devices.push(device)\n end\n \n # Update information\n device.device_token = device_token\n device.device_name = device_name\n device.model = model\n device.system_version = system_version\n device.app_version = app_version\n device.app_bundle_version = app_bundle_version\n device.locale = locale\n device.development = development\n \n device.save!\n end",
"def device_params\n params.require(:device).permit(:name, :beacon_id, :device_type)\n end",
"def device_params\n params.require(:device).permit(:installation_id, :push_token)\n end",
"def create\n @cdn_config = CdnConfig.new(params[:cdn_config])\n\n respond_to do |format|\n if @cdn_config.save\n @user = @cdn_config.cdn_user\n @response = {user:@user.edutorid,:password=>@user.plain_password,:deviceid=>@user.devices.last.deviceid}\n format.html { redirect_to @cdn_config, notice: 'Cdn config was successfully created.' }\n format.json { render json: @response }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cdn_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_params\n params.require(:device).permit(:device_id,:email,:hasRegistered)\n end",
"def device_params\n params.require(:device).permit(:tele, :pawprint, :name, :email, :secret_key )\n end",
"def create\n\n # Save last known user's geo location\n if !params[:geo_lat].nil? && !params[:geo_lon].nil?\n @current_user.geo_lat = params[:geo_lat]\n @current_user.geo_lon = params[:geo_lon]\n if !params[:timezone].nil?\n @current_user.timezone = params[:timezone]\n end\n @current_user.save\n end\n\n @api_v1_device = Api::V1::Device.where('token = ? AND user_id = ? ', params[:token], @current_user.id).first\n\n if @api_v1_device.nil?\n @api_v1_device = Api::V1::Device.new(api_v1_device_params) \n @api_v1_device.user_id = @current_user.id \n \n if !@api_v1_device.save\n render json: @api_v1_device.errors, status: :unprocessable_entity\n else\n head :no_content\n end\n else\n head :no_content\n end\n end",
"def office365_demo_user_registration\n\n @result = {}\n\n resource = User.includes(:profile,:devices).find_by_email(params[:user][:email_id])\n\n if resource.nil?\n @result = @result.merge({sign_in: false,:edutorid_error_message=>'Email not found in the database',:message=>'Invalid emailid, enter correct Emailid'})\n respond_to do |format|\n format.json {render json: @result}\n end\n return\n end\n\n mDeviceID = \"\"\n\n @device_count = resource.institution.user_configuration.devices_per_user\n\n if (resource.devices.count >= @device_count) and !resource.devices.map(&:mac_id).include? (params[:device][:mac_id])\n @result = @result.merge({sign_in: false,:message=>'Maximum devices'})\n respond_to do |format|\n format.json {render json: @result}\n end\n return\n elsif resource.devices.count < @device_count or resource.devices.map(&:mac_id).include? (params[:device][:mac_id])\n devices = Device.where(:mac_id=>params[:device][:mac_id])\n if !devices.empty?\n if resource.devices.map(&:deviceid).include? (devices.last.deviceid) or devices.first.users.empty?\n mDeviceID = devices.last.deviceid\n @myReturn = set_device_ignitor(resource,params,mDeviceID)\n else\n @result = @result.merge({sign_in: false,:message=>\"Device already assigned to other user -- #{devices.first.users.first.edutorid}\"})\n respond_to do |format|\n format.json {render json: @result}\n end\n return\n end\n else\n mDeviceID = \"ES\"+get_device_id_sa;\n @myReturn = set_device_ignitor(resource,params,mDeviceID)\n end\n else\n logger.info\"--- check this scenario ---\"\n end\n\n device = Device.find_by_deviceid(mDeviceID)\n\n if !device\n @result = @result.merge({sign_in: false,:deviceid_error_message=>'Deviceid not found in the database',:message=>'Deviceid not found in the database'})\n else\n @result = @result.merge({sign_in: false,:deviceid_error_message=>'deviceid is null',:message=>'deviceid is null'})\n end\n\n if !resource.nil? && !device.nil?\n if (resource.institution_id != device.institution_id)\n @result = @result.merge({sign_in: false,:device_move_error_message=>'Device might NOT have been moved !!',:message=>'Device might NOT have been moved !!'})\n end\n end\n unless device.nil?\n if (resource.institution_id == device.institution_id) and true #resource.valid_password?(params[:user][:password])\n sign_in(resource_name,resource)\n institution = resource.institution\n center = resource.center\n class_info = center.academic_classes.any? ? center.academic_classes.map{|ac_class| Hash[class: ac_class.as_json(:include=>:profile)] } : []\n section_info = center.sections.any? ? center.sections.map{|section| Hash[section: section.as_json(:include=>:profile)] } : []\n @result = @result.merge({device_id:mDeviceID,is_primary: true,sign_in: true,:message=>'Alloted this device as primary',:user=>resource.as_json(:include => :profile),institution: institution.as_json(:include=>:profile),center: center.as_json(:include=>:profile),class_arry: class_info,sections_arry: section_info, store_url:current_user.get_store_url.present?, authentication_token: current_user.authentication_token})\n end\n else\n sign_out(resource_name)\n @result = @result.merge({is_primary: nil,sign_in: false,:message=>'No device found in edutor list'})\n end\n respond_to do |format|\n format.json {render json: @result}\n end\n end",
"def capture_user_data\n\n # add a user config row entry\n user_data = Userconfig.new(username: session[:userinfo].blank? ? \"\" : session[:userinfo]['info']['name'],\n date: DateTime.now,\n company: session[:company],\n okta: session[:okta] == \"on\" ? true : false,\n logo_url: session[:logo],\n home_url: session[:background],\n vault: true,\n resources: session[:resources] == \"on\" ? true : false,\n onboarding_tasks: session[:onboarding] == \"on\" ? true : false,\n medical_credentialing: session[:medical_credentialing] == \"on\" ? true : false,\n loan_origination: session[:loan_docs] == \"on\" ? true : false,\n upload_sign: session[:upload_sign] == \"on\" ? true : false,\n tax_return: session[:tax_return] == \"on\" ? true : false,\n submit_claim: session[:create_claim] == \"on\" ? true : false,\n eventstream: session[:eventstream] == \"on\" ? true : false)\n user_data.save\n end",
"def hm_device options\n id = options[:id] || 1\n {\n id: id,\n device_type: options[:device_type] || 'Mobile',\n operating_system_name: options[:os] || 'android',\n operating_system_version: options[:os_version] || '1.2.3',\n serial: \"serial#{id}\",\n model: options[:model] || 'Test Model',\n brand: options[:brand] || 'Test Brand',\n }\nend",
"def device_params\n params.require(:device).permit(:mac_address, :ipv4, :ipv6, :kind, :last_seen, :extra, :given_name)\n end",
"def create\n @gpu_conf = GpuConf.new(gpu_conf_params)\n\n respond_to do |format|\n if @gpu_conf.save\n format.html { redirect_to @gpu_conf, notice: 'Gpu conf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gpu_conf }\n else\n format.html { render action: 'new' }\n format.json { render json: @gpu_conf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_create_params\n params.require(:device).permit(:name, :device_type_id, :primary_member_id, :os_version, :wifi_mac, :build_version, :product_name, :model_name, :mac_address)\n end",
"def create\n @kernel_config = current_user.kernel_configs.build(kernel_config_params)\n\n respond_to do |format|\n if @kernel_config.save\n format.html { redirect_to @kernel_config, notice: \"Kernel config was successfully created.\" }\n format.json { render :show, status: :created, location: @kernel_config }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @kernel_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_params\n params.require(:device).permit(\n :patient_id,\n :platform,\n :token\n )\n end",
"def devices=(value)\n @devices = value\n end",
"def set_api_v1_user_device_info\n @api_v1_user_device_info = Api::V1::UserDeviceInfo.find(params[:id])\n end",
"def device_params\n params.require(:device).permit(:name, :details, :category_id, :location, :status)\n end",
"def create\n @install_tracking_device_user = InstallTracking::DeviceUser.new(params[:install_tracking_device_user])\n\n respond_to do |format|\n if @install_tracking_device_user.save\n format.html { redirect_to @install_tracking_device_user, notice: 'Device user was successfully created.' }\n format.json { render json: @install_tracking_device_user, status: :created, location: @install_tracking_device_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @install_tracking_device_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def userconfig_params\n params.require(:userconfig).permit(:nombre, :apellidop, :apellidom, :descripcion)\n end",
"def device_params\n params.require(:device).permit(:device_id)\n end",
"def create_configuration_with_http_info(configuration_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.create_configuration ...'\n end\n # verify the required parameter 'configuration_body' is set\n if @api_client.config.client_side_validation && configuration_body.nil?\n fail ArgumentError, \"Missing the required parameter 'configuration_body' when calling UsersApi.create_configuration\"\n end\n # resource path\n local_var_path = '/users/me/configurations'\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(configuration_body) \n\n # return_type\n return_type = opts[:return_type] || 'UserConfiguration' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#create_configuration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource_name, resource)\n if resource\n device_id = params[:user][:device_id]\n if current_user.block?\n sign_out resource\n render json: { error: 'Your account is inactive. Contact admin.' } and return\n elsif device_id.nil? || Setting.limit_devices.nil?\n resource.authentication_token = nil\n resource.save\n respond_to do |format|\n format.html { redirect_to admin_admin_dashboard_path }\n format.json { render json: resource }\n end\n elsif current_user.device_id.nil?\n user = User.where(device_id: device_id)\n if user.count === 0\n resource.device_id = device_id\n resource.authentication_token = nil\n resource.save\n respond_to do |format|\n format.html { redirect_to admin_admin_dashboard_path }\n format.json { render json: resource }\n end\n elsif user.first.id === resource.id\n resource.device_id = device_id\n resource.authentication_token = nil\n resource.save\n respond_to do |format|\n format.html { redirect_to admin_admin_dashboard_path }\n format.json { render json: resource }\n end\n else\n sign_out resource\n render json: { error: 'Unauthorized device' } and return\n end\n elsif current_user.device_id == device_id\n resource.authentication_token = nil\n resource.save\n respond_to do |format|\n format.html { redirect_to admin_admin_dashboard_path }\n format.json { render json: resource }\n end\n else\n sign_out resource\n render json: { error: 'Unauthorized device' } and return\n end\n end\n end",
"def device_params\n params.require(:device).permit(:owner, :name, :device_type, :location, :public_ip, :private_ip, :device_note, :addons, :general_status, :general_reloaded, :osname, :osram, :osprocessor, :detail)\n end",
"def parseDeviceData(doc, params)\n \n dev_type = (doc.find_first('//xmpp2rest/user/device/dev_type')) ? doc.find_first('//xmpp2rest/user/device/dev_type').content : nil\n password = (doc.find_first('//xmpp2rest/user/device/password')) ? doc.find_first('//xmpp2rest/user/device/password').content : nil\n \n if not dev_type or not password\n raise Exception.new(\"Missing elements data for creating new device!\")\n end \n \n params.merge!({:dev_type => dev_type})\n params.merge!({:password => password})\n \n return params\n end",
"def create\n @admin_device = AdminDevice.new(admin_device_params)\n\n respond_to do |format|\n if @admin_device.save\n format.html { redirect_to @admin_device, notice: 'Admin device was successfully created.' }\n format.json { render :show, status: :created, location: @admin_device }\n else\n format.html { render :new }\n format.json { render json: @admin_device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_params\n params.require(:device).permit(:name, :device_type, :location, :public_ip, :private_ip)\n end",
"def app_config_params\n params.require(:app_config).permit(:name, :value, :app_id)\n end",
"def device_params\n params.permit([:name, :uuid, :token])\n end",
"def create \n Configurations.create ( configurations_params)\n end",
"def create\n @device = Device.new(:userid => current_user.id, :deviceid => params[:device][:deviceid], :hiveid => params[:device][:hiveid], \n :state => params[:device][:state], :version => params[:device][:version], :details => params[:device][:details])\n# @device = Device.new(params[:device])\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render json: @device, status: :created, location: @device }\n else\n format.html { render action: \"new\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def device_configuration\n return @device_configuration\n end",
"def gpu_conf_params\n params.require(:gpu_conf).permit(:name, :max_temp, :max_cpu, :run_only_inactive)\n end",
"def device_params\n params.fetch(:device, {}).permit(:name, :model, :device_id, :place, :latitude, :longitude)\n end",
"def device_params\n params.require(:device).permit(:name, :control_mode, :hysteresis, :update_channel)\n end",
"def device_configuration_states()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::DeviceConfigurationStates::DeviceConfigurationStatesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def rubidevice_params\n params.require(:rubidevice).permit(:user_id, :identifier, :model, :creation, :owner)\n end",
"def create\n @device = Device.create!(device_params)\n json_response(@device, :created)\n end",
"def device_signup_params\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :name) }\n end",
"def create\n user = User.new \n user.email = params[:email]\n user.password = params[:password]\n user.username = params[:user_name]\n user.phone = params[:phone]\n user.user_type = \"consumer\"\n if user.save\n DeviceToken.create(:device_token=>params[:device_token],:user_id=>user.id)\n render :json=> {:success=>true, :id=>user.id, :email=>user.email}, :status=>200\n return\n else\n warden.custom_failure!\n #render :json=> user.errors, :success=> false, :status=>422\n render :json=> {:success=> false, :status=>422}\n end\n end",
"def create\n @device = Device.new(device_params)\n\n respond_to do |format|\n if @device.save\n format.json { render 'show', status: :created }\n else\n format.json { render json: {errors: @device.errors}, status: :unprocessable_entity }\n end\n end\n end",
"def installation_params\n if current_user.present?\n params.require(:installation).permit(:device_type, :token).merge(:user_id => current_user.id)\n else\n params.require(:installation).permit(:device_type, :token)\n end\n end",
"def create\n @device = Device.new(device_params)\n org = Organization.where(:org_key => params[:secret_key]).take\n if !org.nil?\n @device.current_org = org.id\n # @device = Device.new\n end\n respond_to do |format|\n if !org.nil? and @device.save\n DeviceMembership.create(:device_id=>@device.id, :organization_id => org.id)\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { flash[:alert] = \"Invalid secret key. Ask your organization leader for the secret key!\"; render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def config_params\n params.require(:app_config).permit(:name, :value)\n end",
"def user_params\n params.require(:user).permit(User::REGISTRABLE_ATTRIBUTES)\n end",
"def add_webauthn_device(app_id, user, fake_device = nil, name: 'My device')\n fake_device ||= WebAuthn::FakeClient.new(app_id)\n\n options_for_create = WebAuthn::Credential.options_for_create(\n user: { id: user.webauthn_xid, name: user.username },\n authenticator_selection: { user_verification: 'discouraged' },\n rp: { name: 'GitLab' }\n )\n challenge = options_for_create.challenge\n\n device_response = fake_device.create(challenge: challenge).to_json # rubocop:disable Rails/SaveBang\n device_registration_params = { device_response: device_response,\n name: name }\n\n Webauthn::RegisterService.new(\n user, device_registration_params, challenge).execute\n FakeWebauthnDevice.new(page, name, fake_device)\n end",
"def create\n @app_config = AppConfig.new(app_config_params)\n\n respond_to do |format|\n if @app_config.save\n format.html { redirect_to @app_config, notice: 'App config was successfully created.' }\n format.json { render :show, status: :created, location: @app_config }\n else\n format.html { render :new }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n unless current_user\n render json: current_user, status: :ok and return\n end \n existing_device=Device.find_by(endpoint: params[:subscription][:endpoint])\n if existing_device\n #endpoint= params[:subscription][:endpoint]\n #p256dh= params[:subscription][:keys][:p256dh]\n #auth= params[:subscription][:keys][:auth]\n #existing_device.update(endpoint: endpoint,p256dh: p256dh, auth: auth)\n #render json: existing_device, status: :ok and return\n existing_device.destroy\n end\n @device = Device.new()\n @device.user_id=current_user.id\n\n @device.endpoint= params[:subscription][:endpoint]\n @device.p256dh= params[:subscription][:keys][:p256dh]\n @device.auth= params[:subscription][:keys][:auth]\n# @device.save\n respond_to do |format|\n if @device.save\n# format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render :json => {:message=>\"Sucess\"}}\n# @message = {\n# title: \"Llamado para\",\n# body: \"ELba Neado\",\n# icon: \"/icon-min.png\",\n# url: \"/events/\"\n#}\n# Webpush.payload_send(\n# message: JSON.generate(@message),\n# endpoint: @device.endpoint,\n# p256dh: @device.p256dh,\n# auth: @device.auth,\n# ttl: 24 * 60 * 60,\n# vapid: {\n# subject: 'mailto:sender@example.com',\n# public_key: ENV['VAPID_PUBLIC_KEY'],\n# private_key: ENV['VAPID_PRIVATE_KEY']\n# }\n# )\n# \n# else\n# format.html { render :new }\n# format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def casespace_seed_config_add_users(config)\r\n users = [config[:users]].flatten.compact\r\n return if users.blank?\r\n seed_config_message('++Adding seed config users.', config)\r\n users.each do |hash|\r\n casespace_seed_config_add_user(hash)\r\n end\r\nend",
"def create\n @device = Device.new(device_params)\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to devices_path, notice: 'Device was successfully created.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user\n @device = Device.find_by_token_and_user_id(params[:device][:token],@user.id)\n if @device\n\n # if the device was already in the db, return that entry so the app has the info anyway (refresh name first)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :device=>@device.as_json() \n } }\n end\n else\n \n # create\n @device = Device.create(params[:device])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :device=>@device.as_json() \n } }\n end\n end\n end",
"def create\n @device = Device.first\n if @device == nil\n @device = Device.new(device_params)\n @device.save!\n end\n render json: {\"device\": @device}, status: :created\n end",
"def update_configuration\n if @@initialized\n url = 'http://'+ENV['CONSUL_IP']+':8500/v1/kv/docker_nodes?raw'\n #log_message('Updating configuration from: ' + url)\n response = HTTPService.get_request(url)\n log_message('Dynamo changed, updating configuration to: ' + response.body)\n response = JSON.parse(response.body)\n replicate_data(response)\n end\n respond_to do |format|\n format.json { render :json => { :configuration => @@dynamo_nodes } }\n end\n end",
"def create\n @device = Device.where(user_id: auth_user.id, push_token: params[:device][:push_token] ).first if params[:device] && params[:device][:push_token].present?\n @device ||= Device.new(params[:device])\n @device.user_id = auth_user.id\n \n respond_to do |format|\n if @device.save\n format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render json: { device: @device.as_json, success: true } }\n else\n flash[:error] = @device.errors.values.join('. ')\n puts \" Errors: #{@device.errors.keys}\"\n\n format.html { render action: \"new\" }\n format.json { render json: make_json_status_hash(false) }\n end\n end\n end",
"def create\n @app_config = AppConfig.new(params[:app_config])\n\n respond_to do |format|\n if @app_config.save\n format.html { redirect_to @app_config, notice: 'App config was successfully created.' }\n format.json { render json: @app_config, status: :created, location: @app_config }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def configuration_params\n params.require(:configuration).permit(:name, :value)\n end",
"def metric_devices=(value)\n @metric_devices = value\n end",
"def register_device(device)\n if !(user.blank?) then \n respond_to do |format|\n if device.save then \n format.html { redirect_to device, notice: 'device was successfully created.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { render :new }\n format.json { render json: device.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def configuration_params\n params.require(:configuration).permit(:name, :config_status, :site_id, :user_id, :camera_id, :zone_id, :slotconfiguration, :roihomo)\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 register\n @device = Device.create(devices_params)\n if @device.valid?\n render json: @device, status: :created\n else\n render json: { error: 'failed to register device' }, status: :internal_server_error\n end\n end",
"def register\n device = Device.create(device_params)\n if device.valid? \n render json: device, status: 200\n else \n render json: {\"error\": device.errors.full_messages}, status: 500\n end\n end",
"def create\n @user = User.new(params[:user])\n if @user.save\n appSetting = AppSetting.new()\n appSetting.user_id = @user.id\n appSetting.save()\n end\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(resource)\n session = Puppet::NetDev::CE::Device.session\n\n set_user_xml = '<rpc><edit-config><target><running/></target><default-operation>merge</default-operation><error-option>rollback-on-error</error-option><config><aaa xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\"><lam><users><user operation=\"merge\"><userName>' + (resource[:name]).to_s + '</userName>'\n\n if resource[:password]\n set_user_xml += '<password>' + (resource[:password]).to_s + '</password>'\n end\n\n set_user_xml += '</user></users></lam></aaa></config></edit-config></rpc>'\n\n session.rpc.do_config(set_user_xml)\n end",
"def device_params\n params[:device]\n end",
"def create_credentials\n post_url = URI(\"http://#{FBPi::Settings.meshblu_url}/devices\")\n res = Net::HTTP.post_form(post_url, {})\n json = JSON.parse(res.body).deep_symbolize_keys\n File.open(credentials_file, 'w+') { |file| file.write(json.to_yaml) }\n load_credentials\n json\n end",
"def set_user_device\n #@user_device = UserDevice.find(params[:id])\n id = params[:id]\n if is_numeric(id)\n @user_device = UserDevice.find(id)\n else\n render status: 406\n end\n end"
] | [
"0.6286393",
"0.6214254",
"0.6205987",
"0.6070616",
"0.60648894",
"0.60373116",
"0.59652203",
"0.5938822",
"0.59274423",
"0.5905517",
"0.58977926",
"0.5889703",
"0.588639",
"0.58825624",
"0.5842152",
"0.5767097",
"0.576701",
"0.5760106",
"0.5741859",
"0.57213974",
"0.5700535",
"0.5671338",
"0.5614406",
"0.56060475",
"0.5604294",
"0.55816686",
"0.5580653",
"0.55521995",
"0.5549684",
"0.55319196",
"0.5525964",
"0.551305",
"0.55023783",
"0.546116",
"0.5445545",
"0.54394066",
"0.5433243",
"0.5416362",
"0.5401348",
"0.53933173",
"0.53852916",
"0.53802174",
"0.537016",
"0.53554744",
"0.53416747",
"0.5333242",
"0.5324508",
"0.53186876",
"0.5317066",
"0.53049695",
"0.53039247",
"0.52942216",
"0.52713543",
"0.52666223",
"0.52651215",
"0.5261971",
"0.5215165",
"0.52151304",
"0.5208254",
"0.5208025",
"0.5206685",
"0.5201166",
"0.51955694",
"0.51955694",
"0.5193616",
"0.5188544",
"0.5183952",
"0.51785356",
"0.5169106",
"0.516528",
"0.5164269",
"0.5160048",
"0.51568705",
"0.5152541",
"0.51496077",
"0.51482743",
"0.5130256",
"0.512601",
"0.5124412",
"0.5116955",
"0.510327",
"0.5100969",
"0.5099349",
"0.5095765",
"0.50951505",
"0.5079196",
"0.5076578",
"0.5068945",
"0.50591767",
"0.50581646",
"0.5057735",
"0.50456816",
"0.5039092",
"0.50367755",
"0.5027496",
"0.50216985",
"0.50213695",
"0.50204635",
"0.5018524",
"0.50117147"
] | 0.72387016 | 0 |
PUT /user_device_configurations/1 PUT /user_device_configurations/1.json | def update
@user_device_configuration = UserDeviceConfiguration.find(params[:id])
respond_to do |format|
if @user_device_configuration.update_attributes(params[:user_device_configuration])
format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @user_device_configuration.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def create\n @user_device_configuration = UserDeviceConfiguration.new(params[:user_device_configuration])\n\n respond_to do |format|\n if @user_device_configuration.save\n format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully created.' }\n format.json { render json: @user_device_configuration, status: :created, location: @user_device_configuration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_device_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_user_device_info\n @api_v1_user_device_info = Api::V1::UserDeviceInfo.find(params[:id])\n end",
"def device_configuration=(value)\n @device_configuration = value\n end",
"def update\n respond_to do |format|\n if @api_v1_user_device_info.update(api_v1_user_device_info_params)\n format.html { redirect_to @api_v1_user_device_info, notice: 'User device info was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_user_device_info }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_user_device_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @user_device_configuration = UserDeviceConfiguration.find(params[:id])\n @user_device_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to user_device_configurations_url }\n format.json { head :ok }\n end\n end",
"def update\n @configuration.user_id = current_user.id\n respond_to do |format|\n if @configuration.update(configuration_params)\n format.html { redirect_to @configuration, notice: 'Configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: @configuration }\n else\n format.html { render :edit }\n format.json { render json: @configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @userconfig.update(userconfig_params)\n format.html { redirect_to taskstorages_path, notice: \"Userconfig was successfully updated.\" }\n format.json { render :show, status: :ok, location: taskstorages_path }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: taskstorages_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_v1_user_device_info_params\n params.require(:api_v1_user_device_info).permit(:user_id, :os, :device_type, :device_model, :system_version, :app_version, :device_locale, :bundle_device)\n end",
"def create\n @user = User.external(user_params, request.headers[\"HTTP_APP_VERSION\"].to_i)\n if @user.errors.blank?\n render json: @user.user_show, status: :created\n if params[:device].present? and params[:device][:device_id].present?\n @device_data=Device.where(\"device_id\": params[:device][:device_id]).first\n @device_data.update(\"user_id\": @user.id) if @device_data.present?\n end\n else\n render_api_error(11, 401, \"error\", @user.try(:errors))\n end\n end",
"def update\n @device.update(device_params)\n head :no_content\n end",
"def show\n @user_device_configuration = UserDeviceConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_device_configuration }\n end\n end",
"def config_user\n atts = {}\n u = @device.user\n unless params[:name].blank?\n return render json: {:status=>11, :message=>'用户名已经设置,不能修改'} if u.name\n return render json: {:status=>12, :message=>'用户名已存在'} if User.find_by_name params[:name]\n atts[:name] = params[:name]\n end\n unless params[:email].blank?\n unless u.email.eql?(params[:email])\n return render json: {:status=>13, :message=>'邮箱已经注册过'} if User.find_by_email params[:email]\n end\n atts[:email] = params[:email]\n end \n unless params[:pass].blank?\n return render json: {:status=>14, :message=>'密码已经设置'} if u.password\n atts[:password] = params[:pass] \n end\n\n atts[:score_mode] = params[:score_mode] unless params[:score_mode].blank?\n atts[:tee] = params[:default_tee] unless params[:default_tee].blank?\n \n u.update_attributes(atts) \n \n ret = {:status=>0}\n unless params[:password].blank?\n @device.update_token\n ret[:token] = @device.token\n end\n render json: ret\n end",
"def create_or_update_profile_configuration(args = {}) \n id = args['profileId']\n temp_path = \"/profiles.json/{profileId}/configuration\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"profileId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def new\n @user_device_configuration = UserDeviceConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_device_configuration }\n end\n end",
"def set_user_device\n #@user_device = UserDevice.find(params[:id])\n id = params[:id]\n if is_numeric(id)\n @user_device = UserDevice.find(id)\n else\n render status: 406\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.json { head :no_content }\n else\n format.json { render json: {errors: @device.errors}, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @user_device_configurations = UserDeviceConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_device_configurations }\n end\n end",
"def user_device_params\n params.require(:user_device).permit(:username, :device_id)\n end",
"def update\n\t\t#params[:device][:asset_ids] ||= []\n\t\tparams[:device][:register_ids] ||= []\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n flash[:notice] = 'Device was successfully updated.'\n format.html { redirect_to(@device) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @device.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_configuration\n if @@initialized\n url = 'http://'+ENV['CONSUL_IP']+':8500/v1/kv/docker_nodes?raw'\n #log_message('Updating configuration from: ' + url)\n response = HTTPService.get_request(url)\n log_message('Dynamo changed, updating configuration to: ' + response.body)\n response = JSON.parse(response.body)\n replicate_data(response)\n end\n respond_to do |format|\n format.json { render :json => { :configuration => @@dynamo_nodes } }\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.json { render :show, status: :ok, location: @device }\n else\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @device_user = DeviceUser.find(params[:id])\n\n respond_to do |format|\n if @device_user.update_attributes(params[:device_user])\n format.html { redirect_to @device_user, notice: 'Device user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @device.update(device_params) &&\n format.html { redirect_to user_devices_path(@user), notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_params\n params.require(:device).permit(:user_id, :token, :app_id, :locale, :inactivated_at, :banner, :badge, :sound, :app_name, :app_version, :os_name, :os_version, :device_name, :device_version)\n end",
"def device_params\n params.require(:device).permit(:User_id, :Register_id)\n end",
"def create\n @user = User.new(user_params)\n if @user_device_token = User.find_by_device_token(user_params['device_token'])\n @user_device_token.device_token = nil\n @user_device_token.save\n end\n\n if @user.save\n render json: @user, status: :created\n else\n @user = User.find_by_device_id(user_params['device_id'])\n if @user\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 else\n render json: @user.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n \n @user.address = Address.new(\"address\" => params[:user][:address])\n \n config = Configuration.new()\n config.square = params[:user][:raio]\n config.address = Address.new(\"address\" => params[:user][:configuration_address])\n @user.configuration = config.as_json\n \n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to root_url, notice: 'Usuário atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @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 create\n @api_v1_user_device_info = Api::V1::UserDeviceInfo.new(api_v1_user_device_info_params)\n\n respond_to do |format|\n if @api_v1_user_device_info.save\n format.html { redirect_to @api_v1_user_device_info, notice: 'User device info was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_user_device_info }\n else\n format.html { render :new }\n format.json { render json: @api_v1_user_device_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def device_id=(value)\n if value == @defaults['deviceId']\n @values.delete 'deviceId' if @values.key? 'deviceId'\n else\n @values['deviceId'] = value\n end\n end",
"def register_device_for_user(user, device_token, device_name, model, system_version, app_version, app_bundle_version, locale, development)\n device = Device.first(:device_token => device_token)\n if device.nil?\n # Create new device if it does not already exist\n device = Device.new\n user.devices.push(device)\n end\n \n # Update information\n device.device_token = device_token\n device.device_name = device_name\n device.model = model\n device.system_version = system_version\n device.app_version = app_version\n device.app_bundle_version = app_bundle_version\n device.locale = locale\n device.development = development\n \n device.save!\n end",
"def update_config\n @user_config = UserConfig.find(params[:id])\n respond_to do |format|\n if @user_config.update(user_config_params)\n format.html { redirect_to users_path, :flash => {:success => 'Timer setting was successfully updated.' }}\n format.json { head :no_content }\n else\n format.html { render user: 'setting' }\n format.json { render json: @user_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @agsa_client_instance_id = args[:agsa_client_instance_id] if args.key?(:agsa_client_instance_id)\n @allo_device_id = args[:allo_device_id] if args.key?(:allo_device_id)\n @canonical_device_id = args[:canonical_device_id] if args.key?(:canonical_device_id)\n @cast_device_id = args[:cast_device_id] if args.key?(:cast_device_id)\n @client_instance_id = args[:client_instance_id] if args.key?(:client_instance_id)\n @connected_dock_id = args[:connected_dock_id] if args.key?(:connected_dock_id)\n @device_config = args[:device_config] if args.key?(:device_config)\n @device_type = args[:device_type] if args.key?(:device_type)\n @home_graph_device_id = args[:home_graph_device_id] if args.key?(:home_graph_device_id)\n @libassistant_device_id = args[:libassistant_device_id] if args.key?(:libassistant_device_id)\n @multi_hotword_arbitration_device_id = args[:multi_hotword_arbitration_device_id] if args.key?(:multi_hotword_arbitration_device_id)\n @opa_ios_device_id = args[:opa_ios_device_id] if args.key?(:opa_ios_device_id)\n @quartz_device_id = args[:quartz_device_id] if args.key?(:quartz_device_id)\n end",
"def update!(**args)\n @agsa_client_instance_id = args[:agsa_client_instance_id] if args.key?(:agsa_client_instance_id)\n @allo_device_id = args[:allo_device_id] if args.key?(:allo_device_id)\n @canonical_device_id = args[:canonical_device_id] if args.key?(:canonical_device_id)\n @cast_device_id = args[:cast_device_id] if args.key?(:cast_device_id)\n @client_instance_id = args[:client_instance_id] if args.key?(:client_instance_id)\n @connected_dock_id = args[:connected_dock_id] if args.key?(:connected_dock_id)\n @device_config = args[:device_config] if args.key?(:device_config)\n @device_type = args[:device_type] if args.key?(:device_type)\n @home_graph_device_id = args[:home_graph_device_id] if args.key?(:home_graph_device_id)\n @libassistant_device_id = args[:libassistant_device_id] if args.key?(:libassistant_device_id)\n @multi_hotword_arbitration_device_id = args[:multi_hotword_arbitration_device_id] if args.key?(:multi_hotword_arbitration_device_id)\n @opa_ios_device_id = args[:opa_ios_device_id] if args.key?(:opa_ios_device_id)\n @quartz_device_id = args[:quartz_device_id] if args.key?(:quartz_device_id)\n end",
"def update\n respond_to do |format|\n if @gpu_conf.update(gpu_conf_params)\n format.html { redirect_to @gpu_conf, notice: 'Gpu conf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gpu_conf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_device\n @device = current_user.devices.find(params[:id])\n end",
"def put_config config = { 'room' => [ { 'name' => 'default-room', 'device' => [ 'light' => { 'name' => 'default-device' } ] } ] }\n File.open( self.get_config_file, 'w' ) do | handle |\n handle.write YAML.dump( config )\n end\n self.get_config_file\n end",
"def update\n if @device.update(device_params)\n respond_with(@device, location: devices_url, notice: 'Device was successfully updated.')\n else\n respond_with(@devices)\n end\n end",
"def register_device\n user = User.find(params[:user_id])\n\n user.devices.find_or_create_by(token: params[:token], os: params[:os])\n\n head :ok\n end",
"def putDeviceInfo(info)\r\n params = {\r\n :software_version => info.swVersion,\r\n :serial_number => info.serialNb\r\n }\r\n res = apiPut(\"devices/#{info.deviceId}\", params)\r\n if res.status != 200\r\n $LOG.warn(\"Failed to put device info to backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end",
"def register\n puts \"register\"\n ApiBase.client.put(\"/device/#{self.id}\", self.to_json)\n end",
"def update\n @install_tracking_device_user = InstallTracking::DeviceUser.find(params[:id])\n\n respond_to do |format|\n if @install_tracking_device_user.update_attributes(params[:install_tracking_device_user])\n format.html { redirect_to @install_tracking_device_user, notice: 'Device user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @install_tracking_device_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app_config.update(app_config_params)\n format.html { redirect_to @app_config, notice: 'App config was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_config }\n else\n format.html { render :edit }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_params\n params.require(:user).permit(:device_id, :device_token, :device_type, :nickname, :profile_picture)\n end",
"def update\n puts @device.inspect\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :index, status: :ok, location: @device }\n else\n format.html { render :index }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_device\n @device = current_user.devices.where(id:params[:id]).first\n end",
"def set_userconfig\n @userconfig = Userconfig.find(params[:id])\n end",
"def update\n if @user.tconfig.update_attributes(params[:tconfig])\n @status = \"good\"\n @message = \"Settings updated\"\n @resource = @user.tconfig\n elsif !@user.tconfig.valid?\n @message = \"Oops! Please make sure all fields are valid!\"\n end\n\n serve_json_response\n end",
"def hm_device options\n id = options[:id] || 1\n {\n id: id,\n device_type: options[:device_type] || 'Mobile',\n operating_system_name: options[:os] || 'android',\n operating_system_version: options[:os_version] || '1.2.3',\n serial: \"serial#{id}\",\n model: options[:model] || 'Test Model',\n brand: options[:brand] || 'Test Brand',\n }\nend",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @gateway_id = args[:gateway_id] if args.key?(:gateway_id)\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @gateway_id = args[:gateway_id] if args.key?(:gateway_id)\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @gateway_id = args[:gateway_id] if args.key?(:gateway_id)\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n @gateway_id = args[:gateway_id] if args.key?(:gateway_id)\n end",
"def update\n if @device.user == current_user or current_user.is_admin?\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @device }\n else\n format.html { render action: 'edit' }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to devices_url, :notice => 'Access denied! You can update your device only'\n end\n end",
"def device_params\n params.require(:device).permit!\n end",
"def update!(**args)\n @device_action_capability = args[:device_action_capability] if args.key?(:device_action_capability)\n @project_configs = args[:project_configs] if args.key?(:project_configs)\n end",
"def device_params\n params.permit(:macaddress, :nickname, :description, :user_id, :stolen, :secret_key, :format)\n end",
"def device_params\n params.require(:device).permit(:device_id)\n end",
"def mobile_app_configurations=(value)\n @mobile_app_configurations = value\n end",
"def update\n respond_to do |format|\n if @admin_device.update(admin_device_params)\n format.html { redirect_to @admin_device, notice: 'Admin device was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_device }\n else\n format.html { render :edit }\n format.json { render json: @admin_device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # Note that user, device, and user_device are implicit in auth,\n # but only user matches the id arg; an existing device must confirm a new device.\n return if params_missing([:id, :device_confirmation_token], params)\n user_device = UserDevice.find_by_id(params[:id])\n return render_error_modelname(404, :MISSING_RECORD, UserDevice) if !user_device\n\n return render_error(422, :WRONG_ACCOUNT_PARAM, \"id\") if user_device.user.account != @current_account\n # Must NOT confirm from new device!\n return render_error(422, :WRONG_DEVICE, \"id\") if params[:id] == @current_user_device.id.to_s\n # Don't check token until all of above pass. I think.\n return render_error(422, :WRONG_PARAM, \"device_confirmation_token\") if (params[:device_confirmation_token] != user_device.confirmation_token)\n\n if !user_device.decommissioned_at.nil?\n return render_error(409, :DECOMMISSIONED)\n end\n\n if user_device.confirmed_at.nil?\n user_device.confirmed_at = DateTime.now\n return check_save_failure(user_device) if !user_device.save\n end\n \n render_success\n end",
"def kernel_config_params\n params.require(:kernel_config).permit(:user_id, :config_url)\n end",
"def create\n # No permite registrar nada si el usuario ya creo su configuración\n @userconfig = current_user.build_userconfig(userconfig_params) unless current_user.userconfig\n\n respond_to do |format|\n if !@userconfig.nil? and @userconfig.save\n format.html { redirect_to taskstorages_path, notice: \"Userconfig was successfully created.\" }\n format.json { render :show, status: :created, location: taskstorages_path }\n else\n @userconfig = Userconfig.new\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: taskstorages_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @device = args[:device] if args.key?(:device)\n end",
"def set_device\n @device = Device.find(params[:device_id])\n end",
"def device_properties(id, params={})\n put(\"/devices/#{id}/properties\", params)\n end",
"def add_device(device_id)\n @client.put(\"#{ path }/devices/#{ device_id }\")\n end",
"def set_device\n @device = ::Pushar::Core::Device.includes(:app).find(params[:id])\n end",
"def update!(**args)\n @device_id = args[:device_id] if args.key?(:device_id)\n end",
"def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to devices_path, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @device = @user.devices.new(device_params)\n\n respond_to do |format|\n if @device.save\n format.html { redirect_to user_devices_path(@user), notice: 'Device was successfully added.' }\n format.json { render :show, status: :created, location: @device }\n else\n format.html { render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event_configurations.update(event_configuration_params)\n render json: @event_configurations.to_json, status: :ok\n else\n render json: @event_configurations.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.tconfig.update_attributes(settings_params)\n @status = \"good\"\n @message = \"Settings updated\"\n @resource = @user.tconfig\n elsif !@user.tconfig.valid?\n @message = \"Oops! Please make sure all fields are valid!\"\n end\n\n serve_json_response\n end",
"def update_asset_device_configuration_with_http_info(moid, asset_device_configuration, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AssetApi.update_asset_device_configuration ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling AssetApi.update_asset_device_configuration\"\n end\n # verify the required parameter 'asset_device_configuration' is set\n if @api_client.config.client_side_validation && asset_device_configuration.nil?\n fail ArgumentError, \"Missing the required parameter 'asset_device_configuration' when calling AssetApi.update_asset_device_configuration\"\n end\n # resource path\n local_var_path = '/api/v1/asset/DeviceConfigurations/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(asset_device_configuration)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AssetDeviceConfiguration'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AssetApi.update_asset_device_configuration\",\n :header_params => 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: AssetApi#update_asset_device_configuration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def device_params\n params.require(:device).permit(:installation_id, :push_token)\n end",
"def create\n\n # Save last known user's geo location\n if !params[:geo_lat].nil? && !params[:geo_lon].nil?\n @current_user.geo_lat = params[:geo_lat]\n @current_user.geo_lon = params[:geo_lon]\n if !params[:timezone].nil?\n @current_user.timezone = params[:timezone]\n end\n @current_user.save\n end\n\n @api_v1_device = Api::V1::Device.where('token = ? AND user_id = ? ', params[:token], @current_user.id).first\n\n if @api_v1_device.nil?\n @api_v1_device = Api::V1::Device.new(api_v1_device_params) \n @api_v1_device.user_id = @current_user.id \n \n if !@api_v1_device.save\n render json: @api_v1_device.errors, status: :unprocessable_entity\n else\n head :no_content\n end\n else\n head :no_content\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @api_configuration.update(api_configuration_params)\n\t\t\t\tformat.html { redirect_to api_configurations_path, notice: 'Api configuration was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @api_configuration }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @api_configuration.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update!(**args)\n @carrier_call_device_settings = args[:carrier_call_device_settings] if args.key?(:carrier_call_device_settings)\n @duo_call_device_settings = args[:duo_call_device_settings] if args.key?(:duo_call_device_settings)\n end",
"def device_params\n params.require(:device).permit(:name, :beacon_id, :device_type)\n end",
"def update\n @app_config = AppConfig.find(params[:id])\n\n respond_to do |format|\n if @app_config.update_attributes(params[:app_config])\n format.html { redirect_to @app_config, notice: 'App config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end",
"def set_device\n @device = Device.find(params[:id])\n end"
] | [
"0.65472317",
"0.65472317",
"0.64532495",
"0.62633395",
"0.62229526",
"0.616681",
"0.6139146",
"0.61142075",
"0.60482115",
"0.6007381",
"0.5962633",
"0.59482735",
"0.5906064",
"0.5891318",
"0.5853674",
"0.5834662",
"0.58281314",
"0.58265907",
"0.5818131",
"0.57997096",
"0.57981455",
"0.5691719",
"0.5688421",
"0.5679503",
"0.5654747",
"0.5653796",
"0.563653",
"0.56267893",
"0.5615392",
"0.5607278",
"0.5604928",
"0.55893755",
"0.5579104",
"0.557419",
"0.557419",
"0.5573575",
"0.5533366",
"0.5529012",
"0.55213666",
"0.551864",
"0.5507822",
"0.55013144",
"0.54981977",
"0.54934394",
"0.54880756",
"0.54879165",
"0.5487543",
"0.5467019",
"0.5466827",
"0.54546314",
"0.54496956",
"0.54496956",
"0.54496956",
"0.54496956",
"0.5447938",
"0.54431105",
"0.54410726",
"0.542474",
"0.54155016",
"0.5414287",
"0.540288",
"0.5400491",
"0.5397745",
"0.5394375",
"0.5386495",
"0.53772396",
"0.5369057",
"0.5365893",
"0.5365739",
"0.53654516",
"0.5347761",
"0.5345415",
"0.533961",
"0.53294486",
"0.5322786",
"0.53116375",
"0.5308",
"0.5305056",
"0.5303541",
"0.5300353",
"0.5294883",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5292308",
"0.5289368",
"0.5289368",
"0.5289368"
] | 0.70914483 | 0 |
DELETE /user_device_configurations/1 DELETE /user_device_configurations/1.json | def destroy
@user_device_configuration = UserDeviceConfiguration.find(params[:id])
@user_device_configuration.destroy
respond_to do |format|
format.html { redirect_to user_device_configurations_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @device.user_id = nil\n @device.save\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @graphium_configuration.destroy\n respond_to do |format|\n format.html { redirect_to graphium_configurations_url, notice: 'Configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_configuration = MyConfiguration.find(params[:id])\n @my_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to my_configurations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gpu_conf.destroy\n respond_to do |format|\n format.html { redirect_to gpu_confs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @userconfig.destroy\n respond_to do |format|\n format.html { redirect_to userconfigs_url, notice: \"Userconfig was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_user_device_info.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_user_device_infos_url, notice: 'User device info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n conf.delete 'api'\n end",
"def destroy\n# @device.destroy\n# respond_to do |format|\n# format.html { redirect_to devices_url, notice: 'Device was successfully destroyed.' }\n# format.json { head :no_content }\n# end\n# end\n\n# private\n# # Use callbacks to share common setup or constraints between actions.\n# def set_device\n# @device = Device.find(params[:id])\n# end\n\n# # Never trust parameters from the scary internet, only allow the white list through.\n# def device_params\n# params.require(:device).permit(:user_agent, :endpoint, :p256dh, :auth, :user_id)\n end",
"def destroy\n @configuration_key.destroy\n respond_to do |format|\n format.html { redirect_to configuration_keys_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete_launch_configuration(resource_options)\n nil\n end",
"def destroy\n @system_configuration = SystemConfiguration.find(params[:id])\n @system_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to system_configurations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @app_config = AppConfig.find(params[:id])\n @app_config.destroy\n\n respond_to do |format|\n format.html { redirect_to app_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @devis_configuration.destroy\n respond_to do |format|\n format.html { redirect_to devis_configurations_url, notice: 'Devis configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device_user = DeviceUser.find(params[:id])\n @device_user.destroy\n\n respond_to do |format|\n format.html { redirect_to device_users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @app_config.destroy\n respond_to do |format|\n format.html { redirect_to app_configs_url, notice: 'App config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @global_config = AppConfig.find(params[:id])\n @global_config.destroy\n\n respond_to do |format|\n format.html { redirect_to global_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @system_config.destroy\n respond_to do |format|\n format.html { redirect_to system_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dns_device_assoc = DnsDeviceAssoc.find(params[:id])\n @dns_device_assoc.destroy\n\n respond_to do |format|\n format.html { redirect_to dns_device_assocs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @configuration.destroy\n respond_to do |format|\n format.html { redirect_to configurations_url, notice: 'Configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_configuration_identifier.destroy\n respond_to do |format|\n format.html { redirect_to admin_configuration_identifiers_url, notice: 'Configuration identifier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mydevice = Mydevice.find(params[:id])\n @mydevice.destroy\n\n respond_to do |format|\n format.html { redirect_to mydevices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @install_tracking_device_user = InstallTracking::DeviceUser.find(params[:id])\n @install_tracking_device_user.destroy\n\n respond_to do |format|\n format.html { redirect_to install_tracking_device_users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @configuration_file.destroy\n respond_to do |format|\n format.html { redirect_to configuration_files_url, notice: 'Configuration file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_config.destroy\n respond_to do |format|\n format.html { redirect_to api_configs_url, notice: 'Api config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device.destroy\n respond_to do |format|\n format.html { redirect_to user_devices_url, notice: 'Device was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cdg_configuration.destroy\n respond_to do |format|\n format.html { redirect_to cdg_configurations_url, notice: 'Cdg configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device.User = nil\n @device.Register = nil\n @device.save\n respond_to do |format|\n format.html { redirect_to devices_path, notice: 'Device was successfully unlinked.' }\n format.json { head :no_content }\n end\n end",
"def remove_device(device_id)\n @client.delete(\"#{ path }/devices/#{ device_id }\")\n end",
"def destroy\n conf.delete 'dashboard'\n end",
"def destroy\n @device.destroy\n head :no_content\n end",
"def destroy\n @system_config = SystemConfig.find(params[:id])\n @system_config.destroy\n\n respond_to do |format|\n format.html { redirect_to system_configs_url }\n format.json { head :ok }\n end\n end",
"def delete_device(id)\n delete(\"/devices/#{id}\")\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @sims_instrument_configuration = SimsInstrumentConfiguration.find(params[:id])\n @sims_instrument_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to sims_instrument_configurations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @configuration_detail.destroy\n respond_to do |format|\n format.html { redirect_to configuration_details_url, notice: 'Configuration detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @conf = Conf.find(params[:id])\n @conf.destroy\n\n respond_to do |format|\n format.html { redirect_to confs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device.destroy\n\n respond_to do |format|\n format.html { redirect_to devices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @configuration.destroy\n\n respond_to do |format|\n flash[:notice] = 'Configuration deleted.'\n format.html { redirect_to(configurations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @device = Device.find(params[:id])\n @device.destroy\n\n respond_to do |format|\n format.html { redirect_to devices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device = Device.find(params[:id])\n @device.destroy\n\n respond_to do |format|\n format.html { redirect_to devices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device = Device.find(params[:id])\n @device.destroy\n\n respond_to do |format|\n format.html { redirect_to devices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device = Device.find(params[:id])\n @device.destroy\n\n respond_to do |format|\n format.html { redirect_to devices_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @device.destroy\n respond_to do |format|\n format.html { redirect_to devices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @configuration = current_host.configuration_parameters.find(params[:id])\n @configuration.destroy\n\n respond_to do |format|\n flash[:notice] = 'hostConfiguration was successfully deleted.'\n format.html { redirect_to host_url(current_host) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @scf_configuration.destroy\n respond_to do |format|\n format.html { redirect_to scf_configurations_url, notice: 'Scf configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @config.destroy\n respond_to do |format|\n format.html { redirect_to configs_url, notice: \"Config was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete(udid)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'udid', udid)\n\t\t\tclient.queue_service_action_call('configurationgroupdevice', 'delete', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def destroy\n @sm_backend_config = SmBackendConfig.find(params[:id])\n @sm_backend_config.destroy\n\n respond_to do |format|\n format.html { redirect_to sm_backend_configs_url }\n format.json { head :no_content }\n end\n end",
"def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend",
"def destroy\r\n @device = Device.find(params[:id])\r\n @device.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to devices_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @configuration_set = ConfigurationSet.find(params[:id])\n @configuration_set.destroy\n\n respond_to do |format|\n format.html { redirect_to configuration_sets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @version = Version.find(params[:id])\n @versionconfig = @version.version_configurations.destroy_all\n @version.destroy\n\n respond_to do |format|\n format.html { redirect_to [@application, @version] }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n\tif signed_in?\n\t\t@current_client = current_user.username\n\t\tif current_user.username == 'admin'\n\t\t\t@clientconfig = Clientconfig.find(params[:id])\n\t\t\t@clientconfig.destroy\n\t\telse\n\t\t\tredirect_to home_path\n\t\tend\n\telse\n\t\tredirect_to signin_path\n\tend\n\n respond_to do |format|\n format.html { redirect_to clientconfigs_url }\n format.json { head :no_content }\n end\n end",
"def delete_configuration\n super\n end",
"def delete_configuration\n super\n end",
"def destroy\n if @device.user == current_user or current_user.is_admin?\n @device.destroy\n respond_to do |format|\n format.html { redirect_to devices_url }\n format.json { head :no_content }\n end\n else\n redirect_to devices_url, :notice => 'Access denied! You can delete your device only'\n end\n end",
"def destroy\n @ddconfig.destroy\n end",
"def destroy\n @project_configuration.destroy\n respond_to do |format|\n format.html { redirect_to project_configurations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @app_config = AppConfig.find(params[:id])\n @app_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(app_configs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @kernel_config.destroy\n respond_to do |format|\n format.html { redirect_to kernel_configs_url, notice: \"Kernel config was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doc_type_am_configuration = DocTypeAmConfiguration.find(params[:id])\n @doc_type_am_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to doc_type_am_configurations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @wp_dyna_config = WpDynaConfig.find(params[:id])\n @wp_dyna_config.destroy\n\n respond_to do |format|\n format.html { redirect_to wp_dyna_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @config_file = ConfigFile.find(params[:id])\n @config_file.destroy\n\n respond_to do |format|\n format.html { redirect_to config_files_url }\n format.json { head :no_content }\n end\n end",
"def delete_uptime_check_config config_name\n require \"google/cloud/monitoring\"\n\n client = Google::Cloud::Monitoring.uptime_check_service\n client.delete_uptime_check_config name: config_name\n puts \"Deleted #{config_name}\"\nend",
"def user_management_delete_user id\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"id\" => id,\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.delete query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 404\n raise APIException.new \"Not found\", 404, response.raw_body\n elsif response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @conf.destroy\n respond_to do |format|\n format.html { redirect_to confs_url, notice: 'Conf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @conf.destroy\n respond_to do |format|\n format.html { redirect_to confs_url, notice: 'Conf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @machine_config.destroy\n respond_to do |format|\n format.html { redirect_to machine_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @config_element.destroy\n respond_to do |format|\n format.html { redirect_to config_elements_url, notice: 'Config element was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kf_global_config = Kf::GlobalConfig.find(params[:id])\n @kf_global_config.destroy\n\n respond_to do |format|\n format.html { redirect_to kf_global_configs_url({:page => params[:page]}) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @docker_cfg.destroy\n respond_to do |format|\n format.html { redirect_to docker_cfgs_url, notice: 'Docker cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notify_config = NotifyConfig.find(params[:id])\n @notify_config.destroy\n\n respond_to do |format|\n format.html { redirect_to notify_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device.destroy\n respond_to do |format|\n format.html { redirect_to devices_url, notice: 'Device was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cfg.destroy\n respond_to do |format|\n format.html { redirect_to cfgs_url, notice: 'Cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n @client.make_request(:delete, @client.concat_user_path(\"#{DOMAIN_PATH}/#{domain_id}/endpoints/#{id}\"))[0]\n end",
"def destroy\n @configtable = Configtable.find(params[:id])\n @configtable.destroy\n\n respond_to do |format|\n format.html { redirect_to configtables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_configuration.destroy\n respond_to do |format|\n format.html { redirect_to section_configurations_url, notice: 'Section configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device_status.destroy\n respond_to do |format|\n format.html { redirect_to admin_device_statuses_url, notice: 'Device Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @creative_configuration.destroy\n respond_to do |format|\n format.html { redirect_to creative_configurations_url, notice: 'Creative configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @a_serverconfiguration.destroy\n respond_to do |format|\n format.html { redirect_to a_serverconfigurations_url, notice: 'A serverconfiguration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n appctrl_delete( 'User' )\n end",
"def destroy\n @jenkins_app_config.destroy\n respond_to do |format|\n format.html { redirect_to jenkins_app_configs_url, notice: 'Jenkins app config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\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 @site_config = SiteConfig.find(params[:id])\n @site_config.destroy\n\n respond_to do |format|\n format.html { redirect_to site_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_configurations.destroy\n head :no_content\n end",
"def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end",
"def destroy\n @wx_config.destroy\n respond_to do |format|\n format.html { redirect_to wx_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @car_configuration = CarConfiguration.find(params[:id])\n @car_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to car_configurations_url }\n format.json { head :no_content }\n end\n end",
"def delete(key)\n configuration.delete(key)\n end",
"def destroy\n @configattribincl.destroy\n respond_to do |format|\n format.html { redirect_to configattribs_path, notice: 'Configattribincl Threshold is reset to default.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_configuration.destroy\n respond_to do |format|\n format.html { redirect_to product_configurations_url, notice: 'Product configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @configuracion.destroy\n respond_to do |format|\n format.html { redirect_to configuraciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device.destroy\n respond_to do |format|\n format.html { redirect_to devices_url, notice: 'Device was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device.destroy\n respond_to do |format|\n format.html { redirect_to devices_url, notice: 'Device was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device.destroy\n respond_to do |format|\n format.html { redirect_to devices_url, notice: 'Device was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device.destroy\n respond_to do |format|\n format.html { redirect_to devices_url, notice: 'Device was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.6859505",
"0.6803306",
"0.66347903",
"0.66031045",
"0.6595982",
"0.6521107",
"0.64514136",
"0.64363354",
"0.63970107",
"0.6394089",
"0.63729304",
"0.6359964",
"0.63501835",
"0.63125575",
"0.62923324",
"0.6290117",
"0.62786174",
"0.6268358",
"0.6236461",
"0.62357044",
"0.6208357",
"0.62009096",
"0.61933523",
"0.6165937",
"0.61451846",
"0.61199015",
"0.6112057",
"0.6106732",
"0.61032426",
"0.61002463",
"0.61001",
"0.6086347",
"0.60804546",
"0.6079855",
"0.6069908",
"0.6067558",
"0.6048073",
"0.6047393",
"0.60436416",
"0.6039653",
"0.6039653",
"0.6039653",
"0.6030999",
"0.60290223",
"0.6023852",
"0.60133874",
"0.6007092",
"0.6002377",
"0.5995142",
"0.59926385",
"0.5987078",
"0.59859186",
"0.59716773",
"0.5958155",
"0.5955065",
"0.5955065",
"0.5953043",
"0.59447014",
"0.5944077",
"0.593366",
"0.5927979",
"0.5923829",
"0.5919772",
"0.59162146",
"0.59096223",
"0.590902",
"0.59023416",
"0.5892853",
"0.5892853",
"0.58901143",
"0.5886958",
"0.5882289",
"0.5878336",
"0.58741295",
"0.58739215",
"0.5866004",
"0.58481383",
"0.5839821",
"0.5838719",
"0.5831843",
"0.5820705",
"0.5814633",
"0.5812599",
"0.5806735",
"0.5805217",
"0.58042914",
"0.5795967",
"0.5785541",
"0.57773805",
"0.57745725",
"0.57666767",
"0.576555",
"0.5763632",
"0.5759247",
"0.57573754",
"0.57481086",
"0.574637",
"0.574637",
"0.574637",
"0.574637"
] | 0.7800072 | 0 |
optimized using a flag | def bubble_sort(items) # assume 10 items
n = items.size
iterations = 0
loops = 0
loop do
swapped = false
for a in (1..(n - 1)) do # 1 to (number of items - 1)
if items[a] < items[a - 1]
tmp = items[a - 1]
items[a - 1] = items[a]
items[a] = tmp
swapped = true
end
iterations += 1 # debug: loop counter
end
n -= 1 # optimization, halfs the time by doing one less inner loop for each addtinal outer loop
loops += 1 # debug: loop counter
break unless swapped
end
p "Total iterations: #{iterations}"
p "loops: #{loops}"
items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flag; end",
"def optimize_every=(_arg0); end",
"def optimize_every; end",
"def optimize(_optimized, _layer)\n raise 'TODO'\n end",
"def switch_flag\n\t\t@flag = !@flag\n\tend",
"def gp_flags=(_arg0); end",
"def flag _args\n \"flag _args;\" \n end",
"def optimize(**options)\n optimized = self.deep_dup\n #optimized.lexical = nil if optimized.respond_to?(:lexical=)\n #optimized\n end",
"def test_will_return_via_tail_call\n src =<<-EOC\ndefn g() {9}\ndefn f(x) {\n zero?(:x) && return %g\n %g + 9\n}\nEOC\n vi = mkvi src+\"\\nf(0)\\n\";ti = mkti src+\"\\nf(0)\\n\"\n assert (vi.run == 9) && (ti.run == 9), \"Expected both optimized and non_optiized to return9, but one of them did not\"\n end",
"def optimize\n if @raw_code.nil? || @raw_code.length == 0\n abort(\"Bad code.\")\n end\n \n #bf commands that can be optimized\n opt_comms = ['<', '>', '+', '-']\n \n #special command for the bf nil operator. '[-]' will always zero out the value\n #at the pointer, so shortcut it\n @raw_code = @raw_code.gsub(/\\[-\\]/, '=')\n \n #probably a more ruby-esque way to do this... find all optimizable commands\n #and find how many times they appear in order (sequential commands)\n i = 0\n while i < @raw_code.length do\n c, t = @raw_code[i, 1], @raw_code[i + 1, 1]\n j = 0\n \n if !(opt_comms.index(c).nil?) && t == c\n while t == c do\n j += 1\n i += 1\n t = @raw_code[i, 1]\n end\n i -= 1\n else\n j += 1\n end\n \n @opt_code.push(c).push(j)\n \n i += 1\n end\n \n stop = false\n i, j, l = 0, 0, 0\n \n #optimize bf loops, find the corresponding ']' to '[', so we can immediately\n #jump to that point instead of constantly having to look it up during run-time\n while i < @opt_code.length do\n l = i\n case @opt_code[i]\n when '['\n stop, j = false, 0\n while !(stop) do\n i += 2\n case @opt_code[i]\n when ']'\n stop = (j == 0)\n j -= 1\n when '['\n j + 1\n end\n end\n \n @opt_code[l + 1], @opt_code[i + 1] = i, l\n end\n \n i += 1\n end\n \n #puts @opt_code\n end",
"def flag(*names)\n names = [names].flatten\n verify_unused(names,flags,switches,\"in global options\")\n flag = Flag.new(names,@@next_desc,@@next_arg_name,@@next_default_value,@@next_long_desc)\n flags[flag.name] = flag\n clear_nexts\n end",
"def flags; end",
"def optimize\n left\n end",
"def optimize\n left\n end",
"def optimize\n left\n end",
"def optimize\n right\n end",
"def optimize\n right\n end",
"def optimize\n wrap_operand\n end",
"def optimize\n operand\n end",
"def optimize\n operand\n end",
"def ready_optimizing?\n state == :READY_OPTIMIZING\n end",
"def optimizable?\n super || !predicate.equal?(operation.predicate)\n end",
"def optimize(**options)\n self.dup\n end",
"def conditionally(*) end",
"def conditionally(*) end",
"def optimize\n wrap_operand(operand)\n end",
"def optimize\n wrap_operand(operand)\n end",
"def optimize\n left\n end",
"def optimize\n left\n end",
"def optimize\n right\n end",
"def optimize\n right\n end",
"def warmup(prc = T.unsafe(nil), &block); end",
"def condition_zflag(result)\n if result == 0\n @zero_flag = 1\n else\n @zero_flag = 0\n end\n end",
"def flag\n @flagged != @flagged = true unless @revealed\n end",
"def gp_flags; end",
"def fast_mode(v)\n return if $fast_mode == v\n if !v\n ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements.switch_exec_query :orig\n $fast_mode = false\n else\n ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements.switch_exec_query :new\n $fast_mode = true\n end\nend",
"def local_spares\n {:flag => flag} \n end",
"def flag(*names)\n names = [names].flatten\n GLI.verify_unused(names,flags,switches,\"in command #{name}\")\n flag = Flag.new(names,@next_desc,@next_arg_name,@next_default_value,@next_long_desc)\n flags[flag.name] = flag\n clear_nexts\n end",
"def generate_comprehensive\n\n end",
"def optimize\n case @type\n when :booleanop\n @children.each do |c|\n if c.type == :booleanop && c.value == @value\n c.children.each { |cc| @children << cc }\n @children.delete c\n end\n end\n end\n @children.each(&:optimize)\n self\n end",
"def flag index=nil\n index ||= @cursor\n @flags[index] = !@flags[index]\n display\n end",
"def optimize(**options)\n if operand(0).is_a?(Variable) && operand(0).bound? && operand(0).eql?(operand(1))\n RDF::Literal::TRUE\n else\n super # @see Operator#optimize!\n end\n end",
"def minimize; end",
"def optimizable?\n super || extensions_optimizable?\n end",
"def folly_flags()\n return NewArchitectureHelper.folly_compiler_flags\nend",
"def optimize=(value)\n set_attr(:optimize, value ? 2 : 1)\n @optimize = value\n end",
"def flag()\n\tb=[0,0.2,0.6]\n\ty=[0.8,0.8,0.2]\n\tr=[1,0,0]\n\t\n\t[[b,b,y,y,r,r],\n\t[b,b,y,y,r,r],\n\t[b,b,y,y,r,r],\n\t[b,b,y,y,r,r],\n\t[b,b,y,y,r,r]]\nend",
"def deferred? ; false ; end",
"def benchmark!\n @benchmark = true\n end",
"def log(msg, flag = false)\r\n puts msg if flag\r\nend",
"def flags \n @flags ||= {}\n end",
"def processing_instruction?; end",
"def processing_instruction?; end",
"def optimize!\n rsp = post(\"<optimize/>\")\n success?(rsp.body) or log_error(rsp.body)\n end",
"def debug_request(flag='on', *_)\n case flag.downcase\n when \"off\", \"false\", \"0\", \"nil\"\n @debug = false\n else\n @debug = true\n end\n end",
"def optimize(**options)\n self.deep_dup\n end",
"def flags_resync\n if @flags\n self.class.flag_def.each do |f|\n sym = (f.flag_type=='Symbol' ? f.flag_name.to_sym : f.flag_name)\n i,p,v = self.class.index_position_value(f.position)\n sn=self.send(\"flags_#{i}\")||0\n b = sn & v > 0\n logger.warn \"#{@flags[sym].class} value '#{@flags[sym]}' for flag #{self.class}->#{sym} will be stored as true, not '#{@flags[sym]}'\" unless FlaggableTypes.include?(@flags[sym].class)\n if @flags[sym] && !b\n self.send(\"flags_#{i}=\",sn+v)\n elsif b && !@flags[sym]\n self.send(\"flags_#{i}=\",sn-v)\n end\n end\n end\n @flags\n end",
"def bench_filters\n skip 'TODO'\n end",
"def optimize(_src, _dst, options = {})\n fail NotImplementedError, \"implement method optimize in #{self.class}\"\n end",
"def reassemble_the(args, flag=nil)\n assembled = \"\"\n args.unshift flag if flag\n args.each { |a| assembled += \" #{a}\" }\n assembled.strip!\n end",
"def on_run_flag(node)\n children = node.children.dup\n names = children.shift\n state = children.shift\n Array(names).each do |name|\n if @run_flag_table[name.to_sym].nil?\n @run_flag_table[name.to_sym] = 1\n else\n @run_flag_table[name.to_sym] += 1\n end\n end\n process_all(node.children)\n end",
"def add_compiler_flag(flag)\n if try_cflags(flag)\n $CFLAGS << ' ' << flag\n else\n $stderr.puts(\"WARNING: '#{flag}' not accepted by compiler, skipping it\")\n end\nend",
"def add_compiler_flag(flag)\n if try_cflags(flag)\n $CFLAGS << ' ' << flag\n else\n $stderr.puts(\"WARNING: '#{flag}' not accepted by compiler, skipping it\")\n end\nend",
"def value?\n return !self.flag?\n end",
"def gotof(bool, jump) #method\n if !get_value(bool)\n @quad_number = jump - 1\n end\n end",
"def optimize_workflow\n end",
"def exercise_1111 (bool_values)\n end",
"def BIT(address:)\n tmp = @accumulator & @ram[address]\n tmp.zero? ? set_flag(SR_ZERO) : clear_flag(SR_ZERO)\n (tmp & SR_NEGATIVE).zero? ? clear_flag(SR_NEGATIVE) : set_flag(SR_NEGATIVE)\n (tmp & SR_OVERFLOW).zero? ? clear_flag(SR_OVERFLOW) : set_flag(SR_OVERFLOW)\n end",
"def call_nz_a16\n # branch if Z flag is reset\n if (@f & Z_FLAG) == 0x00\n new_pc = $mmu.read_word @pc\n @pc += 2\n push_onto_stack @pc\n @pc = new_pc\n @branched = true\n else\n @pc += 2\n end\n end",
"def true(_argvs)\n return nil\n end",
"def used_invert\n\t\tif @used\n\t\t\t@used = false\n\t\telse\n\t\t\t@used = true\n\t\tend\n\tend",
"def gated_by_set?(flag, node)\n (flag == node.to_a[0] && node.to_a[1]) ||\n (node.to_a.size == 3 && node.to_a.last.type == :run_flag && gated_by_set?(flag, node.to_a.last))\n end",
"def reset_flags\n @flags = { :zero => false , :plus => false ,\n :minus => false , :overflow => false }\n end",
"def skip_pin?\n skip = false\n if @skip_flag == true\n @skip_flag = false\n skip = true\n end\n skip\n end",
"def get_value(flag)\n\t\tfp = @flag_pairs.get_value(flag)\n\t\tif !@no_vals.include?(flag)\n\t\t\tif @args.has_key?(flag)\n\t\t\t\treturn @args[flag]\n\t\t\telsif @args.has_key?(fp) && fp != nil\n\t\t\t\treturn @args[fp]\n\t\t\telse\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend",
"def _reduce_52(val, _values, result)\n\t @options_stack << result = { val[1] => false, val[2] => false, val[3] => false }\n\t \n result\nend",
"def unflag\n @flagged != @flagged = false\n end",
"def scf\n @f &= Z_FLAG\n @f |= C_FLAG\n @clock += 1\n end",
"def enabled=(_arg0); end",
"def enabled=(_arg0); end",
"def enabled=(_arg0); end",
"def enabled=(_arg0); end",
"def enabled=(_arg0); end",
"def setFlag(flg)\r\n if (flg.class == Array)\r\n flg.each do |f|\r\n case f\r\n when '-v'\r\n @verbose = true\r\n end\r\n end # flg.each\r\n\r\n return\r\n end # if flg\r\n\r\n case flg\r\n when '-v'\r\n @verbose = true\r\n end\r\n\r\n end",
"def incremental?(override = T.unsafe(nil)); end",
"def slow\n a, b = 1,2\nend",
"def bonus(i, boolean=false)\n return 0 unless boolean\n i / 2\nend",
"def flag!\n @flagged = values.keys\n end",
"def optimize\n operand.drop(offset)\n end",
"def pop_flag!(forced)\n agent_instance.pop_trace_execution_flag if forced\n end",
"def max_fast_inline(num_of_requests); end",
"def test_value\n assert_equal 4095, @flag.value\n assert_equal 0, @flag_zero.value\n end",
"def flag(name,aliases,desc,long_desc,default_value,arg_name,must_match,type)\n abstract!\n end",
"def _with_version_flag(flag)\n instance_variable_set(\"@#{flag}\", true)\n yield\n ensure\n remove_instance_variable(\"@#{flag}\")\n end",
"def verification_flags=(_arg0); end",
"def toggle_value flag\n x = @toggles[flag] = !@toggles[flag]\n if instance_variable_defined? \"@#{flag}\"\n instance_variable_set \"@#{flag}\", x\n @log.debug \"instance_variable_set #{flag}, #{x}\"\n end\n message \"#{flag} is set to #{x}\"\nend",
"def jit(pointer, pmodes)\n args = get_parameters(pointer, pmodes)\n return args[1] unless args[0].zero?\n\n pointer + 3\n end",
"def flag\n return @flag\n end",
"def benchmark\nend",
"def on_if_flag(node)\n children = node.children.dup\n names = children.shift\n state = node.type == :if_flag\n Array(names).each do |name|\n if @run_flag_table[name.to_sym].nil?\n @run_flag_table[name.to_sym] = 1\n else\n @run_flag_table[name.to_sym] += 1\n end\n end\n process_all(node.children)\n end",
"def faster_cont_sum(arr)\n # debugger\n sum = arr[0]\n bool = true\n run_tot = arr[0]\n arr[1..-1].each do |e|\n if bool == false && e > sum\n sum = e\n bool = true\n run_tot = e\n elsif bool == true && e + sum > sum\n sum += e\n run_tot += e\n elsif bool == true && e > sum\n sum = e\n else \n bool = false\n run_tot += e\n end \n end \n sum >= run_tot ? sum : run_tot\nend"
] | [
"0.6576738",
"0.654601",
"0.6461099",
"0.58961284",
"0.5814387",
"0.5799709",
"0.5784561",
"0.5738412",
"0.5699105",
"0.5663129",
"0.5621774",
"0.5608972",
"0.5556748",
"0.5556748",
"0.5556748",
"0.5528855",
"0.5528855",
"0.5520852",
"0.5513031",
"0.5513003",
"0.5452477",
"0.5411013",
"0.5394435",
"0.5387419",
"0.5387419",
"0.5373475",
"0.5373475",
"0.5359225",
"0.5359225",
"0.53397405",
"0.53397405",
"0.53378254",
"0.531299",
"0.5311504",
"0.5274734",
"0.52680594",
"0.52325577",
"0.5221012",
"0.5212463",
"0.5210928",
"0.520778",
"0.520601",
"0.52010274",
"0.5197391",
"0.51910603",
"0.51762927",
"0.51670897",
"0.5121678",
"0.5108015",
"0.5103755",
"0.5078133",
"0.50780004",
"0.50780004",
"0.50744295",
"0.50738674",
"0.50501066",
"0.5047454",
"0.5047404",
"0.5047402",
"0.5031761",
"0.50266284",
"0.5026089",
"0.5026089",
"0.5023269",
"0.5019331",
"0.5012837",
"0.50000536",
"0.499025",
"0.4988587",
"0.49743026",
"0.49723208",
"0.49700487",
"0.49677008",
"0.49661556",
"0.49462554",
"0.49458465",
"0.4945485",
"0.49380085",
"0.49309283",
"0.49309283",
"0.49309283",
"0.49309283",
"0.49309283",
"0.49182606",
"0.49159548",
"0.49158773",
"0.49142843",
"0.49141523",
"0.49115193",
"0.490696",
"0.49068442",
"0.49030828",
"0.4901883",
"0.4894101",
"0.48927292",
"0.4892589",
"0.48895952",
"0.48895478",
"0.4888366",
"0.48876557",
"0.48846704"
] | 0.0 | -1 |
always 45 iterations on 10 items without swapped flag | def bubble_sort_2(items)
n = items.size
iterations = 0
for a in (0...n) do # same as (0...n).each do |a| ..... end
swapped = false
for b in (0...(n - a - 1)) do
if items[b] > items[b + 1]
tmp = items[b + 1]
items[b + 1] = items[b]
items[b] = tmp
swapped = true
end
iterations += 1
end
break unless swapped
end
p "Total iterations: #{iterations}"
items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end",
"def bubble_sort(items) # assume 10 items\n n = items.size\n iterations = 0\n loops = 0\n loop do\n swapped = false\n for a in (1..(n - 1)) do # 1 to (number of items - 1)\n if items[a] < items[a - 1] \n tmp = items[a - 1]\n items[a - 1] = items[a]\n items[a] = tmp\n swapped = true\n end\n iterations += 1 # debug: loop counter\n end\n n -= 1 # optimization, halfs the time by doing one less inner loop for each addtinal outer loop\n loops += 1 # debug: loop counter\n break unless swapped\n end\n p \"Total iterations: #{iterations}\"\n p \"loops: #{loops}\"\n items\nend",
"def bubble_sort_by(array)\n\tfinal_list = array.clone\n\titerations = (array.length - 1) ** 2\n\ti = 0\n\n\titerations.times do |x|\n\n swap = yield(final_list[i], final_list[i+1])\n \tif swap == -1\n \t\tif i >= array.length - 2\n \t\t i = 0\n \t\telse\n \t\t\ti += 1\n \t end\n \telsif swap == 1\n \t\tfinal_list[i], final_list[i+1] = final_list[i+1], final_list[i]\n \t\t\tif i >= array.length - 2\n \t\t \ti = 0\n \t\t\telse\n \t\t\t\ti += 1\n \t\t\tend\n \telse\n \t if i >= array.length - 2\n \t\t i = 0\n \t\telse\n \t\t\ti += 1\n \t\tend\n \tend\n end\n puts final_list\nend",
"def bubble_sort_by items\n\tn = items.length\n\tswaped = true\n\twhile swaped do\n\t\tswaped = false\n for i in (1..n-1)\n \tif yield(items[i], items[i-1])\n \t\titems = swap items, i-1, i\n \t\tswaped = true\n \tend # end if\n end# end for\n n-=1\n end #end until\n items\nend",
"def swap_pass\n self.to_enum.with_index.each do |elt, index|\n best_swap_index = index\n best_interval_length = self.interval_length\n self.to_enum.with_index.each do |swapper, swapdex|\n # Test the array out with the current element ``elt`` and ``swapper`` switched\n self[index] = swapper\n self[swapdex] = elt\n interval_length = self.interval_length\n\n if interval_length < best_interval_length\n best_interval_length = interval_length\n best_swap_index = swapdex\n end\n\n # change the array back to how it originally was\n self[index] = elt\n self[swapdex] = swapper\n end\n # Having tested every element, we know where to place ``elt`` to minimize the interval\n self[index] = self[best_swap_index]\n self[best_swap_index] = elt\n end\n end",
"def swapper_map(index)\n array = (0..9).to_a\n 10.times.collect.with_index do |i|\n array.rotate!(index + i ^ spin).pop\n end\n end",
"def swapper_map(index)\n array = (0..9).to_a\n 10.times.collect.with_index do |i|\n array.rotate!(index + i ^ spin).pop\n end\n end",
"def bubble_sort_by(array)\n swap_status = nil\n iterations = 0\n\n until swap_status == false\n swap_status = false\n working_array = array[0..((array.count - 1) - iterations)]\n working_array.each_with_index do |item, index|\n if item != working_array.last\n if yield(array[index], array[index + 1]) < 0\n array[index], array[index + 1] = array[index + 1], array[index]\n swap_status = true\n end\n end\n end\n iterations += 1\n end\n array\nend",
"def bubble_sort_by(array)\n swapped = true\n while swapped\n swapped = false\n (array.length - 1).times do |i|\n next unless yield(array[i], array[i + 1])\n\n tmp = array[i]\n array[i] = array[i + 1]\n array[i + 1] = tmp\n swapped = true\n end\n end\n array\nend",
"def flip_switcher(n)\n switch_bank = []\n n.times { switch_bank << false }\n switches_on = []\n counter = 1\n\n loop do\n break if counter > switch_bank.length\n\n switch_bank.each_with_index do | switch, position |\n switch_bank[position] = !switch if (position + 1) % counter == 0\n end\n counter += 1\n end\n # Not quite rigth because I want to push the index not the actual object\n switch_bank.each.with_index do |switch, idx|\n switches_on << idx + 1 if switch == true\n end\n switches_on\nend",
"def bubble_sort_by(arr)\n\tloop do\n\t\tswitched = false\n\t\t(arr.count-1).times do |i|\n\t\t\tif yield(arr[i],arr[i+1])<0\n\t\t\t\tarr[i],arr[i+1]=arr[i+1], arr[i]\n\t\t\tend\n\t\tend\n\t\tbreak if not switched\n\tend\n\tarr\nend",
"def method(x)\r\n swapped = true\r\n while swapped == true\r\n swapped = false\r\n (x.length-1).times do |i|\r\n if x[i] > x[i+1]\r\n x[i], x[i+1] = x [i+1], x[i]\r\n swapped = true\r\n end\r\n end \r\n end \r\n x \r\nend",
"def test_e2125_insertion_sort_no_swap\n \t# puts \"*** Executing insertion_sort_without_exchanges_e2125_test ***\"\n check_sort_correctness :e2125_insertion_sort_no_swap\n\n elements = (0..200).to_a\n shuffled_b = elements.shuffle\n shuffled_a = elements.shuffle\n \n faster = lambda { @target.e2125_insertion_sort_no_swap shuffled_a }\n slower = lambda { standard_insertion_sort shuffled_b } \n\n assert_faster_proc faster, slower\n end",
"def bubble_sort_by(arr)\n n = arr.length\n (n-1).times do\n switched = false\n (n-1).times do |i|\n if yield( arr[i], arr[i+1] ) > 0\n arr[i], arr[i+1] = arr[i+1], arr[i]\n switched = true\n end\n end\n break unless switched\n n -= 1 \n end\n return arr\n\nend",
"def bubble_sort_by(array)\n\nsorted = false\ncheck_it = array.length - 1 \n\tuntil sorted\n\t\tinorder = true \n\t\tcheck_it.times do |i|\n\t\t\ty = yield(array[i], array[i+1])\n\t\t\tif y == 1 #<=> returns that a > b\n\t\t\t\tarray[i], array[i+1] = array[i+1], array[i] \n\t\t\t\n\t\t\t\tinorder = false \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\n\t\t\tend\n\t\t\n\t\t\tputs array.inspect\t\n\t\t\tend \n\t \t\t\n\t \t\tcheck_it -= 1 \n\t\t\tputs \"end of yield runthrough\" #just to check\n\n\t\t\tif check_it == 0\t\t\t\n\t\t\t\tsorted = true \n\t\t\telsif inorder == true \n\t\t\t\tsorted = true\t\t\n\t\t\n\t\t\tend\n\t\t\n \tend\nend",
"def bubble_sort_by(arr)\n swap = true\n while swap\n swap = false\n (arr.length - 1).times do |i|\n next if yield(arr[i], arr[i + 1]) <= 0\n\n temp = arr[i + 1]\n arr[i + 1] = arr[i]\n arr[i] = temp\n swap = true\n end\n end\n arr\nend",
"def sort3(collection)\n # p \"sort 3\"\n # p collection\n collection[1..-1].each_with_index do |el, i|\n k = i + 1\n # p \"*********** i is: #{i} ************\"\n while collection[k] < collection[k-1]\n # p \"k is: #{k}\"\n # p \"swapping #{collection[k]} with #{collection[k-1]}\"\n collection[k], collection[k-1] = collection[k-1], collection[k]\n # p collection\n # p \"subtracting 1 from k\"\n k -= 1\n break if k == 0\n end\n end\n collection\nend",
"def sort2(collection)\n # p \"sort 2\"\n # p collection\n collection[1..-1].each_with_index do |el, i|\n k = i + 1\n # p \"******/***** i is: #{i} ************\"\n until collection[k] > collection[k-1] or k == 0\n # p \"k is: #{k}\"\n # p \"swapping #{collection[k]} with #{collection[k-1]}\"\n collection[k], collection[k-1] = collection[k-1], collection[k]\n # p collection\n # p \"subtracting 1 from k\"\n k -= 1\n end\n end\n collection\nend",
"def bubble_sort_by(array)\n k = 0\n loop do\n i = 0\n swap = false\n while i < array.size.-(k+1)\n if (yield array[i], array[i+1]) > 0\n array.insert(i, array.delete_at(i+1))\n swap = true\n end\n i += 1\n end\n k += 1\n break if swap == false\n end\n p array\nend",
"def bubble_sort_by(ary)\n #copied from upstairs at bubble_sort\n n = ary.length - 1\n while n > 0 do\n index = 0\n\n n.times do\n first = ary[index] #first = left\n second = ary[index+1] # second = right practically\n\n if yield(first, second) > 0 #ONLY LINE THAT IS CHANGED\n ary[index+1] = first\n ary[index] = second\n end\n\n index += 1\n end\n n -= 1\n end\n print ary\nend",
"def moveZeroes(nums)\n slow = fast = 0\n while fast<nums.size do\n if not nums[slow]==0 then\n slow += 1\n elsif nums[fast]!=0 then\n nums[slow] ^= nums[fast]\n nums[fast] ^= nums[slow]\n nums[slow] ^= nums[fast]\n slow += 1\n end\n fast += 1\n end\n nums\nend",
"def run_bf(items)\n\n counts = Hash.new{|h,k| h[k] = 0}\n\n items.each {|item| counts[item] += 1 }\n \n dd = items.length / 10\n \n results = []\n counts.each {|item, count|\n results << item if count > dd\n }\n \n return results\n end",
"def bubble_sort_by(arr)\n loop do\n swapped = false; index = 0\n while index < arr.length - 1\n first = arr[index]; second = arr[index + 1]; swap = yield(first, second)\n (swap_var = arr[index]; arr[index] = arr[index + 1];\n arr[index + 1] = swap_var; swapped = true) if swap.positive?; index += 1\n end\n break if swapped == false\n end\n arr\nend",
"def bubble_sort(arr)\n n = arr.length\n #ln 7, array length is my set of four numbers\n\n loop do\n #[2, 42, 22, 02]\n #[42, 2, 22, 02]\n #[42, 22, 2, 02]\n #[42, 22, 02, 2]\n\n swapped = false\n\n (n-1).times do |i|\n if arr[i] > arr [i + 1]\n arr [i], arr[i +1] = arr [i +1], arr[i]\n swapped = true\n end\n end\n\n #ln18 iterator variable is i, i +1 is the next number beside it \n #ln 19 is the rule to swap, we do this by equalling the values to the opposite one, that is how we swap \n #when accessing something within an element it needs an index\n\n break if not swapped \n #break will break us out of the loop but only if swapped is not true\n end\n\n arr\n\nend",
"def bubble_sort_by(array)\n switch = true\n while switch\n switch = false\n (0...array.length - 1).each do |i|\n if yield(array[i], array[i + 1]).positive? \n array[i], array[i + 1] = array[i + 1], array[i]\n switch = true\n end\n end\n end\n array\nend",
"def bubble_sort_by(arr)\n swapped = true\n while swapped\n swapped = false\n for i in 0..arr.length-2\n y = yield(arr[i],arr[i + 1])\n if y == 1\n arr[i], arr[i + 1] = arr[i + 1], arr[i]\n swapped = true\n end\n end\n end\n return arr\nend",
"def bubble_sort_by(arr)\n loop do\n swapped = false\n (0...arr.length - 1).each do |j|\n result = yield(arr[j], arr[j + 1])\n if result.positive?\n arr[j], arr[j + 1] = arr[j + 1], arr[j]\n swapped = true\n end\n end\n break unless swapped\n end\n arr\nend",
"def bubble_sort_by_concept_two(array)\n no_swaps = false # initiate flag to indicate when there are no more swaps being done\n\n until no_swaps\n no_swaps = true\n (0..array.length - 2).each do |i|\n # check if these two elements are out of order\n compare_result = yield array[i], array[i + 1]\n\n next unless compare_result.positive?\n\n # do a swap\n store = array[i]\n array[i] = array[i + 1]\n array[i + 1] = store\n no_swaps = false\n end\n end\n\n array\nend",
"def bubble_sort_by array\n\ti=0\n\tarray.length.times do\n\t\twhile i<array.length-1\t\t\n\t\t\tarray[i],array[i+1]=array[i+1],array[i] if yield(array[i],array[i+1])>0\n\t\t\ti+=1\n\t\tend\n\t\ti=0\n\tend\n\tarray\nend",
"def optimize_moves(orig)\n # Put counts of each item into a hash.\n m = Hash.new(0)\n orig.each {|e| m[e] += 1}\n\n # Now, apply optimizations.\n curr_count = sum_values(m)\n prev_count = -1\n while curr_count != prev_count\n annihilate(m, :R, :L)\n annihilate(m, :r, :l)\n # :r * ROT_STEPS --> :R\n if m[:r] >= ROT_STEPS\n\tm[:r] -= ROT_STEPS\n\tm[:R] += 1\n end\n # :l * ? --> :L\n if m[:l] >= ROT_STEPS\n\tm[:l] -= ROT_STEPS\n\tm[:L] += 1\n end\n # [:r, :r, :r, :r] --> [:R, :l, :l]\n if m[:r] > ROT_STEPS/2\n\tm[:r] -= (ROT_STEPS/2 + 1)\n\tm[:R] += 1\n\tm[:l] += (ROT_STEPS/2 - 1)\n end\n # [:l, :l, :l, :l] --> [:L, :r, :r]\n if m[:l] > ROT_STEPS/2\n\tm[:l] -= (ROT_STEPS/2 + 1)\n\tm[:L] += 1\n\tm[:r] += (ROT_STEPS/2 - 1)\n end\n # \n # 12 big revolves is the identity\n if m[:L] >= 12\n\tm[:L] -= 12\n end\n if m[:R] >= 12\n\tm[:R] -= 12\n end\n # \n # 7 big revolves is 5 of the opposite.\n if m[:L] >= 7\n\tm[:L] -= 7\n\tm[:R] += 5\n end\n if m[:R] >= 7\n\tm[:R] -= 7\n\tm[:L] += 5\n end\n prev_count = curr_count\n curr_count = sum_values(m)\n end\n # Sort so that translations come after the rotations.\n trans_arr = []\n rot_arr = []\n m.each_key {|k|\n if BIG_R.include?(k) || LITTLE_R.include?(k)\n\tm[k].times {|i| rot_arr << k}\n else\n\tm[k].times {|i| trans_arr << k}\n end\n }\n\n rot_arr + trans_arr\n end",
"def bubble_sort_by(array)\n arr = array.length - 1\n loop do\n swap = false\n (0...arr).each do |i|\n n_one = array[i]\n n_two = array[i + 1]\n if yield(n_one, n_two).positive?\n array[i], array[i + 1] = array[i + 1], array[i]\n swap = true\n end\n end\n break if swap == false\n end\n array\nend",
"def b_sort(array)\n v = array.length\n loop do\n swap = false\n (v-1).times do |i|\n if array[i] > array[i + 1]\n array[i], array[i + 1] = array[i + 1], array[i]\n swap = true\n end\n end\n break if not swap\n end\n p array\nend",
"def bubble_sort_by(array)\n (array.length - 1).times do |i|\n \tif yield(array[i], array[i + 1]) < 0\n \t array[i], array[i + 1] = array[i + 1], array[i]\n \tend\n end\n print array\nend",
"def bubble_sort_by(array)\n #loop until everything is swapped by length (sorted)\n loop do\n swapped = false\n\n (array.length - 1).times do |i|\n #assign to a variable the parameter implicitly returned by the block\n value = yield array[i], array[i+1]\n #check the value from the block and swap if needed (so set swap to true)\n if (value == 1)\n array[i], array[i+1] = array[i+1], array[i]\n swapped = true\n end\n end\n\n #if nothing is swapped (so the array is sorted), the method will never\n #enter the IF and the swapped variable would be false and will BREAK\n #if swapped is true it just jump the break and go back to the loop\n break if !swapped\n end\n\n #print inspect and return the array\n puts array.inspect\n return array\nend",
"def hufflepuff(list)\nend",
"def swap; end",
"def bubble_sort!(a)\n n = a.size - 1\n n.times { n.times { |i| a[i], a[i + 1] = a[i + 1], a[i] if a[i] > a[i + 1] } }\nend",
"def bubble_sort(input_array)\n \n nb_swaps = 1000\n \n # the loop will be exited when number of swaps = 0 \n until (nb_swaps == 0) do \n res = bubble_sort_pass(input_array)\n nb_swaps = res[\"nb_swaps\"]\n end \n \n return(res[\"result_array\"])\n \nend",
"def bubble_sort(array)\n outer_loop_guard = 1\n (array.size - 1).times do\n inner_loop_guard = 0\n while inner_loop_guard < array.size - outer_loop_guard\n if yield(array[inner_loop_guard], array[inner_loop_guard + 1])\n array[inner_loop_guard], array[inner_loop_guard + 1] = array[inner_loop_guard + 1], array[inner_loop_guard]\n end\n inner_loop_guard += 1\n end\n outer_loop_guard += 1\n end\n array\nend",
"def bubble_sort_by ary\n (ary.length-2).downto(0) do |k|\n swapped = false\n for i in 0..k\n if (yield ary[i], ary[i+1]) > 0\n ary[i], ary[i+1] = ary[i+1], ary[i]\n swapped = true\n end\n end\n break if !swapped\n end\n ary\nend",
"def sort(array)\n array.each_index do |i|\n (array.length - i - 1).times do |job|\n if array[cownt] > list[cownt + 1]\n array[cownt], array[cownt + 1] = array[cownt + 1], array[cownt]\n end\n end\n end\nend",
"def skip_tracks_18(i)\r\n\t t = (s = @playlist.size) - (h = i % s)\r\n\t s = @playlist.size-1\r\n\t @playlist[0, t], @playlist[t..s] = @playlist[h..s], @playlist[0, h]\r\n\t \r\n puts \"New Playlist:\"\r\n\t @playlist.each {|a| puts a}\r\n\tend",
"def bubble_sort_by(greetings)\n len = greetings.length\n flag = 1\n while flag == 1\n flag = 0\n (0..len - 2).each do |i|\n next unless yield(greetings[i + 1], greetings[i]).negative?\n\n temp = greetings[i]\n greetings[i] = greetings[i + 1]\n greetings[i + 1] = temp\n flag = 1\n end\n end\n greetings\nend",
"def bubble_sort(list)\n\tloop do \n\t\tswapped = false\n\t\t(list.size-1).times do |i|\t\t\t\n\t\t\tif list[i] > list[i+1]\n\t\t\t\tlist[i], list[i+1] = list[i+1], list[i]\n\t\t\t\tswapped = true\t\t\t\t\n\t\t\tend\t\t\t\n\t\tend\n\t\tbreak unless swapped\n\tend \n\tlist \nend",
"def bubble_sort!(arr)\n comparisons = arr.length - 1\n iteration_count = 0 # this will allow for tail-end optimization\n\n loop do \n swap_count = 0\n\n comparisons.times do |idx|\n next if (arr.length - (idx + 1)) == iteration_count # tail-sort optimization\n\n if arr[idx] > arr[idx + 1]\n arr[idx], arr[idx + 1] = arr[idx + 1], arr[idx]\n swap_count += 1\n end\n end\n\n break if swap_count == 0\n iteration_count += 1\n end\n \n arr\nend",
"def bubble_sort(array_to_be_sorted)\n swapped = true\n counter = 0\n# puts(array_to_be_sorted.inspect)\n while(swapped)\n counter+=1\n swapped = false\n puts \"*****PASS********\"\n array_to_be_sorted.each_with_index do |item, idx|\n counter+=1\n if (idx+1 >= array_to_be_sorted.size)\n break\n end\n puts \"#######SWAP TEST#########\"\n\n compare = array_to_be_sorted[idx]>array_to_be_sorted[idx+1]\n if (compare)\n temp = array_to_be_sorted[idx]\n array_to_be_sorted[idx] = array_to_be_sorted[idx+1]\n array_to_be_sorted[idx+1]=temp\n swapped = true\n end\n puts swapped\n puts(array_to_be_sorted.inspect)\n end\n end\n puts counter\n return array_to_be_sorted\nend",
"def prepare_deck\n (1..104).each do |i|\n v = [1, 2, 3, 5, 7]\n if i == 55\n @deck[i] = v[4]\n elsif (i % 11 == 0.0) && i != 55\n @deck[i] = v[3]\n elsif (i % 10 == 0.0) && i != 55\n @deck[i] = v[2]\n elsif (i % 5 == 0.0) && i != 55\n @deck[i] = v[1]\n else\n @deck[i] = v[0]\n end\n end\n end",
"def bubble_sort_by(array)\n\t#counter\n\titeration = 1\n\t#Loop through all values (array.length-1) times\n\twhile iteration <= array.length-1\n\t\t#Compare 2 adjacent values in array. Values are swapped based on block comparison.\n\t\tarray.each_with_index do |n, i|\n\t\t\tunless array[i+1] == nil #stops comparison of last array value.\n\t\t\t\tif yield(n, array[i+1]) > 0\n\t\t\t\t\tarray[i], array[i+1] = array[i+1], n\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\titeration += 1 # Counter increases after every iteration\n\tend\n\tputs array.inspect\nend",
"def bubbly(arr)\n loop do\n switch = false\n (arr.length - 1).times do |i|\n \tif arr[i] > arr[i + 1]\n arr[i + 1],arr[i] = arr[i],arr[i + 1]\n switch = true\n end\n end\n if switch == false\n break\n end\n end\n arr\nend",
"def prep_sorted_lists\n 10.times do |i|\n list1.add(3*i)\n list2.add(5*i)\n end \n list1.print\n list2.print \n end",
"def shuffle()\n \n end",
"def swim(index)\n end",
"def bubble_sort!(array)\n iterations = 0\n last = 1\n loop do\n swapped = false\n 1.upto(array.size - last) do |index|\n iterations += 1\n next if array[index - 1] <= array[index]\n array[index - 1], array[index] = array[index], array[index - 1]\n swapped = true\n end\n last += 1\n break unless swapped\n end\n puts iterations\nend",
"def swap\n @working_array = @working_array.collect.with_index do |digit, index|\n swapper_map(index)[digit]\n end\n end",
"def swap\n @working_array = @working_array.collect.with_index do |digit, index|\n swapper_map(index)[digit]\n end\n end",
"def run( current, positions, iterations, num_values )\n iterations.times do \n slice_start = current.next\n current.next = current.next.next.next.next\n destination = nil\n backoff = 1\n \n while ! destination \n search_for_label = current.value - backoff\n if search_for_label < 1\n search_for_label += num_values\n end \n destination = positions[search_for_label]\n if destination.value == slice_start.value ||\n destination.value == slice_start.next.value ||\n destination.value == slice_start.next.next.value \n destination = nil\n backoff += 1\n end\n end\n \n after_slice = destination.next\n destination.next = slice_start\n slice_start.next.next.next = after_slice\n current = current.next\n end\nend",
"def bubble_sort_by(array)\n \n i = 0 \n while i < array.length - 1 \n left = array[i]\n right = array[i+1]\n if yield(left,right) > 0\n array[i], array[i+1] = array[i+1], array[i]\n i = -1\n end\n i += 1 \n end\n return array\nend",
"def forward_pass(array, compare)\n swapped = false\n 0.upto(array.length - 2) do |i|\n if compare.call(array[i], array[i + 1]) > 0\n array[i], array[i + 1] = array[i + 1], array[i]\n swapped = true\n end\n end\n [array, swapped]\nend",
"def bubble_sort(arr)\n num_of_pass = arr.length - 1\n loop do\n swapped = false\n\n num_of_pass.times do |i|\n if arr[i] > arr[i+1]\n arr[i], arr[i+1] = arr[i+1], arr[i]\n swapped = true\n end\n # p arr\n end\n\n if swapped == false\n break\n end\n\n end\n arr\nend",
"def recycle\n recycling = true\n while recycling \n while @total_caps >= 4 \n recycle_caps\n end\n while @empty_bottles >= 2 \n recycle_bottles\n end\n if @empty_bottles < 2 && @total_caps < 4 \n recycling = false\n end\n end\nend",
"def block_swap(a,d)\n n=a.length\n if n>0\n \n if d>=n\n d%=n\n end\n \n if d==0\n return a\n end\n\n if d==n-d\n swap(a,0,d,d)\n end\n\n i= d\n j= n-d\n\n while(i!=j)\n if i<j\n swap(a,d-i,d+j-i,i)\n j-=i\n else\n swap(a,d-i,d,j)\n i-=j\n end\n end\n \n swap(a,d-i,d,i)\n end\n \n return a\n \nend",
"def swap(a,start1,start2,d)\n for i in 0...d\n temp = a[start1+i]\n a[start1+i] = a[start2+i]\n a[start2+i] = temp\n end\nend",
"def rotate(nums, k)\n k.times do\n ele = nums.pop\n nums.unshift(ele)\n end\nreturn nums\nend",
"def bubble_sort(array)\n swapped = true\n until swapped == false\n swapped = false\n (array.length-1).times do |index|\n if array[index] > array[index+1]\n array[index], array[index + 1] = array[index + 1], array[index]\n swapped = true\n # else \n # swapped = false\n #Why doesn't this work without line 68???\n end\n end\n end\n array\nend",
"def test2CycleReorderingSamePartition\n executeSimpleTest(\n [ [ 'T1', 'R1', 500, 2, ['T2'], ' =='],\n [ 'T2', 'R2', 600, 2, ['T3'], ' =='],\n [ 'T3', 'R3', 900, 2, [], ' =='],\n [ 'T4', 'R4', 100, 3, ['T2'], '==='],\n [ 'T5', 'R5', 200, 6, ['T3'], '======'],\n [ 'T6', 'R1', 550, 2, ['T7'], '=='],\n [ 'T7', 'R6', 1000, 2, [], ' =='],\n [ 'T8', 'R7', 300, 5, ['T7'], '====='],\n [ 'T9', 'R1', 700, 2, [], ' =='] ] )\n end",
"def shift_elements(index)\n while index < @length - 1\n @cache[index] = @cache[index+1]\n index += 1\n end\n end",
"def bubble_sort!(arr)\n arr.size.times do |iteration|\n arr.each_index do |x|\n break if arr.size-1 == x\n if arr[x] > arr[x+1]\n arr[x], arr[x+1] = arr[x+1], arr[x]\n end\n end\n end\n arr\nend",
"def fast_dance(tile_direction, new_tiles_data_structure)\n new_tiles_data_structure.each do |ele|\n return new_tiles_data_structure.index(ele) if ele == tile_direction\n end\nend",
"def bubble_sort(arr)\n n = arr.length\n\n loop do \n swapped = false\n (n-1).times do |item|\n if arr[item] > arr[item +1]\n arr[item], arr[item+1] = arr[item +1], arr[item]\n swapped = true\n end\n end \n break if swapped == false\n end\n arr \nend",
"def bubble_sort(numbers)\n permutation = nil\n\n while permutation != 0 do # N times\n permutation = 0\n\n numbers.each_with_index do |number, index| # N times\n next if numbers[index + 1].nil?\n\n if number > numbers[index + 1]\n numbers.insert(index + 1, numbers.delete_at(index))\n permutation += 1\n end\n end\n end\n\n numbers\nend",
"def bubble_sort_by(array_to_sort)\n size = array_to_sort.length\n puts \"array to sort: \"\n p array_to_sort\n for i in 0..size-1\n for index in 0..size-2\n left = array_to_sort[index]\n right = array_to_sort[index + 1]\n if yield(left, right) > 0\n temp_item = array_to_sort[index]\n array_to_sort[index] = array_to_sort[index + 1]\n array_to_sort[index + 1] = temp_item\n end\n end\n end\n puts 'sorted using yield block'\n p array_to_sort\nend",
"def swap\n @store[-1], @store[-2] = @store[-2], @store[-1] if size > 1\n end",
"def rellenar_vector\n (1..20).each do |count|\n if count.even?\n puntaje_anterior = @tiros[count - 2]\n num_aleatorio = rand(1..10 - puntaje_anterior)\n @tiros.push(num_aleatorio)\n else\n @tiros.push(rand(10))\n end\n end\n end",
"def bubble_sort (array)\n loop do\n \tswitched = false\n\n \t(array.length - 1).times do |index|\n \t\tif array[index] > array[index + 1]\n \t\t\tarray[index], array[index + 1] = array[index + 1], array[index]\n \t\t\tswitched = true\n \t\tend\n end\n break if not switched\n \n end\n p array\nend",
"def bubble_sort_by(array)\r\n array.length.times do |n|\r\n (0...array.length - n - 1).each do |index|\r\n if yield(array[index], array[index + 1]) < 0\r\n lower = array[index + 1]\r\n array[index + 1] = array[index]\r\n array[index] = lower\r\n end\r\n end\r\n end\r\n puts array\r\nend",
"def sift_down(i, arr)\n min = i\n\n left_id = (2*i) + 1\n if left_id <= arr.size-1\n if arr[left_id][:time] < arr[min][:time]\n min = left_id\n elsif arr[left_id][:time] == arr[min][:time] && arr[left_id][:thread] < arr[min][:thread]\n min = left_id\n end\n end\n\n right_id = (2*i) + 2\n if right_id <= arr.size-1\n if arr[right_id][:time] < arr[min][:time]\n min = right_id\n elsif arr[right_id][:time] == arr[min][:time] && arr[right_id][:thread] < arr[min][:thread]\n min = right_id\n end\n end\n\n if i != min\n arr[i], arr[min] = arr[min], arr[i]\n\n sift_down(min, arr)\n end\nend",
"def bubble_sort_by(input)\r\n sorted = false\r\n last_index = input.length-2\r\n until sorted\r\n swaps = 0\r\n 0.upto(last_index) do |i|\r\n if yield(input[i], input[i+1]) < 0\r\n input[i],input[i+1] = input[i+1],input[i]\r\n swaps += 1\r\n end\r\n end\r\n sorted = true if swaps == 0\r\n last_index -= 1\r\n end\r\n input\r\nend",
"def swap\n us = self.pop(true,false)\n them = self.pop(false,false)\n self.push(us,false,false)\n self.push(them,false,true)\n end",
"def cracklepop3\n (1..100).zip(Array.new 100, nil).map do |i,x|\n [i%3, i%5].map.with_index do |y, j| \n x = x.to_s + ['crackle','pop'][j] if y==0\n end\n x ? x : i\n end\nend",
"def run\n hash_num = grid.get_hash_pos(@data).length\n for k in 0...hash_num-1\n move_down(k)\n move_right(k)\n move_left(k)\n end\n end",
"def bubble_sort_by_concept_one(array)\n n = array.length\n\n while n.positive?\n\n j = 0\n\n (1..n - 1).each do |k|\n compare_result = yield array[j], array[k]\n\n # if array[j] > array[k], swap these two values\n if compare_result.positive?\n store = array[j]\n array[j] = array[k]\n array[k] = store\n end\n j += 1\n end\n n -= 1; # last element is now sorted\n end\n\n array\nend",
"def bubble_sort!(array)\n iterations = array.size - 1\n loop do\n swapped = false\n iterations.times do |idx|\n if array[idx] > array[idx + 1]\n array[idx], array[idx + 1] = array[idx + 1], array[idx]\n swapped = true\n end\n end\n break unless swapped\n iterations -= 1\n end\n array\nend",
"def bubble_sort_by arr\n n = arr.length - 1\n while n > 0\n arr.each_with_index do |item, index|\n yield(arr[index] , arr[index+1]) > 0 ? true : (arr[index+1], arr[index] = arr[index], arr[index+1])\n # To avoid index + 1 being nil when on last iteration (index == n)\n if index + 1 == n\n break\n end\n end\n n -= 1\n end\n puts arr\nend",
"def rotate!(count=1) self.replace(self.rotate(count)) end",
"def bogo_private\n return self if length < 2\n\n shuffled = self\n shuffled = shuffle while shuffled != sort\n end",
"def minimumSwaps(arr)\n arr = arr.map { |n| n - 1 }\n\n i = 0\n counter = 0\n\n while arr[i] != i do\n i += 1 if arr[i] == i\n if arr[i] && arr[i] != i\n arr[arr[i]], arr[i] = arr[i], arr[arr[i]]\n counter += 1\n end\n end\n\n counter\nend",
"def bubble_sort!(array)\n loop do\n same = true\n (array.size - 1).times do |i|\n if array[i] > array[i + 1]\n array[i], array[i + 1] = array[i + 1], array[i]\n same = false\n end\n end\n break if same\n end\nend",
"def scatter\n sum_of_digits = @working_array.inject(:+).to_i\n @working_array = 10.times.collect do \n @working_array.rotate!(spin ^ sum_of_digits).pop\n end\n end",
"def bubble_sort(array)\n n = array.length\n loop do\n swapped = false\n (n-1).times do |i|\n if array[i] > array [i + 1]\n # temp = array[i]\n # array[i], = array[i+1]\n # array[i+1] = temp\n #lines 14-17 are equivalent to line 19 below\n array[i], array[i+1] = array[i+1], array[i]\n swapped = true\n end\n end\n break if not swapped\n end\n array\nend",
"def bubble_time(array)\n n = array.length\n\n loop do\n swapped = false\n\n (n-1).times do |i|\n if array [i] > array [i + 1]\n array[i], array[i+1]=array[i+1], array[i]\n swapped = true\n p array\n end\nend\n\nbreak if not swapped\nend\n\narray\nend",
"def bubble_sort(array)\n begin\n \n swapped = false\n \n array.length.times do |x|\n if x < array.length - 1 && array[x] > array[x+1]\n array[x], array[x+1] = array[x+1], array[x]\n swapped = true\n end\n end\n end while swapped == true\n \n return array\nend",
"def bubbleMod(list)\n sorted_list = list\n # for each element\n for i in 0..(list.size - 1)\n changed = false\n for i2 in 1..(list.size - i - 1)\n # swap each higher adjacent value to the right until you can't\n if sorted_list[i2] < sorted_list[i2 - 1]\n value_transfer = sorted_list[i2]\n sorted_list[i2] = sorted_list[i2 - 1]\n sorted_list[i2 - 1] = value_transfer\n changed = true\n end\n end\n return sorted_list if !changed\n end\n return sorted_list\nend",
"def sort_cards_by_value_bis!()\r\n\t\taucun_echange=false\r\n\t\twhile aucun_echange==false\r\n\t\t\taucun_echange=true\r\n\t\t\tlen=@list.length-2\r\n\t\t\tfor i in 0..len\r\n\t\t\t\tif !@list[i].nil? and !@list[i+1].nil?\r\n\t\t\t\t\tif @list[i].get_value_bis<@list[i+1].get_value_bis\r\n\t\t\t\t\t\ttemp=@list[i]\r\n\t\t\t\t\t\t@list[i]=@list[i+1]\r\n\t\t\t\t\t\t@list[i+1]=temp\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\telsif @list[i].get_value_bis == @list[i+1].get_value_bis\r\n\t\t\t\t\t\t@list.delete_at(i)\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def bubble_sort(array)\n count = array.length\n loop do\n swapped = false\n (count - 1).times do |i|\n if array[i] > array[i+1]\n array[i], array[i+1] = array[i+1], array[i] #reassigns values of numbers in array\n swapped = true\n end\n end\n break unless swapped\n end\nend",
"def test_move\n (0..3).each { |i| @cart.add_item(:active, @item_models[i]) }\n\n @cart.active_items.setSelectionIndexes(index_set([0, 2]))\n move_test_helper([\"1\", \"3\"], [\"0\", \"2\"], {0 => :saved, 1 => :active, 2 => :saved, 3 => :active}) do \n @app.move(:saved, @cart.active_items)\n end\n\n @cart.active_items.setSelectionIndexes(index_set([0]))\n @cart.saved_items.setSelectionIndexes(index_set([]))\n move_test_helper([\"3\"], [\"0\", \"2\", \"1\"], {0 => :saved, 1 => :saved, 2 => :saved, 3 => :active}) do \n # argument is dummy\n @app.move_active_to_saved(nil)\n end\n @cart.active_items.setSelectionIndexes(index_set([]))\n @cart.saved_items.setSelectionIndexes(index_set([1, 2]))\n move_test_helper([\"3\", \"2\", \"1\"], [\"0\"], {0 => :saved, 1 => :active, 2 => :active, 3 => :active}) do \n # argument is dummy\n @app.move_saved_to_active(nil)\n end\n end",
"def sort(sequence)\n\n made_a_swap = true\n swaps = 0\n loops = 0\n\n def swap(counter, sequnce)\n temp = sequnce[counter]\n sequnce[counter] = sequnce[counter + 1]\n sequnce[counter + 1] = temp\n end\n\n\n while made_a_swap do\n counter = 0\n made_a_swap = false\n\n while counter < sequence.length - 1 #&& !made_a_swap\n\n if sequence[counter] > sequence[counter + 1]\n made_a_swap = true\n swaps += 1\n swap(counter, sequence)\n end\n\n\n counter += 1\n end\n\n print \"#{loops} \" if loops % 1000 == 0\n loops += 1\n end\n\nend",
"def bubble_sort!(array)\n loop do\n index = 0\n changes = false\n (array.size - 1 - index).times do\n if array[index] > array[index + 1]\n array[index], array[index + 1] = array[index + 1], array[index]\n changes = true\n end\n index += 1\n end\n break unless changes\n end\n array\nend",
"def sluggish_octopus!(array)\n sorted = false\n until sorted\n sorted = true\n array.each_index do |index|\n index_2 = index + 1\n next if index_2 == array.length\n if array[index].length > array[index_2].length\n array[index],array[index_2] = array[index_2],array[index]\n sorted = false\n end\n end\n end\n array[-1]\nend",
"def bubble_sort(array)\n\tsort_list = array.clone\n\titerations = (array.length - 1) ** 2\n\ti = 0\n\n\titerations.times do |item|\n\n\t\tif sort_list[i] > sort_list[i+1]\n\t\t\tsort_list[i], sort_list[i+1] = sort_list[i+1], sort_list[i]\n if i >= array.length - 2\n i = 0\n else\n\t\t\t i += 1\n\t\t end\n else\n \tif i >= array.length - 2\n \t\ti = 0\n else\n i +=1\n end\n end\n end\n puts sort_list\nend",
"def bubble_sort(array)\n n = array.length \n loop do \n swapped = false\n\n (n-1).times do |index| \n if array[index] > array[index+1]\n array[index], array[index+1] = array[index+1], array[index]\n swapped = true\n end\n end\n\n break if not swapped \n end\np array\nend"
] | [
"0.63773704",
"0.63520086",
"0.6240631",
"0.6206211",
"0.61759394",
"0.6061025",
"0.6061025",
"0.6044446",
"0.5860032",
"0.585789",
"0.5850233",
"0.5808923",
"0.5807631",
"0.5792638",
"0.5783578",
"0.57741535",
"0.5749921",
"0.5685318",
"0.5680298",
"0.56587034",
"0.564353",
"0.5640061",
"0.5639145",
"0.5627093",
"0.562338",
"0.5613226",
"0.5598033",
"0.5591048",
"0.55851",
"0.5573707",
"0.55644745",
"0.55554885",
"0.5550289",
"0.5541297",
"0.55374414",
"0.55219805",
"0.55207574",
"0.55165726",
"0.55141413",
"0.5500171",
"0.54994476",
"0.5493579",
"0.54894614",
"0.5481538",
"0.5459559",
"0.5455503",
"0.5449811",
"0.544238",
"0.5441483",
"0.54359454",
"0.54293233",
"0.54287606",
"0.54275906",
"0.5418567",
"0.5418567",
"0.54129696",
"0.5409346",
"0.5409086",
"0.5407349",
"0.5403877",
"0.5398942",
"0.5380267",
"0.5379373",
"0.5377855",
"0.5376825",
"0.53722614",
"0.53684753",
"0.536588",
"0.53573155",
"0.5354208",
"0.5343993",
"0.5340693",
"0.53396404",
"0.5337449",
"0.53325945",
"0.5326172",
"0.532522",
"0.53207034",
"0.5316118",
"0.53152597",
"0.53147006",
"0.5313146",
"0.530036",
"0.52998316",
"0.52944165",
"0.5292266",
"0.52892715",
"0.5284947",
"0.52841806",
"0.5283825",
"0.5279585",
"0.52770877",
"0.52707666",
"0.526616",
"0.5264348",
"0.52604985",
"0.5258786",
"0.5257058",
"0.5254824",
"0.52517325"
] | 0.6282058 | 2 |
ClothMark will generate a default filename if user don't want to save output to a specific file and will use Markdown as a default markup language. | def initialize(file, markup = "markdown", additional_html = false, output = nil)
@file = file
# ClothMark will raise an error if unknown markup language was sent
if %w(markdown textile bbcode).include? markup
@markup = markup
else
raise ArgumentError, "Unknown markup language (#{markup})"
end
if (!output || output.empty?)
@output = "#{file.gsub(/(\.[a-z]{3,4})/, '')}_clothmark.html"
else
@output = output
end
@data_for_output = []
@additional_html = additional_html # If true, then ClothMark will generate additional CSS and HTML
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename\n \"#{Parchemin::Config.articles_path}/#{@id}.markdown\"\n end",
"def make_me_some_markdown\n\tputs \"write the name of the markdown file\"\n\tfile = gets.chomp.downcase\n\tputs `touch #{file}.md`\nend",
"def default_file_content_for file_name\n \"#{file_name} content\"\nend",
"def markdown\n return if changed_markdown_files.empty?\n\n output = `mdl #{changed_markdown_files.join(' ')}`\n return if output&.empty?\n\n heading('Markdown Linter', output)\n end",
"def extension\n 'md'\n end",
"def generate_readme\n readme_path = File.join(Glitter::Application.config.repo_path, 'readme.md')\n File.write(\n readme_path,\n <<-RUBY.strip_heredoc)\n ## HEAD\n\n * bullet1\n * bullet2\n RUBY\n readme_path\n end",
"def generate_filename(title)\n \"#{formatted_current_timestamp}-#{slug_for(title)}.md\"\nend",
"def erb_path\n \"#{File.dirname(__FILE__)}/markdown_doc.erb\"\n end",
"def defext\n @defext ||= OY::Markup.default_extension.to_sym\n end",
"def file_to_pagename(filename)\n\t\tfilename.chomp(\".md\").gsub('_', ' ').capitalize\n\tend",
"def file_to_pagename(filename)\n\t\tfilename.chomp(\".md\").gsub('_', ' ').capitalize\n\tend",
"def title\n if file =~ /README.md/\n result = File.basename File.dirname(file)\n else\n result = File.basename(file,'.md')\n end\n result.tr '-', ' '\n end",
"def to_markdown\n files = Dir.glob('**/*.html')\n files.each do |f|\n new_f = f.gsub 'html', 'markdown'\n system \"mv #{f} #{new_f}\" if File.file? f\n end\n end",
"def filename\n \"words.txt\" if original_filename\n end",
"def draft_filename(title)\n File.join('_drafts', file_title(title) + '.md')\nend",
"def content!\n if File.exist?(file)\n markdown_to_html\n else\n @type = :empty\n \"\"\n end\n end",
"def what_it_does() \"Generate javadoc to '#{@name}' folder\" end",
"def default_file_name\n ''\n end",
"def not_test_add_marks_to_a_file\r\n TextFormatter.add_para_marks_to_a_file(DIR_OF_NEW+File::SEPARATOR+\r\n \tFILE_7) \r\n end",
"def output_file(type)\n if (type == :html)\n \"#{DirMap.public}#{News.public_path}/#{self.filename}.html\"\n else\n \"#{DirMap.public}#{News.public_path}/#{self.filename}.html\"\n end\n end",
"def default_pdf_file_name\n \"#{self.number}.pdf\" if self.number\n end",
"def _output_filename(file)\n sub_strings = File.basename(file).split('.')\n base_name, extensions = sub_strings.first, sub_strings[1..-1]\n\n if extensions.last == 'haml'\n extensions.pop\n if extensions.empty?\n [base_name, options[:default_ext]].join('.')\n else\n [base_name, extensions].flatten.join('.')\n end\n else\n [base_name, extensions, options[:default_ext]].flatten.compact.join('.')\n end\n end",
"def documentation\n\troot = settings.root + '/doc'\n\tcontent = File.open(\"#{root}/#{@user.default_locale}.textile\", 'r').read()\n\tRedCloth.new(content).to_html\nend",
"def markdown_cheatsheet\n File.read(Rails.root.join('markdown.md'))\n end",
"def filename(title, now)\n File.join('_posts', format('%d-%02d-%02d-%s.md', now.year, now.month, now.day, file_title(title)))\nend",
"def write_studentmarkdown (row)\n timestamp = @worksheet[row, 1]\n student_name = @worksheet[row, 2]\n student_email = @worksheet[row, 3]\n program_name = @worksheet[row, 7]\n year_entering_fellowship = @worksheet[row, 4]\n personal_website = @worksheet[row, 5]\n twitter_handle = @worksheet[row, 6]\n base_name = make_name(name, timestamp)\n\n contents = \"---\nlayout: post\nstatus: publish\npermalink: posts/students/#{base_name}\ntitle: #{name}\nwebsite: #{personal_website}\n---\n# #{name}\n\n #{name_program}\n #{year_entering_fellowship}\n #{personal_website}\n #{twitter_handle}\n\n \"\n\n write_file(base_name, contents)\nend",
"def output_ext(_ext)\n \".html\"\n end",
"def output_ext(_ext)\n \".html\"\n end",
"def simple_markdown(text)\n simple_format markdown text\n end",
"def markdown_title\n render_as_markdown title\n end",
"def sprinkle_markdown_magic(column)\n require 'bluecloth'\n \n validates_markdown_syntax column\n define_method \"#{column}_html\" do\n markup = self.send(column)\n BlueCloth.new(markup).to_html unless markup.blank?\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 render_md(site, readme)\n begin\n mkconverter = site.getConverterImpl(Jekyll::Converters::Markdown)\n readme.gsub! \"```\",\"\\n```\"\n readme.gsub! '```shell','```bash'\n return mkconverter.convert(readme)\n rescue\n return 'Could not convert readme.'\n end\nend",
"def output_ext(ext)\n \".html\"\n end",
"def markdown(text)\n BlueCloth::new(text).to_html\nend",
"def html_markup_markdown(text); end",
"def extension\n return output_extension.downcase.to_s if output_extension.present?\n\n configured_extension = Brainstem::ApiDocs.output_extension.downcase.to_s\n configured_extension == \"markdown\" ? DEFAULT_OAS_EXTENSION : configured_extension\n end",
"def filename(post)\n date = DateTime.parse(post.date)\n rendered_title = post.title.rendered\n slug =\n if rendered_title.empty?\n date.strftime('%s').to_i % (24 * 60 * 60)\n else\n # TODO: Should slugify the first 5 words of the content instead\n rendered_title.downcase.gsub('/[\\s.\\/_]/', ' ').gsub(/[^\\w\\s-]/, '').squeeze(' ').tr(' ', '-').chomp('-')\n end\n\n \"#{date.strftime('%F')}-#{slug}.md\"\n end",
"def markdownify(input); end",
"def create!\n new_file = \"#{next_number}-#{strip_title}.md\"\n @path = File.join(@dir, new_file)\n File.open(@path, 'w') do |file|\n file.write initial_content\n end\n\n new_file\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 rendered_name\n result = filename\n result = caption if !caption.blank?\n result\nend",
"def default_json_filename()\n HiddenMarkovModel::DEFAULT_JSON_FILENAME\n end",
"def file_name(usage)\n if usage.to_s == 'ehtml'\n \"l#{page_layout_root_id}.html.erb\"\n else\n \"l#{page_layout_root_id}.#{usage}\"\n end \n end",
"def replace_readme(&block)\n remove_file 'README.doc'\n remove_file 'README.md'\n\n create_file 'README.md'\n append_file 'README.md', yield\nend",
"def default_output\n name\n end",
"def markdown(text)\n BlueCloth.new(text).to_html\n end",
"def build_mdlinks\n return unless options.Build_Markdown_Links\n\n puts_cyan \"Middlemac is creating `#{options.File_Markdown_Links}`.\"\n\n files_array = []\n out_array = []\n longest_shortcut = 0\n longest_path = 0\n\n Dir.glob(\"#{app.source}/Resources/**/*.erb\").each do |fileName|\n\n # Remove all file extensions and make a shortcut\n base_name = fileName\n while File.extname(base_name) != '' do\n base_name = File.basename( base_name, '.*' )\n end\n next if base_name.start_with?('_') # || base_name == 'index'\n\n if base_name == 'index'\n shortcut = \"[#{File.split(File.split(fileName)[0])[1]}_index]:\"\n\n else\n shortcut = \"[#{base_name}]:\"\n end\n\n # Make a fake absolute path\n path = Pathname.new(fileName).relative_path_from(Pathname.new(app.source))\n path = File::SEPARATOR + File.join(File.dirname(path), base_name) + '.html'\n\n # Get the title, if any\n metadata = YAML.load_file(fileName)\n title = (metadata.is_a?(Hash) && metadata.key?('title')) ? metadata['title'] : ''\n\n files_array << { :shortcut => shortcut, :path => path, :title => title }\n\n longest_shortcut = shortcut.length if shortcut.length > longest_shortcut\n longest_path = path.length if path.length > longest_path\n\n end\n\n files_array = files_array.sort_by { |key| [File.split(key[:path])[0], key[:path]] }\n files_array.uniq.each do |item|\n item[:shortcut] = \"%-#{longest_shortcut}.#{longest_shortcut}s\" % item[:shortcut]\n\n if item[:title].length == 0\n out_array << \"#{item[:shortcut]} #{item[:path]}\"\n else\n item[:path] = \"%-#{longest_path}.#{longest_path}s\" % item[:path]\n out_array << \"#{item[:shortcut]} #{item[:path]} \\\"#{item[:title]}\\\"\"\n end\n end\n\n File.open(options.File_Markdown_Links, 'w') { |f| out_array.each { |line| f.puts(line) } }\n\n end",
"def save! target=\"./Notes\"\n filename = File.join(target, \"#{@title}.txt\")\n\n Faceoff.safe_save(filename) do |file|\n file.write self.to_s\n end\n end",
"def render_auto(text, filename)\n format = detect_format(filename)\n \n if Docify.valid_format?(format)\n Docify::Markup.send(format, text)\n else\n text\n end\n end",
"def use_markdown=(value)\n @use_markdown = value\n if value && !markdown_processor\n %W{rdiscount kramdown maruku bluecloth}.each do |lib|\n begin\n require lib\n break\n rescue LoadError\n end\n end\n end\n value\n end",
"def create_blank_post(path, title, date)\n # Create the directories to this path if needed\n FileUtils.mkpath(File.dirname(path))\n\n # Write the template to the file\n File.open(path, \"w\") do |f|\n f << <<-EOS.gsub(/^ /, '')\n ---\n title: #{title}\n category: Code\n layout: post\n date: #{date}\n ---\n\n EOS\n end\nend",
"def output_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/snippets/nav-list.html.erb\"\n else\n \"#{DirMap.html_views}/snippets/nav-list.html.erb\"\n end\n end",
"def show_readme\n readme 'lib/generators/cms/fortress/templates/README'\n end",
"def gen_filename\n name = @issue[\"created\"].strftime(\"%Y-%m-%d-\") + \n @issue[\"title\"].gsub(/\\W+/, \"_\") +\n \".yaml\"\n n = 1\n while File.exist?(File.join(@dir, name))\n name = File.basename(name, \".yaml\") + \"-\" + n.to_s + \".yaml\"\n n += 1\n end\n\n name\n end",
"def set_default_format\n @default_format=\"pdf\"\n end",
"def draft(draft_name, tags: ['ruby'])\n time = nil\n file_name = Slugify.(draft_name) + '.md'\n\n File.write(DRAFTS_PATH + file_name, FileContent.(draft_name, time, tags))\nend",
"def markdown(text)\n BlueCloth::new(text).to_html\n end",
"def default_file_name\n \"#{klass_name.underscore}_#{id}\"\n end",
"def output_ext; end",
"def output_ext; end",
"def output_ext; end",
"def markdown(text)\n\t\tBlueCloth::new(text).to_html\n\tend",
"def get_filename(pagename)\n\t\tget_permalink(pagename) + \".md\"\n\tend",
"def get_filename(pagename)\n\t\tget_permalink(pagename) + \".md\"\n\tend",
"def markup_file_contents(contents); end",
"def filename\n \"#{model.name.parameterize}.#{file.extension}\" if original_filename.present?\n end",
"def formatting_note\n if markdown?\n %(HTML and\n #{link_to(\"Markdown\",\n \"http://daringfireball.net/projects/markdown/basics\",\n :popup => true)}\n formatting supported)\n else \n \"HTML formatting supported\"\n end\n end",
"def formatting_note\n if markdown?\n %(HTML and\n #{link_to(\"Markdown\",\n \"http://daringfireball.net/projects/markdown/basics\",\n :popup => true)}\n formatting supported)\n else \n \"HTML formatting supported\"\n end\n end",
"def markdown\n @markdown ||= process_markdown!\n end",
"def default_text(default)\n case default\n when Symbol\n I18n.t(default, scope: :default_content_texts)\n else\n default\n end\n end",
"def initialize(id)\n @id = id\n @filename = \"#{Parchemin::Config.statics_path}/#{@id}.markdown\"\n end",
"def doc_to_fs_path(doc_path)\n if doc_path.end_with?(\"/\") || doc_path == \"\"\n \"#{doc_path}README.md\"\n else\n \"#{doc_path}.md\"\n end\n end",
"def titleize str\n if @format == :markdown\n str = str[2..-1]\n str = \"\\n\" + CGI.escapeHTML(str) + \"\\n\" + \"=\" * str.size\n else\n str[1..4] + \"<h2>\" + CGI.escapeHTML(str[5..-1]) + \"</h2>\"\n end\nend",
"def filename\n \"#{original_filename_without_extension.parameterize}_#{model.filename_token}#{original_extension}\" if original_filename\n end",
"def full_filename (for_file = model.source.file)\n super.chomp(File.extname(super)) + '.png'\n end",
"def kss_markdown(input)\n markdown = ::Redcarpet::Markdown.new(::Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)\n markdown.render(input)\n end",
"def frontmatter_defaults; end",
"def init\n File.open(MARKUN_FILE, 'w') { |f|f.puts MARKUN_TEMPLATE }\n end",
"def markdown(text)\n BlueCloth::new(text).to_html.html_safe\n end",
"def markdownjump(input)\n content = \"\"\n paragraph = false\n for line in input.lines\n break if line.strip.length == 0 and paragraph\n content += line\n next if line.strip.length == 0\n next if line.start_with? \"#\"\n next if line.start_with? \"-\"\n paragraph = true\n end\n Tilt['md'].new{content}.render\n end",
"def markdown_extra?\n true\n end",
"def create_blank_post(path, title)\n # Create the directories to this path if needed\n FileUtils.mkpath(File.dirname(path))\n\n # Write the template to the file\n File.open(path, \"w\") do |f|\n f << <<-EOS.gsub(/^ /, '')\n ---\n layout: post\n title: #{title}\n published: false\n ---\n\n EOS\n end\nend",
"def title()\n @markdown_document.title()\n end",
"def filename\n filename = (model.name + '_' + model.artist.name + '_' + model.release.name).downcase.gsub(/\\s/, '-')\n \"#{filename}\" if original_filename \n end",
"def create_blank_post(path, title)\n # Create the directories to this path if needed\n FileUtils.mkpath(File.dirname(path))\n\n # Write the template to the file\n File.open(path, \"w\") do |f|\n f << <<-EOS.gsub(/^ /, '')\n ---\n layout: post\n title: #{title}\n published: false\n categories:\n ---\n\n EOS\n end\nend",
"def markdown_command_html\n if self.markdown_command \n self.markdown_command\n else\n self.markdown_command = MARKDOWN_RENDERER.render(self.command)\n end\n end",
"def texte_aide_markdown\n @texte_aide_markdown ||= begin\n File.read(markdown_file)\n end\n end",
"def to_markdown\n str = <<-EOS\n# #{name} drop\n\n#{info}\n\n#{example.try(:to_markdown)}\n\n## Methods\n#{methods.map(&:to_markdown).join(\"\\n\\n\")}\n\n-----------\n EOS\n\n str.gsub(/<model>/,name.underscore)\n end",
"def output_file(type)\n if (type == :html)\n \"#{DirMap.public}/#{self.filename}.html\"\n else\n \"#{DirMap.public}/#{self.filename}.html\"\n end\n end",
"def export_as_chicago_citation_txt\n get_citation_style(:chicago)&.html_safe || super # TODO:CMOS for non-MARC\n end",
"def preferred_file_format\n ''\n end",
"def render_document(content, extension)\n if %w{md mdown markdown}.include?(extension.downcase)\n render_markdown(content)\n else\n content\n end\n end",
"def output_ext\n end",
"def default_name\n self.name ||= File.basename(data_file.filename, '.*').titleize if data_file.filename && !self.name\n end",
"def default_content; end",
"def filename; end",
"def filename; end",
"def filename; end"
] | [
"0.6529348",
"0.6146489",
"0.6010292",
"0.5887668",
"0.5875801",
"0.582014",
"0.57950526",
"0.57086563",
"0.5665793",
"0.5588449",
"0.5588449",
"0.55547607",
"0.5531979",
"0.5527283",
"0.5523892",
"0.5519306",
"0.55154103",
"0.5507361",
"0.54875225",
"0.5472601",
"0.5448487",
"0.54348296",
"0.5422393",
"0.54109496",
"0.53770566",
"0.5370942",
"0.5362854",
"0.53578764",
"0.5355488",
"0.53552634",
"0.533631",
"0.53213894",
"0.5316539",
"0.530515",
"0.530417",
"0.5299792",
"0.5291464",
"0.5287145",
"0.5285535",
"0.5285308",
"0.52713346",
"0.52293986",
"0.5225349",
"0.5223909",
"0.5210487",
"0.519843",
"0.5196764",
"0.5191808",
"0.5185228",
"0.5175918",
"0.51636726",
"0.5160013",
"0.51598454",
"0.51512355",
"0.51504326",
"0.5143811",
"0.51425874",
"0.5142462",
"0.5133827",
"0.5133229",
"0.51274323",
"0.51274323",
"0.51274323",
"0.51254725",
"0.5122722",
"0.5122722",
"0.51123774",
"0.5109517",
"0.5109199",
"0.5109199",
"0.5103384",
"0.5102063",
"0.5099697",
"0.50986004",
"0.50978696",
"0.5095073",
"0.5087733",
"0.5084911",
"0.50793135",
"0.5078348",
"0.506821",
"0.5067064",
"0.50588",
"0.5058124",
"0.50563383",
"0.50480837",
"0.5042084",
"0.50418013",
"0.5029108",
"0.50251347",
"0.5023179",
"0.5021612",
"0.5018111",
"0.5011341",
"0.50109273",
"0.4992072",
"0.49869138",
"0.49858412",
"0.49858412",
"0.49858412"
] | 0.5479206 | 19 |
Read lines from input file and put them to array | def read_from_file
begin
File.open(@file) do |file|
file.each_line {|line| @data_for_output << line}
end
rescue Errno::ENOENT => e
puts e
exit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_to_array file\n lines = []\n File.open(file, \"r\") do |infile|\n while (line = infile.gets)\n lines.push(line.gsub(\"\\n\", \"\").rstrip)\n end\n end\n lines\n end",
"def load\n arr = []\n begin\n while(!@file.eof?)\n line = @file.readline.chomp\n arr.concat(line.split)\n end\n ensure\n @file.close\n end\n arr\n end",
"def read_input\n ary = []\n File.open('./input.txt', 'r') do |file|\n file.each do |line|\n ary << line.to_s\n end\n end\n\n ary.freeze\nend",
"def read_input_file(input_path)\n all_lines = []\n\n File.open(input_path, \"r:UTF-8\") do |file|\n while (line = file.gets)\n all_lines += [line]\n end\n end\n\n all_lines\nend",
"def q1_read_to_array(data_file_name)\r\n array2d = []\r\n \r\n read_file(\"data/\"+data_file_name).each{ |line|\r\n array1d = line.split(\",\").map(&:strip).map(&:to_s)\r\n array2d << array1d\r\n }\r\n return array2d\r\nend",
"def load_lines file\n\n\t\tlines = Array.new\n\t\tlines = @file.split(\"\\n\")\n\n\t\t#fuck that, i dont like the dyanmic feed, just pre-parse it\n\t\tlines.map! do |line| #map overwrites the old array\n\t\t\tif line.include? '#'\n\t\t\t\tsplit = line.split '#'\n\t\t\t\t#puts split.to_s\n\t\t\t\tsplit.shift\n\t\t\telse\n\t\t\t\tline\n\t\t\tend\n\t\tend\n\n\t\t#removing blank lines\n\t\tlines.delete_if do |line|\n\t\t\ttrue if line.empty?\n\t\tend\n\n\t\tlines.each { |line| line.chomp! }\n\n\t\tlines\n\tend",
"def read_file(fname=nil)\n return if fname.nil?\n # Array we use to store entries\n lines = Array.new\n ah_data = Array.new\n # Deal with DOS line endings by reading in file, then manually splitting on DOS line ending\n File.open(fname).each_line do |line|\n lines = line.split(/\\r\\n?/).map(&:chomp)\n end\n return lines\nend",
"def get_file_array(path)\n array = []\n File.open(path) do |f|\n f.each_line do |line|\n array.push(line)\n end\n end\n return array\nend",
"def read_lines\n lines = Array.new\n line = @file.gets\n tokens = line.scan(/[-+]?\\d*\\.?\\d+/)\n x1 = Integer(tokens[0])\n x2 = Integer(tokens[1])\n \n while not (x1==0 and x2==0)\n l = Line.new(x1,x2)\n lines.push(l)\n line = @file.gets\n tokens = line.scan(/[-+]?\\d*\\.?\\d+/)\n \n x1 = Integer(tokens[0])\n x2 = Integer(tokens[1])\n \n end\n \n return lines\n \n end",
"def import_ori(file_path)\n string = IO.read(file_path)\n array = string.split(\"\\n\")\n array.shift\n return array\n end",
"def input_file(file)\n inputs = []\n t = -1\n i = 0\n f = File.new(file)\n f.each_line do |line|\n if t == -1\n t = line.to_i\n else\n if i < t\n inputs << line\n i += 1\n end\n end\n end\n return inputs\nend",
"def input_file(file)\n inputs = []\n t = -1\n i = 0\n f = File.new(file)\n f.each_line do |line|\n if t == -1\n t = line.to_i\n else\n if i < t\n inputs << line\n i += 1\n end\n end\n end\n return inputs\nend",
"def read_file_to_arr(path)\n ret = []\n File.open(path, \"r\") do |f|\n f.each_line do |line|\n ret << line.split(\" \").map { |s| s.to_i}\n end\n end\n return ret\nend",
"def get_from_file(path)\n\n array = []\n file = File.open(path)\n if file != nil\n array = file.readlines.map(&:chomp) # Discard the final '\\n'\n file.close\n end\n\n return array\n\nend",
"def readList # read the list file and return an array\n array_list = []\n i = 0\n File.open(\"list.txt\").readlines.each do |line|\n array_list[i] = line\n i += 1\n end\n array_list\nend",
"def open_file (file)\r\n \r\n data = Array.new\r\n input = File.new(file, \"r\")\r\n input.gets\r\n while line = input.gets # gets each line of the file\r\n line.chomp! # deletes \\n\r\n data << line\r\n end\r\n input.close\r\n \r\n return data\r\n \r\nend",
"def readlines\n lns = infile.readlines.map(&:strip)\n infile.close unless infile.tty?\n lns\n end",
"def init input\n File.open('1input.txt', 'r').each_line do |line|\n input.push(line.to_i);\n end\nend",
"def analyze_file()\n arrayLinAnaly=[]\n linenum=0\n File.foreach('test.txt') do |line|\n arrayLinAnaly << LineAnalyzer.new(line, linenum)\n linenum+=linenum\n end\n return arrayLinAnaly\n end",
"def readlines(eol=$/)\n ary = []\n ary << line while line = self.gets(eol)\n ary\n end",
"def read_input(file_name)\n file = File.open(file_name)\n input_data = file.read\n lines = 0\n data = []\n input_data.each_line do |line|\n i = Integer(line.chomp!)\n data << i\n end\n puts \"input_data length = #{input_data.length} lines = #{data.length}\"\n data\nend",
"def read_file\n match_file = File.new(\"matches.txt\", \"r\")\n no_of_match = match_file.gets\n if no_of_match != nil\n for i in 0..no_of_match.to_i - 1\n match_result = match_file.gets\n @matchesarr << match_result\n end\n end\n match_file.close\n end",
"def get_file_as_string_array\n file = (\"#{File.dirname(__FILE__)}/../data/seed.txt\")\n string_array = []\n \n File.open(file, 'r') do |f|\n f.each_line do |line|\n string_array << line\n end\n end\n \n string_array\n end",
"def read_loaded_txt_file_to_array(file)\n\ttext_array = file.read.split(\",\")\nend",
"def load_file(path)\n file_array = IO.readlines(path)\n file_array.map {|element| element.chomp}\nend",
"def addToArray(fileInput)\n i = 0\n loc = 0\n file = File.new(fileInput, \"r\")\n while (line = file.gets)\n line = line.gsub(/[[:space:]]+/, '')\n if ((line.slice(0) != \"/\") and (line.empty? != true)) \n @commandArray.insert(loc, line)\n loc += 1\n end\n i += 1\n end\n file.close\n end",
"def file_into_array(array)\r\n integer_unsorted_array = []\r\n\r\n array.each do |line|\r\n integer_unsorted_array << line.strip.to_i\r\n end\r\n\r\n integer_unsorted_array\r\n end",
"def _read filename\n d = []\n File.open(filename).each { |line|\n d << line\n }\n return d\n end",
"def get_multi_line_input_int_arr(original_filename)\n get_input_str_arr(original_filename).map(&:to_i)\nend",
"def read_file pn\n pn.readlines.map(&:chomp)\n .each do |line|\n @entries.add line, pn\n end\n end",
"def read_in\n File.foreach(file_name).map(&:chomp)\n end",
"def get_lines(filename); end",
"def readlines\n return nil unless __advance!\n\n lines = []\n while line = gets()\n lines << line\n end\n\n lines\n end",
"def read_tracks music_file\n\tcount = music_file.gets().to_i\n tracks = Array.new\n track = File.open(\"input.txt\")\n i = 0\n while (i < count)\n track = read_track(music_file)\n tracks << track\n i += 1\n end \ntracks\nend",
"def parse_csv_file(delim, file_name) \n \n temp_array = Array.new #Create an array\n file = File.open(file_name, \"r\") #Open a file for reading\n \n \n #Iterate file, parse strings and store\n file.each_line do |line|\n temp_array.push(parse_line(delim, line))\n end\n\n #Close resource\n file.close\n \n return temp_array\nend",
"def handle_inputs_from_file file_path\n File.open(file_path) do |file|\n file.lazy.each_slice(500) do |input_lines|\n input_lines = input_lines.delete_if { |line| line == \"\\n\" } # There can be empty lines\n iterate_over_lines_and_fetch_domain(input_lines)\n end\n end\n end",
"def file_lines\r\n if File.exist?(@file_name)\r\n file_reader = File.open(@file_name, 'r')\r\n file_reader.each_line do |line|\r\n @lines.push line\r\n end\r\n file_reader.close\r\n @lines\r\n else\r\n raise \"File '#{@file_name}' does not exist\"\r\n end\r\n end",
"def grab_input(input, file = false)\n\tinput = File.read(input) if file\n\tinput.split(\"\\n\").map { |orders| orders.split(',') }\nend",
"def parsed_file\n data.split(\"\\n\").map do |line|\n line.split(' ')\n end\n end",
"def convert_maze_to_array(file)\n @processed_maze = File.readlines(file)\n @processed_maze = @processed_maze.map do |row|\n row.chomp!\n row.split('')\n end\n end",
"def get_data_from_file(file)\r\n f = File.open(file, \"r\")\r\n gene = Array.new\r\n f.each_line do |line|\r\n gene << line.delete(\"\\n\") # We remove end of line \\n \r\n end\r\n return gene\r\nend",
"def parse_to_array(line_as_string)\n as_array = line_as_string.split(\" \")\nend",
"def file_array_parser\n @array_of_parse_files = []\n file_array.each do |file|\n File.open(\"text_files/#{file}\").readlines.each do |line|\n if line.include?(\"\\n\") # removes '\\n' (line breaker)\n @array_of_parse_files << [line.gsub!(/\\n/, '')]\n else\n @array_of_parse_files << [line]\n end \n end\n @array_of_parse_files \n end\n\nend",
"def read_makes\n File.readlines(\"car-makes.txt\").each do |line|\n @makes_arr.push(line.chomp)\n end\n # puts \"@makes_arr : #{@makes_arr}\"\n # return @makes_arr\n\n\n end",
"def readFile(input)\n\t\tmain=[]\n\t\tentryList=[]\n\t\tinputFileObj=File.open(input, \"r\")\n\t\tinputFileObj.readlines.each do |x|\n\t\t\tentryList<<(x)\n\t\tend\n\t\tentryList.each do |x|\n\t\t\tline=Array.new()\n\t\t\tobj=x.split(\" \")\n\t\t\tobj.each do |x|\n\t\t\t\tline<<(x)\n\t\t\t\tif $hashMain[x].nil?\n\t\t\t\t\t$hashMain[x]=1\n\t\t\t\telse\n\t\t\t\t\t$hashMain[x]+=1\n\t\t\t\tend\n\t\t\tend\n\t\t\tmain<<(line)\n\t\tend\n\t\treturn main\n\tend",
"def parse(filename)\n result = []\n File.open(filename,'r') do |file|\n for line in file\n result << line.split(' ').map(&:to_i)\n end\n end\n result\nend",
"def line_maker\n @lines = File.readlines(path, chomp: true)\n end",
"def read_lines\n File.read(@document_file).split(\"\\n\")\n end",
"def read_int_array(lines)\n out = []\n lines.each do |line|\n values = line.scan(/\\d+/).flatten\n values.each do |value|\n out.push(value.to_i)\n end\n end\n return out\nend",
"def process_input_file \n File.open(@file, 'r') do |f|\n f.each_line do |line|\n parse_line(line)\n end\n end\n end",
"def get_lines\n lines = []\n read_file.each_line{|l| lines << l.chomp }\n @total_lines = lines.shift.to_i\n lines\n end",
"def numbers_list\n numbers = File.open(\"numbers.txt\") do |file|\n while line = file.gets\n @number_list << line\n end\n end\n end",
"def le_arquivoL (arq)\n l = Array.new\n text = File.open(arq).read\n text.gsub!(/\\r\\n?/, \"\\n\")\n text.each_line do |line|\n l = l << line\n end\n return l\n end",
"def readFile\r\n\t\tfile = File.open(fileName, \"r\")\r\n\r\n\t\t#Array for partial matches\t\t\r\n\t\t@dictionary = Array.new\r\n\t\tfile.each do |line|\r\n\t\t\tif line != \"\\n\"\r\n\t\t\t\t@dictionary << line.split(/[:;\\n]/)\r\n\t\t\tend\r\n\t\tend\r\n\t\tstartStrategies\r\n\tend",
"def build_cls_list(file_name, arr)\n file = File.open(file_name, \"r\")\n while !file.eof?\n line = file.readline.chomp\n arr.push(line)\n end\n file.close\nend",
"def file_to_a file_path_str, delimiter=\"\\n\"\n File.read(file_path_str).lines(separator=delimiter)\n end",
"def read_file\n file = File.new(\"/tmp/cipher1.txt\", \"r\")\n text = Array.new()\n line = file.gets\n line.chomp!()\n line.split(/,/).each {\n | num |\n text.push(Integer(num))\n }\n file.close\n return text\nend",
"def getFileContent(dir, file):Array\n arr = Array.new\n File.open(\"#{dir}/#{file}\", \"r\").each do |line|\n arr.push line\n end\n arr\n end",
"def parse_txt_file(filename)\n file_lines = []\n File.open(filename).each do |line|\n file_lines << line.chomp\n end\n file_lines\nend",
"def take_input\n pp File.open('input.txt').read.split\n end",
"def parse_file\n filename = full_path_from_edict_file(@config[\"filename\"])\n ### Get all the line into memory\n file_obj = File.new(filename, \"r\")\n file_obj.each do |line|\n @added_lines.push line\n end\n end",
"def read_matrix\n file = File.open(\"matrix.txt\", \"r\")\n matrix = []\n line = \"\"\n\n while line = file.gets\n matrix << line.split.map { |i| i.to_i }\n end\n matrix\nend",
"def readFile\r\n strArray = IO.readlines( ARGV[0] )\r\n intArray = Array.new( Integer(strArray[0]) )\r\n for i in 2..strArray.size\r\n if !strArray[i].nil?\r\n intArray[i-2] = Integer( strArray[i].chomp )\r\n end\r\n end\r\n intArray \r\nend",
"def load_array\n #return if $valid_array\n $valid_array = false\n @data = []\n File.open(@app_file_path).each do |line|\n row = line.chomp.split( @app_delim ) \n @data << row\n end\n $valid_array = true\n end",
"def get_single_line_input_int_arr(original_filename, separator: ',')\n get_input_str(original_filename).split(separator).map(&:to_i)\nend",
"def load_list filename\n\tlist = []\n\tbegin\n\t\topen filename do |f|\n\t\t\tuntil (line = f.gets).nil?\n\t\t\t\tnext if line.strip.empty?\n\t\t\t\tlist << line.strip\n\t\t\tend\n\t\tend\n\trescue Errno::ENOENT\n\tend\n\tlist\nend",
"def read filename\n # Open file, Read in and process data.\n file = File.open(filename)\n file.each do |line|\n # Comma seperated data.\n # E.g. 1,2,1 => x=1, y=2, output=1\n line = line.chomp\n if line.size > 0\n # If the line is not empty, then it has data\n line = line.split \",\"\n @x << line[0].to_i\n @y << line[1].to_i\n @output << line[2].to_i\n end\n end\n end",
"def input_lines; end",
"def input_matrix(file_name)\n\t\tc_arr = []\n\t\tFile.open(file_name, \"r\").each_line do |line|\n\t\t\t#If this is the first line, initialize each strain and add it to the array\n\t\t\tif $. == 1\n\t\t\t\tline.split.each do |strain|\n\t\t\t\t\tc_arr.push(PA_vector.new(strain)) unless strain == 'cluster_names'\n\t\t\t\tend\n\t\t\t\t#otherwise, add the cluster to each strain vector\n\t\t\telse\n\t\t\t\tcluster = line.split\n\t\t\t\t(1..cluster.length-1).each do |i|\n\t\t\t\t\tc_arr[i-1].clusters[cluster[0]] = cluster[i].to_i\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tc_arr\n\tend",
"def get_lines(filename)\n return File.open(filename, 'r').readlines\nend",
"def get_lines(filename)\n return File.open(filename, 'r').readlines\nend",
"def get_lines(filename)\n return File.open(filename, 'r').readlines\nend",
"def read_input(file_name)\n\n all_inputs = Array.new\n file = File.open(file_name)\n input_data = file.read\n input_data.each_line do |line|\n #next if line.start_with?('#')\n #next if line.chomp.empty?\n input = line.chomp.strip\n all_inputs << input\n end\n return all_inputs[0]\nend",
"def read()\n a=[]\n f=open(\"words.txt\")\n f.each_line {|line|\n a[a.length]=line.chomp}\n f.close\n return a\nend",
"def sort_array\n a = File.readlines(file_name)\n b = a.sort\n end",
"def read\n data = []\n\n File.open(@source) do |file|\n while line = file.gets\n data.push(Hash[@columnNames.zip(line.split(' '))])\n end\n end\n\n data\n end",
"def readData(filename)\n\t\t@dataArray = Array.new\n\t\tfile = File.open(filename)\n\t\t\n\t\tfile.each_line do |line|\n\t\t\tarray = line.split(/,/)\n\t\t\tentry = Struct::ContactEntry.new(array[0], array[1], array[2])\n\t\t\t@dataArray.push(entry)\n\t\tend\n\t\n\t\tfile.close\n\t\t\n\tend",
"def process_lines(input_file)\n for line in input_file\n process_line(line)\n end\n end_of_file\n end",
"def load_array_from_file(filename)\n @taguchi_array = []\n path_to_file =\n File.join(File.dirname(__FILE__),\n '..',\n \"taguchi_orthogonal_arrays/#{filename}\")\n array_file = File.open(path_to_file, 'r')\n array_file.each_line do |line|\n @taguchi_array << line.split(';')[0, @num_genes].map!(&:to_i)\n end\n array_file.close\n end",
"def get_arrays(line)\n pairs = line.chomp.split(',')\n arrys = pairs.map do |range|\n indeces = range.split('-').map(&:to_i)\n (indeces.first..indeces.last).to_a\n end\nend",
"def read_file(file)\n lines = []\n IO.foreach(find(file)) do |line|\n lines << line.strip unless line.strip == ''\n end\n lines\n end",
"def load_data(filename)\n a = {}\n\n if File.exist? filename\n File.foreach (filename) do |line|\n line = line.chomp.split(' ')\n a[line[0]] = Array.new if !a[line[0]]\n a[line[0]][0] = Array.new if !a[line[0]][0]\n a[line[0]][0] << line[1]\n a[line[0]][1] = Array.new if !a[line[0]][1]\n a[line[0]][2] = false\n end\n end\n\n return a\n end",
"def read_lines(file_path)\n raise(format(ERROR_FILE_NOT_EXIST, file_path)) unless File.exist?(file_path)\n\n File.readlines(file_path, chomp: true)\n end",
"def load_array\n #return if $valid_array\n $valid_array = false\n @data = []\n File.open(@app_file_path).each do |line|\n # FIXME: use @app_delim\n row = line.chomp.split \"\\t\"\n @data << row\n end\n $valid_array = true\n end",
"def file_list(dir)\n array = Array.new\n array += File.readlines(dir).map(&:chomp)\nend",
"def load_data\n @data=[]\n marker_found=false\n @file.rewind\n @file.each_line do |line|\n if !marker_found && @sentinel.call(line) then\n marker_found=true\n end\n\n @data << line if marker_found\n end\n end",
"def loadArray\n clearScreen\n @boxGoalCoord=[]\n @levelArr=[]\n\n lineCount=0\n #open the file and make each line an element in the 2d array @levelArr\n File.readlines(\"./levels/level#{@levelNo}.xsb\").each do |line|\n #initialize the subarray 'charArr'\n charArr=[]\n\n xCount=1\n line.each_char do |char|\n #push new element to the array subarray 'charArr'\n if char=='.'\n @boxGoalCoord.push(\"#{xCount},#{lineCount}\")\n end\n charArr.push(char)\n xCount+=1\n end\n #add the sub array 'charArr' to the whole file array 'fileArr'\n @levelArr.push(charArr)\n lineCount+=1\n end\nend",
"def read_input(file_name)\n file = File.open(file_name)\n input_data = file.read\n lines = 0\n data = []\n input_data.each_line do |line|\n #data << Integer(line.chomp)\n data << line.chomp\n end\n puts \"input_data lines = #{data.length} num_bits = #{data[0].length}\"\n data\nend",
"def read_numbers(numeric_file)\r\n numbers = []\r\n File.open(numeric_file).each do |line|\r\n if !(line.nil?)\r\n numbers.concat(line.chomp.split(\" \").map{|item| item.to_i})\r\n end\r\n end\r\n return numbers\r\nend",
"def read() #read each lines\n a=[]\n f=open(\"blendlist.txt\")\n f.each_line {|line|\n a[a.length] = line.chomp} #add line to a's last,cutting enter\n f.close\n return a\nend",
"def readlines(sep=$/)\n return [] unless advance!\n\n lines = []\n while line = gets(sep)\n lines << line\n end\n\n lines\n end",
"def parse_input(input_file); end",
"def parse_input(input_file); end",
"def read_file\n \t@readin = []\n file = File.open(@filename[@file_count], 'r')\n\t @readin = file.each.to_a\n\t # chop off the escaped characters (in this case: \\r\\n)\n @readin.map! {|s| s.chomp}\n # increment the file count\n @file_count += 1\n file.close\n # determine which file was read in\n # the files either have a \"W\" (for power) or \"Wh\" as the first line\n \tif @readin[0] =~ /Wh/\n \t\tparse_energy\n \telse @readin[0] =~ /W/\n \t\tparse_power\n \tend\n end",
"def constructListFromFile(input)\n\t\t\tresult = Array.new()\n\t\t\tsize = input.size/6\n\t\t\tfor i in 0..size-1\n\t\t\t\talimento = Alimento.new(input[6*i], input[6*i+1].to_f, input[6*i+2].to_f, input[6*i+3].to_f, input[6*i+4].to_f, input[6*i+5].to_f)\n\t\t\t\tresult.append( alimento )\n\t\t\tend\n\t\t\treturn result\n\t\tend",
"def field_array(lines)\n entries = []\n text = lines.join\n text.scan(/^>.+<(.+)>\\n(.+\\n)+\\n/) do |name, data| \n entries << [name, data.chomp]\n end\n Hash[entries]\n end",
"def read_tracks music_file\n\ttracks = Array.new()\n\tcount = music_file.gets().to_i\n tracks = Array.new\n\n # Put a while loop here which increments an index to read the tracks\n\n track = read_track(music_file)\n tracks << track\n\n\ttracks\nend",
"def cargarProductos()\n i=0\n File.open('productos.txt', 'r') do |f1| #primer parametro lo q va a leer, r es para leer (f1 es el primeer archivo etc etc)\n while linea = f1.gets\n $productos[i]=linea.split (\",\") #este es un metodo para que cuando ingresen los datos al arreglo los separe por columnas cada que tenga una coma\n #pueden borrarla si no les sirve\n i+1\n end\n end\nend",
"def readFile\n File.open(ARGV[0], \"r\") do |f|\n f.each_line do |line|\n if line != \" \" or line != \"\"\n auxData = line.split\n n = Operations.new(auxData[1],auxData[2],auxData[3])\n $data.push(n)\n end\n end\n end\nend",
"def read_file(path)\n file_contents = []\n File.open(path).each { |line| file_contents << line }\n\n file_contents\n end"
] | [
"0.80196583",
"0.7749824",
"0.77011627",
"0.72063196",
"0.7174054",
"0.7150337",
"0.71363366",
"0.70905995",
"0.7030608",
"0.6968798",
"0.6930889",
"0.6930889",
"0.6908619",
"0.69043326",
"0.68708426",
"0.6870337",
"0.68451256",
"0.6843648",
"0.6832475",
"0.6819522",
"0.6727595",
"0.6725542",
"0.67211074",
"0.66785794",
"0.66499084",
"0.6646919",
"0.6645298",
"0.66407585",
"0.66159993",
"0.6605324",
"0.6545157",
"0.65401226",
"0.65296364",
"0.65278447",
"0.6508155",
"0.6507309",
"0.64882773",
"0.6468908",
"0.6454644",
"0.64246285",
"0.64056456",
"0.63818747",
"0.63764316",
"0.6357096",
"0.6346453",
"0.63385856",
"0.63364387",
"0.63299066",
"0.63265234",
"0.6319274",
"0.6317758",
"0.62984085",
"0.6292026",
"0.628315",
"0.626636",
"0.6223957",
"0.6212532",
"0.6209395",
"0.6208687",
"0.6194372",
"0.6187342",
"0.61741847",
"0.6173136",
"0.6163864",
"0.61566824",
"0.61493593",
"0.6132189",
"0.613033",
"0.6129786",
"0.6124533",
"0.6124533",
"0.6124533",
"0.6123643",
"0.61187667",
"0.6117964",
"0.61142504",
"0.6067347",
"0.60575473",
"0.6047516",
"0.60382986",
"0.60321146",
"0.6031371",
"0.60194004",
"0.60061884",
"0.5992941",
"0.5984897",
"0.5982776",
"0.5972378",
"0.59561473",
"0.59479344",
"0.59458995",
"0.5945599",
"0.5945599",
"0.5942791",
"0.5942679",
"0.5925682",
"0.5912757",
"0.590893",
"0.5906381",
"0.5904953"
] | 0.6262738 | 55 |
Convert input to HTML with predefined markup language. | def to_html
case @markup
when 'markdown'
@data_for_output.collect! {|line| BlueCloth.new(line).to_html}
when 'textile'
@data_for_output.collect! {|line| RedCloth.new(line).to_html}
when 'bbcode'
@data_for_output.collect! {|line| line.bbcode_to_html}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text_to_html( content )\r\n content = case @markup_type\r\n when :markdown\r\n markdown_to_html( content )\r\n when :textile\r\n textile_to_html( content )\r\n when :rest\r\n rest_to_html( content )\r\n end\r\n content\r\n end",
"def text_to_html( content )\n content = case @markup_type\n when :markdown\n markdown_to_html( content )\n when :textile\n textile_to_html( content )\n when :mediawiki\n mediawiki_to_html( content )\n when :rest\n rest_to_html( content )\n end\n content\n end",
"def html_markup_html(text); end",
"def trans_html\n @doc.to_html\n end",
"def html_markup_text(text); end",
"def fix(input)\n data = open(input, \"r\").read\n data.gsub! \"≤\", \"\\\\leq\"\n data.gsub! \"×\", \"\\\\times\"\n data.gsub! \"≠\", \"\\\\neq\"\n\n translators = data.split(\"\\n\")[-1].strip()[3..-1].split(\", \")\n translators.each do |t|\n TRANSLATOR_POINT[t] = (TRANSLATOR_POINT[t] or 0.0) + 1.0 / translators.length\n end\n\n data = data.split(\"\\n\")[0..-2].join(\"\\n\")\n data += \"\\n<p class=\\\"math\\\" style=\\\"text-align:right;font-style:italic\\\">Орчуулсан: #{translators.join(\", \")}</p>\"\n print \"Converting to HTML: #{input} Translated by: #{translators.join(\", \")}\\n\"\n\n open(\".temp.md\", \"w+\") { |f| f.write(data) }\nend",
"def translateToShow(str)\n @result = str\n @result.gsub!(/</, '<')\n @result.gsub!(/>/, '>')\n @result.gsub!(/\\*{2}(.+)\\*{2}/, '<b>\\1</b>')\n @result.gsub!(/\\\\{2}(.+)\\\\{2}/, '<i>\\1</i>')\n @result.gsub!(/\\({2}((\\/[\\S]+)+)\\s+(.+)\\){2}/, '<a href=\"\\1\">\\3</a>')\n return @result\n end",
"def to_format(format)\n if format == :html\n text = @text\n get_variables(text)\n text = includes(text)\n text = output_variables(text)\n text\n end\n\n # Second way: #{parse(@text)}\n end",
"def markup text\n document = parse text\n\n document.accept formatter\n end",
"def to_html(*args)\n @output_format = :html\n @options += args\n convert\n end",
"def htmlify(text, markup = T.unsafe(nil)); 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 html_markup_textile(text); end",
"def bbcode_to_html(string); end",
"def convert\n Converters::HtmlConverter.new(input: to_html)\n end",
"def description_html\n convert_html description\n end",
"def conv_html(txt)\n txt.\n gsub(/>/, '>').\n gsub(/</, '<').\n gsub(/"/, '\"').\n gsub(/&/, '&')\n \n end",
"def markup text\n if @store.rdoc.options\n locale = @store.rdoc.options.locale\n else\n locale = nil\n end\n if locale\n i18n_text = RDoc::I18n::Text.new(text)\n text = i18n_text.translate(locale)\n end\n parse(text).accept formatter\n end",
"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(/"|\"/) 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(/(?:'|'){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(/'|'/) 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 html_markup_asciidoc(text); end",
"def conv_markup(txt)\n txt.\n gsub(%r{<tt>(.*?)</tt>}) { \"+#$1+\" } .\n gsub(%r{<code>(.*?)</code>}) { \"+#$1+\" } .\n gsub(%r{<b>(.*?)</b>}) { \"*#$1*\" } .\n gsub(%r{<em>(.*?)</em>}) { \"_#$1_\" }\n end",
"def html_markup_org(text); end",
"def html_converter_class\n ::Kramdown::Converter::Html\n end",
"def display(text, html_options = nil)\n if html_options\n html_options = html_options.stringify_keys\n tag_options = tag_options(html_options)\n else\n tag_options = nil\n end\n #sanitize(text).to_html.gsub(\"<p>\", \"<p#{tag_options}>\")\n markdown(sanitize(text.gsub(\"\\n\",\"<br/>\"))).gsub(\"<p>\", \"<p#{tag_options}>\")\n end",
"def format\n return :text if text?\n return :html if html?\n end",
"def to_html\r\n html = @text\r\n html = html_tag(:em, content: html) if italicized?\r\n html = html_tag(:strong, content: html) if bolded?\r\n styles = {}\r\n styles['text-decoration'] = 'underline' if underlined?\r\n # No need to be granular with font size down to the span level if it doesn't vary.\r\n styles['font-size'] = \"#{font_size}pt\" if font_size != @font_size\r\n html = html_tag(:span, content: html, styles: styles) unless styles.empty?\r\n html = html_tag(:a, content: html, attributes: {href: href, target: \"_blank\"}) if hyperlink?\r\n return html\r\n end",
"def html_highlight\n language, code = *values\n require 'coderay'\n language = 'nitro_xhtml' if language == 'ezamar'\n\n case language\n when *%w[ruby c delphi html nitro_xhtml plaintext rhtml xml]\n tokens = CodeRay.scan(code, language)\n html = tokens.html(:wrap => :div)\n when *%w[diff]\n require 'uv'\n Uv.parse(code, output = 'xhtml', syntax_name = language, line_numbers = false, render_style = 'amy', headers = false)\n else\n code = language if not code or code.strip.empty?\n html = tag(:pre, code)\n end\n end",
"def convert_html(text)\n auto_html text do\n html_escape :map => {\n '&' => '&',\n '>' => '>',\n '<' => '<',\n '\"' => '\"'\n }\n image\n youtube :width => 510, :height => 332\n vimeo :width => 510, :height => 332\n link :target => :_blank\n redcarpet :target => :_blank\n end\n end",
"def to_html\n fail NoMethodError, \"Engines need to implement this method\"\n end",
"def to_html(text, format = nil)\n format ||= :textile\n if format == :textile\n RedCloth.new(text).to_html\n else\n text\n end\n end",
"def to_html(*args); end",
"def to_html(*args); end",
"def to_html(*args); end",
"def to_html(*args); end",
"def to_html\n case content_type\n when 'text/html'\n content\n when 'text/rtf'\n MessageProcessor.make_html_from_rtf(content)\n when 'text/plain'\n if content.starts_with?(\"{\\\\rtf\")\n MessageProcessor.make_html_from_rtf(content)\n else\n #MessageProcessor.make_html_from_text(content)\n content\n end\n when 'application/x-pit'\n c = content.scan(/^301 (.*)$/).join(\"\\n\")\n if c.starts_with? \"{\\\\rtf\"\n # it's rtf inside PIT\n MessageProcessor.make_html_from_rtf(c)\n else\n MessageProcessor.make_html_from_text(c)\n end\n when 'text/x-clinical'\n c = MessageProcessor.make_html_from_text(content).gsub(/\\*(\\w+)\\*/,\"<b>\\\\1</b>\")\n c.gsub(/\\{([^\\{]+)\\}/) do |str|\n obj = Code.get_clinical_object($1,self)\n if obj\n obj.to_html\n else\n str\n end\n end\n else\n MessageProcessor.make_html_from_text(content)\n end\n \n end",
"def html_convert(str)\r\n\t\t#リンク処理\r\n\t\tstr = str.to_s.gsub(/(http[s]?\\:\\/\\/[\\w\\.\\~\\-\\/\\?\\&\\+\\=\\:\\@\\%\\;\\#\\%]+)/) do\r\n\t\t\t\"<a href=\\\"#{$1}\\\" target=\\\"_blank\\\">#{$1}</a>\"\r\n\t\tend\r\n\t\t#@ハンドル名リンク\r\n\t\tstr = str.to_s.gsub(/(\\@)([a-zA-Z0-9_]+)/) do\r\n\t\t\t\"<a href=\\\"http://twitter.com/#{$2}\\\" target=\\\"_blank\\\">#{$1}#{$2}</a>\"\r\n\t\tend\r\n\t\t# #タグリンク\r\n\t\tstr = str.to_s.gsub(/(#)([a-zA-Z0-9]+)/) do\r\n\t\t\t\"<a href=\\\"http://twitter.com/#search?q=%23#{$2}\\\" target=\\\"_blank\\\">#{$1}#{$2}</a>\"\r\n\t\tend\r\n\t\treturn str\r\n\tend",
"def create_html(options)\n if(options[:html_template] && options[:html_template] == :scientific) then\n\n if(options[:language] && options[:language] == :english) then\n html = '<h2>Academic Interests<\\/h2>\\r\\n' +\n '<p>Add information about academic fields of interest.<\\/p>\\r\\n' +\n '<h2>Teaching<\\/h2>\\r\\n' +\n '<ul>\\r\\n' +\n ' <li><Link to programme of study/course><\\/li>\\r\\n' +\n ' <li><Link to programme of study/course><\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Higher education and employment history<\\/h2>\\r\\n' +\n '<p>Brief introduction to previous education and employment.<\\/p>\\r\\n' +\n '<h2>Honoraria<\\/h2>\\r\\n' +\n '<ul>\\r\\n' +\n ' <li><Name of prize and (if applicable) link 1><\\/li>\\r\\n' +\n ' <li><Name of prize and (if applicable) link 2><\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Appointments<\\/h2>\\r\\n' +\n '<ul>\\r\\n' +\n ' <li><Title and (if applicable) link 1><\\/li>\\r\\n' +\n ' <li><Title and (if applicable) link 2><\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Cooperation<\\/h2>\\r\\n' +\n '<p> <\\/p>'\n else\n html = '<h2>Faglige interesser<\\/h2>\\r\\n' +\n '<p>Her kan du skrive om faglige interesser.<\\/p>\\r\\n' +\n '<h2>Undervisning<\\/h2>\\r\\n<p>' +\n '<Lenke til studieprogram/emne> <br />\\r\\n' +\n '<Lenke til studieprogram/emne> <br />\\r\\n...<\\/p>\\r\\n' +\n '<h2>Bakgrunn<\\/h2>\\r\\n' +\n '<p>Kort om tidligere arbeidserfaring og utdanning<\\/p>\\r\\n' +\n '<h2>Priser<\\/h2>\\r\\n' +\n '<p><Navn og eventuelt lenke til pris 1> <br />\\r\\n' +\n '<Navn og eventuelt lenke til pris 2> <br />\\r\\n' +\n '...<\\/p>\\r\\n' +\n '<h2>Verv<\\/h2>\\r\\n<p>' +\n '<Navn og eventuelt lenke til verv 1> <br />\\r\\n' +\n '<Navn og eventuelt lenke til verv 2> <br />\\r\\n...' +\n '<\\/p>\\r\\n' +\n '<h2>Samarbeid<\\/h2>\\r\\n' +\n '<p> <\\/p>'\n end\n else\n\n if(options[:language] && options[:language] == :english) then\n html = '<h2>Tasks performed<\\/h2>\\r\\n' +\n '<p>Add information about job duties, as a short text or a bulleted list:<\\/p>' +\n '\\r\\n<ul>\\r\\n' +\n ' <li><Task 1><\\/li>\\r\\n' +\n ' <li><Task 1><\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Background<\\/h2>\\r\\n' +\n '<p>Add information about previous education and employment.<\\/p>'\n else\n html = '<h2>Arbeidsområder<\\/h2>\\r\\n' +\n '<p>Her kan du skrive om arbeidsområder, ' +\n 'enten som kort tekst eller som listepunkter:</p>' +\n '\\r\\n' +\n '<ul>\\r\\n' +\n ' <li><Arbeidsområde 1></li>\\r\\n' +\n ' <li><Arbeidsområde 1></li>\\r\\n' +\n ' <li>...</li>\\r\\n' +\n '</ul>' +\n '\\r\\n' +\n '<h2>Bakgrunn</h2>\\r\\n' +\n '<p>Eventuelt kort om tidligere arbeidserfaring og utdanning.</p>'\n end\n end\n return html\n end",
"def to_html\n @markdown_class.new(@markdown).to_html\n end",
"def html(s)\n convert(s, mime: 'text/html')\n end",
"def html_markup_markdown(text); end",
"def to_html(formatting, text)\n text\n end",
"def to_english(html_string)\n # The regex literal syntax using %r{...} allows '/' in the regex without escaping.\n # The 'm' modifier makes the regex match also \\n, allowing to eliminate tags that span multiple lines.\n # The '?' makes the .+ non-greedy, as to match at the first possible closing tag rather than the last possible one,\n # which might eliminate whole sections of <lang_en> text as well.\n html_string = html_string.gsub( %r{<lang_it>.+?</lang_it>}m, '' )\n html_string = html_string.gsub( %r{</?lang_it>}, '' ) # Lone half-tags from corrupted documents.\n html_string = html_string.gsub( %r{</?lang_en>}, '' )\nend",
"def to_english(html_string)\n # The regex literal syntax using %r{...} allows '/' in the regex without escaping.\n # The 'm' modifier makes the regex match also \\n, allowing to eliminate tags that span multiple lines.\n # The '?' makes the .+ non-greedy, as to match at the first possible closing tag rather than the last possible one,\n # which might eliminate whole sections of <lang_en> text as well.\n html_string = html_string.gsub( %r{<lang_it>.+?</lang_it>}m, '' )\n html_string = html_string.gsub( %r{</?lang_it>}, '' ) # Lone half-tags from corrupted documents.\n html_string = html_string.gsub( %r{</?lang_en>}, '' )\nend",
"def to_html()\n @html ||= cmark(\"--to\", \"html\")\n @html\n end",
"def to_xhtml\n with_protected_tags(self, VERBATIM_TAGS, true) do |text|\n html = with_protected_tags(text, PROTECTED_TAGS, false) do\n |s| s.thru_maruku\n end\n\n # Markdown's \"code spans\" should really be \"pre spans\"\n while html.gsub! %r{(<pre>)<code>(.*?)</code>(</pre>)}m, '\\1\\2\\3'\n end\n\n # allow \"code spans\" annotated with Maruku's IAL (Inline\n # Attribute List) Markdown extension to be syntax colored\n while html.gsub! %r{<pre[^>]+>(<code[^>]+>.*?</code>)</pre>}m, '\\1'\n end\n\n # allow user to type <pre> blocks on single lines\n # without affecting the display of their content\n html.gsub! %r{(<pre>)[ \\t]*\\r?\\n|\\r?\\n[ \\t]*(</pre>)}, '\\1\\2'\n\n # ensure tables have a border: this *greatly* improves\n # readability in text-based web browsers like w3m and lynx\n html.gsub! %r/<table\\b/, '\\& border=\"1\"'\n\n # add syntax coloring\n html.thru_coderay\n end\n end",
"def html_to_bbcode(string); end",
"def to_xhtml(*args); end",
"def to_xhtml(*args); end",
"def to_xhtml(*args); end",
"def to_xhtml(*args); end",
"def to_html_msg(str)\n str.gsub!(\"<stdin>:\", \"\") # Output from the compiler\n str.gsub!(\"<\", \"<\")\n str.gsub!(\">\", \">\")\n str.gsub!(/[\\n|\\r\\n]/, '<br\\>') # Replace newlines with line breaks \n str\n end",
"def html\n return if self.text.blank?\n\n html = self.text\n \n # s = StringScanner.new(self.text)\n # html = ''\n # while markup = s.scan_until(/\\[code/) do\n # html += RedCloth.new(markup[0..-6]).to_html\n # s.pos= s.pos-5\n # code = s.scan_until(/\\[\\/code\\]/)\n # if code\n # code.gsub!(/\\[code\\]/, '[code lang=\"ruby\"]')\n # html += '<div class=\"syntax\">' + Syntaxi.new(code).process + '</div>' \n # else\n # break\n # end\n # end\n # html += RedCloth.new(s.rest).to_html\n \n html\n end",
"def to_html\n determine_markdown_renderer\n @markdown.to_html\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 make_html\n @document.encoding = 'UTF-8'\n @best_candidate = nil\n end",
"def to_html; end",
"def to_html(options = T.unsafe(nil)); end",
"def to_html(options = T.unsafe(nil)); end",
"def translate_to_html(ep_template)\n ep_template\n .gsub(/\\{many\\}/, '<ep-many>')\n .gsub(/\\{\\/many\\}/, '</ep-many>')\n .gsub(/\\{\\.\\.\\.\\}/, '<ep-something />')\n .gsub(/\\{scope\\}/, '<ep-scope>')\n .gsub(/\\{\\/scope\\}/, '</ep-scope>')\n .gsub(/\\{\\$([a-z]+\\w*)\\}/, '<ep-variable name=\"\\1\">')\n .gsub(/\\{\\/\\$[a-z]+\\w*\\}/, '</ep-variable>')\n .gsub(/\\{\\/([^\\}]+)\\/\\}/, '<ep-regex value=\"\\1\" />')\n .gsub(/\\{\\.\\.\\.but\\}/, '<ep-but>')\n .gsub(/\\{\\/\\.\\.\\.but\\}/, '</ep-but>')\n .gsub(/\\{either\\}/, '<ep-either>')\n .gsub(/\\{\\/either\\}/, '</ep-either>')\n .gsub(/\\{or\\}/, '<ep-or />')\n end",
"def to_html\n @html ||= format_html\n end",
"def plain_html\n self.class.to_html.to_html(text.dup)\n end",
"def TeX2htm(text,state=:normal,fname=\"\",sec=\"\")\n sp=proc{|s| $trads[$key.succ!]=s; \"\\\\#{$key} \"}\n mathdisplay=proc{|s|\n sp[TeX2htm(s,:math).h(\"I\").h(\"td\").h(\"tr\").h(\"table\").h(\"center\")]}\n text=text.gsub(/([^\\\\]|^)%.*/){m=$~;m[1]} # suppress tex comments\n unless state==:math\n text.gsub!(/\\\\$/,\"\\\\ \")\n vb=/\\|'\\\\\\|'\\|/ # a | in verbatim\n vb2=/\\|\\s*\\{\\s*\\\\tt\\s*\\\\\\|\\s*\\}\\s*\\|/ # another way for | in verbatim\n vbb=/(?:#{vb2}|#{vb})/o\n text.gsub!(/([^\\\\]|^|\\\\\\\\)\\|((?:[^|]|#{vbb})*)\\|/om){ m=$~\n if m[2]=~/\\n/\n m[1]+sp[m[2].gsub(vbb,\"|\").lines.map{|l| v=l.split(\"#\");\n\tv[0].gsub!(/&/,\"#\");v[0].gsub!(/</,\"<\");\n\tif v[1] then v[1]=TeX2htm(v[1]); v.join(\"#\")\n\telse v[0]\n\tend}.join.h(\"pre\")]\n else m[1]+sp[m[2].gsub(vbb,\"|\").gsub(/&/,\"#\").gsub(/</,\"<\").clean.h(\"code\")]\n end\n }\n text.gsub!(/\\$\\$(.*?)\\$\\$/m){m=$~; mathdisplay[m[1]]}\n text.gsub!(/\\\\\\[(.*?)\\\\\\]/m){m=$~; mathdisplay[m[1]]}\n text.gsub!(/([^\\\\]|^)\\$(.*?)\\$/m){m=$~\n m[1]+sp[TeX2htm(m[2],:math).h(\"I\")]}\n text.gsub!(/([^\\\\]|^)\\*([^*]*)([^\\\\])\\*/){m=$~;\n m[1]+sp[(m[2]+m[3]).h(\"strong\")]}\n end\n text.gsub!(/\\\\\\\\/){\"\\\\cr\"}\n text.gsub!(/([^\\\\])<([^>]*)>/m){m=$~;m[1]+sp[TeX2htm(m[2]).h(\"var\")]}\n text.gsub!(/([^\\\\]|^)'((?:[^']|\\\\')*)([^\\\\])'/m){m=$~;\n m[1]+sp[(m[2]+m[3]).clean.h(\"code\")]}\n text.gsub!(/([^\\\\]|^)\\\\([*{}|': <>;,#~-])/){m=$~;m[1]+sp[OneChar[m[2]]]}\n text.gsub!(/([^\\\\]|^)\\\\([*{}|': <>;,#~-])/){m=$~;m[1]+sp[OneChar[m[2]]]}\n unless state==:math\n text.gsub!(/^\\s*$/,\"\\\\par\")\n text.gsub!(/^\\s*\\\\vspace\\{[^}]*\\}\\s*$/,\"\\\\par\")\n text.gsub!(/^([^:\\n]*)([^\\\\]):(.*?)(?=\\\\par)/m){m=$~\n sp[\"<DL><DT>#{TeX2htm(m[1]+m[2])}:<DD>\"]+\"#{m[3]}\"+sp[\"</DL>\"]}\n text.gsub!(/\\\\cr/){sp[\"<BR>\"]}\n # characters that can appear in a cross reference\n text.gsub!(/([^\\\\]|^)\"([\\w\\s.$-]*)\"/m){m=$~;\n m[1]+sp[\"<a href=\\\"#{name2fn m[2]}\\\">#{m[2]}</a>\"]}\n text.gsub!(/\\\\\"/){sp['\"']}\n text.gsub!(/\\\\cite(?:\\[([^\\]\\[]*)\\])?\\s*\\{\\s*((?:\\w|,)+)\\s*\\}/m) { m=$~\n r=\"<A href=\\\"biblio.htm##{m[2].split(\",\")[0]}\\\">#{m[2].h(\"cite\")}</a>\"\n r<< \", \"+m[1] if m[1]\n sp[r] }\n text.gsub!(/\\\\accent\\s*([0-9]*)\\s*([a-zA-Z])/m){m=$~\n a=Accents[m[1]+m[2]]\n if a then a\n else $err.print \"** unhandled accent #{fname}:#{sec} #{m[0]}\\n\"\n end}\n text.gsub!(/\\\\psubsection\\s*\\{(.*?)\\}/m){m=$~; m[1].h(\"h3\")}\n text.gsub!(/\\\\psection\\s*\\{(.*?)\\}/m){m=$~;m[1].h(\"h1\").style(\"color:#ff0000\")}\n text.gsub!(/\\\\index\\s*\\{(.*?)\\}/m){m=$~\n $indexcount+=1 # emit an anchor and remember the index keys for later\n r=m[1].gsub(/\\\\([a-zA-Z]+) /){m=$~; $trads[m[1]] || \"\\\\#{m[1]} \"}\n $index[r]=$index[r].push([\"#{fname}#I#{$indexcount}\",\"#{sec.chapnum}.#{sec.secnum}\"])\n \"<A name = \\\"I#{$indexcount}\\\"></a>\\n\"\n }\n text.gsub!(/\\\\begin\\{([^}]*)\\}(.*?)\\\\end\\{\\1\\}/m){m=$~\n case m[1]\n when \"displaymath\",\"equation\" then mathdisplay[m[2]]\n when \"center\" then m[2].h(\"center\")\n when \"itemize\",\"enumerate\" then m[2]\n else \"{beg-\"+m[1]+\"}\".h(\"s\")+m[2]+\"{end-\"+m[1]+\"}\".h(\"s\")\n end}\n text.gsub!(/~/,\" \")\n end\n# nestedbraces=// # can define but not recognized inside another regexp\n# text.gsub!(/\\\\(\\s)/){m=$~;m[1]}\n text.gsub!(/\\{\\s*\\\\(?:sl|it)([^}]*)\\}/m){m=$~;\n sp[TeX2htm(m[1],state).h(\"I\")]}\n text.gsub!(/\\{\\s*\\\\cal([^}]*\\{[^}]*\\}[^}]*)\\}/m){sp[$~[1].style(\"font-family: cursive\")]}\n text.gsub!(/\\{\\s*\\\\cal([^}]*)\\}/m){sp[$~[1].style(\"font-family: cursive\")]}\n text.gsub!(/\\{\\s*\\\\tt([^}]*\\{[^}]*\\}[^}]*)\\}/m){m=$~;sp[m[1].h(\"code\")]}\n text.gsub!(/\\{\\s*\\\\tt([^}]*)\\}/m){m=$~;sp[m[1].h(\"code\")]}\n text.gsub!(/\\{\\s*\\\\bf([^}]*\\{[^}]*\\}[^}]*)\\}/m){m=$~;sp[m[1].h(\"strong\")]}\n text.gsub!(/\\{\\s*\\\\bf([^}]*)\\}/m){m=$~;sp[m[1].h(\"strong\")]}\n text.gsub!(/\\{\\s*\\\\em([^}]*\\{[^}]*\\}[^}]*)\\}/m){m=$~;sp[m[1].h(\"em\")]}\n text.gsub!(/\\{\\s*\\\\em([^}]*)\\}/m){m=$~;sp[m[1].h(\"em\")]}\n if state==:math\n text.gsub!(/</){sp[\"<\"]}\n text.gsub!(/>/){sp[\">\"]}\n texarg=/([^{\\\\]|\\{(?:(?:[^{}]|\\{[^{}]*\\})*)\\}|\\\\[a-zA-Z]+)/\n text.gsub!(/\\^\\\\prime/om){sp[\"'\"]}\n text.gsub!(/\\^\\{\\\\prime\\\\prime\\}/om){sp[\"''\"]}\n text.gsub!(/\\\\not\\s*\\\\equiv/om){sp[\"≢\"]}\n text.gsub!(/\\\\(?:text|mbox|hbox)\\{([^{}]*)\\}/){m=$~;\n sp[TeX2htm(m[1]).h(\"/i\")]}\n text.gsub!(/\\^\\s*#{texarg}/om){m=$~;sp[TeX2htm(m[1],:math).h(\"sup\")]}\n text.gsub!(/_\\s*#{texarg}/om){m=$~;sp[TeX2htm(m[1],:math).h(\"sub\")]}\n text.gsub!(/\\\\underline\\s*#{texarg}/om){m=$~;sp[TeX2htm(m[1],:math).h(\"u\")]}\n text.gsub!(/\\\\overline\\s*#{texarg}/om){m=$~;\n sp['<span style=\"text-decoration: overline\">'+\n TeX2htm(m[1],:math)+\"<\\/span>\"]}\n text.gsub!(/\\{\\s*\\\\rm([^}]*)\\}/m){m=$~;sp[m[1].h(\"I\")]}\n text.gsub!(/\\{\\s*\\\\mathcal([^}]*)\\}/m){m=$~;sp[m[1].h(\"u\")]}\n text.gsub!(/\\\\frac#{texarg}#{texarg}/om){m=$~;\n n=TeX2htm(m[1],'math'); d=TeX2htm(m[2],'math')\n n=\"(#{n})\" if n.length>1\n d=\"(#{d})\" if n.length>1\n \"#{n}/#{d}\"}\n text.gsub!(/\\\\not\\s*\\\\in/){sp[\"∉\"]}\n text.gsub!(/\\\\not\\s*=/){sp[\"≠\"]}\n text.gsub!(/\\\\([a-zA-Z]+)/){m=$~;\n if MathMacs[m[1]] then sp[MathMacs[m[1]]] else m[0] end}\n text.gsub!(/\\\\pmod\\s*#{texarg}/){m=$~;sp[\"(</i>mod<i> #{TeX2htm(m[1],:math)})\"]}\n text.gsub!(/\\\\begin\\{([^}]*)\\}(.*?)\\\\end\\{\\1\\}/m){m=$~\n case m[1]\n when \"array\",\"pmatrix\" then \n if m[1]==\"array\" then r=m[2].sub(/\\{[cl]*\\}/,\"\") else r=m[2] end\n r=r.split(\"\\\\cr\").map{|l| l.split(\"&\").map{|i| \n i.h(\"I\").h(\"td\")}.join(\"\").h(\"tr\")}.join.h('table style=\"display:inline-table;\"').h(\"td\").h(\"/td\")\n if m[1]==\"pmatrix\" then \"(\"+r+\")\" else r end\n else \"{beg-\"+m[1]+\"}\".h(\"s\")+m[2]+\"{end-\"+m[1]+\"}\".h(\"s\")\n end\n }\n end\n text.gsub!(/\\\\(?:text|mbox|hbox)\\{([^{}]*)\\}/){m=$~;\n sp[TeX2htm(m[1]).h(\"/i\")]}\n text.gsub!(/\\\\([a-zA-Z]+)/){m=$~;AlwaysMacs[m[1]] || m[0]}\n text.gsub!(/\\{([^{}]*)\\}/){m=$~; m[1]}\n text.gsub!(/\\\\([a-zA-Z]+) /){m=$~; $trads[m[1]] || \"\\\\#{m[1]} \"}\n text.gsub!(/\\\\([a-zA-Z]+) /){m=$~; $trads[m[1]] || \"\\\\#{m[1]} \"}\n text.gsub!(/\\\\([a-zA-Z]+)/){m=$~; $trads[m[1]] || \"\\\\#{m[1]}\"}\n text.scan(/\\\\([a-zA-Z]+)/){|m| $err.print \"!!!!! #{m.inspect} state=#{state}\\n\"}\n text\nend",
"def to_html_code(code)\n \"<figure class=\\\"highlight\\\"><pre><code class=\\\"language-resolve\\\" data-lang=\\\"#resolve\\\">\"\\\n \"#{code.chomp}</code></pre></figure>\"\n end",
"def html source=nil\n to_html text(source)\n end",
"def setup_markup_transform(&block)\n self.send :define_method, :markup, block\n 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| (\" \"*l_spaces.size)} \n mytext.gsub!(/\\n +/) {|l_spaces| (\"\\n\" + (\" \"*(l_spaces.size-1)))}\n mytext.gsub!(/\\n{2,}/,'</p><p>')\n mytext.gsub!(/(\\n)([^\\n])/, '<br/>\\2')\n mytext\n end",
"def html_markup_pre(text); end",
"def html!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n\n type = HTML\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 319:7: 'html'\n match( \"html\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end",
"def to_xhtml(options = T.unsafe(nil)); end",
"def to_xhtml(options = T.unsafe(nil)); end",
"def to_html source=nil\n require 'md2man/html/engine'\n Md2Man::HTML::ENGINE.render(read(source))\n rescue LoadError\n raise 'Run `gem install md2man` to use BinMan::html().'\n end",
"def html_simple\n HtmlFormatter.new(self, options).to_s\n end",
"def to_html\n html = @text\n html = html_tag(:em, content: html) if italicized?\n html = html_tag(:strong, content: html) if bolded?\n styles = {}\n styles['text-decoration'] = 'underline' if underlined?\n # No need to be granular with font size down to the span level if it doesn't vary.\n #styles['font-size'] = \"#{font_size}pt\" if font_size != @font_size\n html = html_tag(:span, content: html, styles: styles) if styles.present?\n return html\n end",
"def markdownify(input); end",
"def translate(input)\n #outStr = input.downcase\n outStr = input\n\n # replace words\n # still need to add punctuation and missing words\n outStr = single_words(outStr)\n\n # prepend and append\n outStr = prepend_and_append(outStr)\n\n # punctuation\n #outStr = punctuation(outStr)\n\n # change tags like &god or &bodypart, etc\n outStr = change_tags(outStr)\n\n\n puts outStr\n end",
"def to_italian(html_string)\n # The regex literal syntax using %r{...} allows '/' in the regex without escaping.\n html_string = html_string.gsub( %r{<lang_en>.+?</lang_en>}m, '' )\n html_string = html_string.gsub( %r{</?lang_en>}, '' ) # Lone half-tags from corrupted documents.\n html_string = html_string.gsub( %r{</?lang_it>}, '' )\nend",
"def handle_pipe\n @html = RDoc::Markup::ToHtml.new @options\n\n parser = RDoc::Text::MARKUP_FORMAT[@options.markup]\n\n document = parser.parse $stdin.read\n\n out = @html.convert document\n\n $stdout.write out\n end",
"def garnish(html)\n template{ html }\n end",
"def convert_format(value, definition)\n value || 'html'\n end",
"def convert text\n label = convert_flow @am.flow text\n\n CGI.escape(label).gsub('%', '-').sub(/^-/, '')\n end",
"def html\n HtmlFormatter.new(self, options.merge(:highlight_words => true)).to_s\n end",
"def html(locale=:en)\n if locale.to_sym == :en\n read_attribute(:html)\n else locale.to_sym == :fr\n html_fr\n end\n end",
"def conv_html(txt)\n case txt\n when Array\n txt.join.\n gsub(/>/, '>').\n gsub(/</, '<').\n gsub(/"/, '\"').\n gsub(/&/, '&')\n else # it's a String\n txt.\n gsub(/>/, '>').\n gsub(/</, '<').\n gsub(/"/, '\"').\n gsub(/&/, '&')\n end\n end",
"def ansi_to_html(string); end",
"def html\n Markdown.render(self.content)\n end",
"def html\n Markdown.render(self.content)\n end",
"def to_html\n @to_html ||= traite_to_html\n end",
"def to_wiki_code\n \tself.gsub!(/<b>(.*)?(<\\/b>)/,'**\\1**')\n \tself.gsub!(/<i>(.*)?(<\\/i>)/,'\\\\\\\\\\\\\\\\\\1\\\\\\\\\\\\\\\\')\n \tself.gsub!(/<a href=\"\\/(.*)?\">(.*)?(<\\/a>)/,'((\\1 \\2))')\n end",
"def to_html(entypo: false)\n html_type(entypo:entypo) + \" \" + html_body(inline:true)\n end",
"def html_lang\n\t'en-US'\nend",
"def md2html\n\t\tbook.toc.each do |source|\n\t\t\ttarget = 'build/raw_html/' + source.ext('html')\n\t\t\tcreate \"source/#{source}\" => target do\n\t\t\t\tinfo \"converting #{source} => #{target}\"\n\t\t\t\tm = Maruku.new IO.read(\"source/#{source}\")\n\t\t\t\tFile.open(target, 'w') do |f|\n\t\t\t\t\tif block_given?\n\t\t\t\t\t\thtml = m.to_filtered_html do |doc|\n\t\t\t\t\t\t\tyield doc\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\thtml = m.to_html\n\t\t\t\t\tend\n\t\t\t\t\tf.write html\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def textilize(input)\n RedCloth.new(input).to_html\n end",
"def to_html\n end",
"def display(text, html_options = nil)\n begin\n if html_options\n html_options = html_options.stringify_keys\n tag_opts = tag_options(html_options)\n else\n tag_opts = nil\n end\n processed_text = format(sanitize(text))\n rescue\n # Sometimes Markdown throws exceptions, so rescue gracefully.\n processed_text = content_tag(:p, sanitize(text))\n end\n add_tag_options(processed_text, tag_opts)\n end",
"def display(text, html_options = nil)\n begin\n if html_options\n html_options = html_options.stringify_keys\n tag_opts = tag_options(html_options)\n else\n tag_opts = nil\n end\n processed_text = format(sanitize(text))\n rescue\n # Sometimes Markdown throws exceptions, so rescue gracefully.\n processed_text = content_tag(:p, sanitize(text))\n end\n add_tag_options(processed_text, tag_opts)\n end",
"def preprocess(format)\n case format\n when :html then to_xml\n when :latex then to_processed_latex\n when :polytex then to_polytex\n end\n end",
"def inline_formatting(input)\n @re_help.rewrite_emphasis input do |marker, body|\n m = MarkdownMap[marker]\n \"#{m}#{body}#{m}\"\n end\n @re_help.rewrite_subp input do |type, text|\n if type == \"_\" then\n \"<sub>#{text}</sub>\"\n elsif type == \"^\" then\n \"<sup>#{text}</sup>\"\n end\n end\n @re_help.rewrite_links input do |link, defi|\n # We don't add a description for images in links, because its\n # empty value forces the image to be inlined.\n defi ||= link unless link =~ @re_help.org_image_file_regexp\n link = link.gsub(/ /, \"%%20\")\n\n if defi =~ @re_help.org_image_file_regexp\n \"\"\n elsif defi\n \"[#{defi}](#{link})\"\n else\n \"[#{link}](#{link})\"\n end\n end\n\n # Just reuse Textile special symbols for now?\n Orgmode.special_symbols_to_textile(input)\n input = @re_help.restore_code_snippets input\n input\n end",
"def render(no_follow = false)\n sanitize = no_follow ?\n @wiki.history_sanitizer :\n @wiki.sanitizer\n\n data = extract_tex(@data.dup)\n data = extract_code(data)\n data = extract_tags(data)\n begin\n data = GitHub::Markup.render(@name, data)\n if data.nil?\n raise \"There was an error converting #{@name} to HTML.\"\n end\n rescue Object => e\n data = %{<p class=\"gollum-error\">#{e.message}</p>}\n end\n data = process_tags(data)\n data = process_code(data)\n if sanitize || block_given?\n doc = Nokogiri::HTML::DocumentFragment.parse(data)\n doc = sanitize.clean_node!(doc) if sanitize\n yield doc if block_given?\n data = doc_to_html(doc)\n end\n data = process_tex(data)\n data.gsub!(/<p><\\/p>/, '')\n data\n end",
"def conv_markup(txt, prefix, linelen)\n\n # this code assumes that tags are not used inside tags\n pos = 0\n old_pos = 0\n style = STYLE_NORMAL\n current_indent = prefix.size\n while pos = txt.index(%r{(<tt>|<code>|<b>|<em>|</tt>|</code>|</b>|</em>)}, old_pos)\n new_part = txt[old_pos...pos]\n @proc.call(new_part, style)\n\n # get tag name\n old_pos = txt.index(\">\", pos) + 1\n style = case txt[(pos+1)...(old_pos-1)]\n when \"tt\"\n STYLE_TELETYPE\n when \"code\"\n STYLE_CODE\n when \"b\"\n STYLE_BOLD\n when \"em\"\n STYLE_EMPHASIS\n else\n # closing or unknown tags\n STYLE_NORMAL\n end\n end\n @proc.call(txt[old_pos...txt.size], style)\n @proc.call(\"\\n\")\n end",
"def build_html\n # the first one should not use a locale, for the default:\n generate_all_html_pages\n\n # now translate, if necessary:\n if translation.should_translate?\n translation.prepare\n translation.available_locales.each do |locale|\n translation.current_locale = locale\n generate_all_html_pages\n end\n end\n end"
] | [
"0.70379156",
"0.69220823",
"0.68515563",
"0.66325426",
"0.65912336",
"0.6540873",
"0.65322465",
"0.6487623",
"0.6483732",
"0.6466318",
"0.64222157",
"0.64067423",
"0.6392053",
"0.63866705",
"0.63852215",
"0.62836677",
"0.6237739",
"0.61745656",
"0.6155622",
"0.6147576",
"0.61435914",
"0.6138747",
"0.61345714",
"0.6129906",
"0.6123034",
"0.6122113",
"0.6121803",
"0.6109349",
"0.6104802",
"0.60962594",
"0.6081954",
"0.6081954",
"0.6081954",
"0.6081954",
"0.60688525",
"0.6048902",
"0.6029124",
"0.6025464",
"0.6023998",
"0.6022893",
"0.6011729",
"0.5996075",
"0.5996075",
"0.5990181",
"0.59844124",
"0.59840095",
"0.59795505",
"0.59795505",
"0.59795505",
"0.59795505",
"0.5952566",
"0.59525615",
"0.5949761",
"0.59397286",
"0.59266436",
"0.5923096",
"0.5917828",
"0.5917828",
"0.5913286",
"0.5905769",
"0.58985335",
"0.5895704",
"0.5888072",
"0.5858454",
"0.5857763",
"0.58548003",
"0.58508366",
"0.5833235",
"0.58330774",
"0.58330774",
"0.58266187",
"0.5822391",
"0.5821941",
"0.5821498",
"0.5805883",
"0.580525",
"0.5792756",
"0.5783659",
"0.57823586",
"0.5779968",
"0.57721186",
"0.576654",
"0.5765865",
"0.57598716",
"0.57580966",
"0.57580966",
"0.5752689",
"0.5752423",
"0.5751731",
"0.57437813",
"0.57375026",
"0.57316196",
"0.57272774",
"0.57228273",
"0.57228273",
"0.5721841",
"0.57172537",
"0.5694058",
"0.5693434",
"0.56919"
] | 0.6401807 | 12 |
Save output to the output file (one paragraph per line). Include additional HTML and CSS if attr additional_html = true | def save_to_file
File.open(@output, 'w+') do |file|
file.puts HEADER if @additional_html
file.puts @data_for_output.join("\n")
file.puts FOOTER if @additional_html
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_file\n\t\tFile.open(@output, \"w+\") do |file|\n\t\t\tfile.puts \"[b][align=center]\"\n\t\t\trandomize if @random\n\t\t\t@output_data.each_line { |line| line.delete('\\n') }\n\t\t\tfile.puts @output_data\n\t\t\tfile.puts \"[/align][/b][align=center][sup]Made with [user]kryszanek[/user]'s [url=http://github.com/kryszan/cloudy]cloudy[/url]\\\\m/ [/sup][/align]\"\n\t\tend\n\tend",
"def save(path)\n File.open(path, \"w\") { |outfile| outfile.print self.render }\n end",
"def write_output_file(output_file, body)\n File.open(output_file, 'w:UTF-8') do |file|\n file.puts $HTML_header\n file.puts body\n file.puts $HTML_footer\n end\nend",
"def save_output\n\n end",
"def output(contents, filename = \"output.html\")\n out_file = File.new(filename, \"w\")\n out_file.puts(contents)\n out_file.close\n end",
"def write_file\n\n File.open(\"rebuild.html\", \"w\") do |file|\n @write_array.each do |tags_and_text|\n file.write tags_and_text\n end\n end\n\n end",
"def write_to_html filename = \"#{title}.html\", options = {}\n File.open(filename, \"w\") { |f| f.write(to_html(options)) }\n filename\n end",
"def write\n filename = \"#{@directory}/label.html\"\n File.open(filename, 'w') do |fp|\n fp.puts(self.to_s)\n end\n puts \"Wrote #{filename}\"\n end",
"def write_html_to(io, options = {})\n write_format_to SaveOptions::DEFAULT_HTML, io, options\n end",
"def write(data)\n begin\n File.open(@filename, \"w\") { |file| file.puts data.to_html }\n rescue \n puts \"Error: \" + $!.to_s\n end \n end",
"def save\n receipt = File.new(@save_path, 'w')\n receipt.write(render)\n receipt.close\n end",
"def saveFile(filename)\n\t\tpretty = JSON.pretty_generate(filename)\n\t\tpretty_clean = Sanitize.clean(pretty)\n\t\tpretty_clean = pretty_clean.gsub(' \\n', \" <br/>\" )\n\t\tpretty_clean = pretty_clean.gsub(',', \" <br/> \")\n\t\tpretty_clean = pretty_clean.gsub('\"', \" <br/> \")\n\n\t\tFile.open(\"output.txt\", \"w\") do |f|\n\t\tf.write(pretty_clean)\n\tend\nend",
"def save\n save_to_file(@output_file, @contents)\n end",
"def output_report\n report = \"\"\n report << '<html>'\n report << ' <head>'\n report << \" <title>#{@title}</title>\"\n report << ' </head>'\n report << ' <body>'\n @text.each { |line| report << \" <p>#{line}</p>\" }\n report << ' </body>'\n report << '</html>'\n end",
"def to_html_file(path)\n J2R.to_file(path, html_output)\n end",
"def write_html_file(name, type, html)\n if ENV['WRITE_HTML_FILE'] != 'false'\n file_name = \"#{File.dirname(__FILE__)}/results/#{name.gsub('.xml', '')}-#{Time.now.strftime(\"%d%b\")}_#{type}.html\"\n file = File.open(file_name, 'w+')\n file.puts html\n file.close\n end\nend",
"def add_html_output_options(opt)\n end",
"def output()\n add_newline if @linebreak\n @text\n end",
"def write!\n # 1. skip if file already exists.\n if output_file_already_exists?\n RSpec::Scaffold.log(\"- #{@output_file} - already exists\", :puts)\n return\n end\n\n # 2. ensure parent directories exist\n FileUtils.makedirs(@output_file.parent)\n\n # 3. write to file\n File.open(@output_file, 'wb') do |f| # 'wb' originally\n f << @output_text\n end\n\n RSpec::Scaffold.log(\"+ #{@output_file}\")\n\n return @output_file.to_s\n end",
"def saveScreenHTML(filepath)\n File.open(filepath, 'w') do |f|\n f.write @browser.html\n end\n end",
"def write(out=nil)\n out ||= project.path(:output, path)\n FileUtils.mkdir_p File.dirname(out)\n\n if tilt?\n File.open(out, 'w') { |f| f.write to_html({}, :build => true) }\n else\n FileUtils.cp file, out\n end\n end",
"def save_plagiarism_html(match_link, html)\n File.open(path_to_plagarism_html(match_link), 'w') do |out_file|\n out_file.puts html\n end\n end",
"def write_file\n \n # if dirty?\n generate\n \n delete_file\n File.open(absolute_path.gsub(/\\.txt$/, \"\"), 'w+') do |f| \n f.write(generated_header)\n f.write(generated_content)\n end\n # not_dirty\n # end\n end",
"def generate_html(individual_files=false)\n return self.to_s\n end",
"def generate_html(individual_files=false)\n return self.to_s\n end",
"def write_the_html_file(mdpath, name)\n DbgMgr.put \"out_html\", \"writing #{name}html\"\n file = File.join @doc, (name + \"html\")\n VersionedFile.new_version file, true, bak: @doc_bak, keep: @keep\n cmd = \"pandoc -p -s -S -f markdown -t html5 --toc --toc-depth=4 \" +\n \"--self-contained --css #{@css} -o #{file} #{mdpath}\"\n DbgMgr.put \"out_html\", cmd\n output = %x[#{cmd}]\n [$?.exitstatus, output]\n\n end",
"def output_to_file\n @output=:file\n end",
"def update_file\n output = (@blocks[:before] + @blocks[:attributes] + @blocks[:after]).join(\"\\n\").strip + \"\\n\"\n File.open(@filename,'w') { |f| f.write(output) } if output != @file\n end",
"def write\n path = \"#{site.root}/_site/#{output_file}\"\n File.open(path, 'w') do |f|\n f.write(@output)\n end\n end",
"def output(filename)\r\n outs = File.new(filename , \"w\")\r\n outs.puts self.to_s\r\n outs.close\r\n end",
"def save\n File.open(@test_name, \"w+\") do |file|\n file.write(render)\n end\n end",
"def save!\n Powirb.log.debug(\"[#{wid}] saving on #{@filename}\")\n File.open(@filename, 'w+') {|io| io.puts @doc}\n end",
"def save!\n begin\n case filename\n when STDOUT_FLAG\n $stdout.write(contents)\n else\n ::File.open(@filename,\"w\") do |f|\n f.write(contents)\n end\n end\n @dirty = false\n rescue => e\n raise FileAccessError, \"Error saving file #{@filename} : #{e.message}\"\n end\n end",
"def output_html\n path = ask_path('.html')\n path ? @report.to_html_file(path) : 'Annulé'\n end",
"def create_page\n @outfile.puts <<'EOF'\n<!DOCTYPE html>\n<html>\n <head>\n <title>Fun Fun Fun</title>\n <meta charset=\"utf-8\">\nEOF\n\n include_stylesheets\n include_javascript\n add_data(@batch)\n @outfile.puts <<'EOF'\n </head>\n <body>\n <svg class=\"chart\">\n </svg>\n </body>\n</html>\nEOF\n end",
"def render\n File.open(@file.output_path, \"w\") { |file| file.write(super) }\n end",
"def output \n\tFile.open(\"#{@file_out}\", \"w+\") do |f|\n\t f.puts \"#{@encrypted_text}\"\n\tend \nend",
"def save\n render unless result\n if File.exist?(output)\n mode = File.stat(output).mode\n File.chmod(mode | 0000220, output)\n File.open(output, 'w'){ |f| f << result }\n File.chmod(mode, output)\n else\n File.open(output, 'w'){ |f| f << result }\n File.chmod(0440, output) # change to read-only mode\n end\n end",
"def print_html(filename = @event.printed_name)\n confirm_filename(filename)\n filename << \"_html.txt\"\n File.open(filename, \"w+\") do |file|\n file.write EventPrinter::HTML::head(@event.printed_name)\n @list.map do |elt|\n file.write elt.html\n end\n file.write EventPrinter::HTML::foot\n end\n end",
"def output(filename)\n @output = \" #{filename}\"\n end",
"def write_footer\n @openfile.write(\"\\n</Document>\\n</kml>\")\n end",
"def write\n Vedeu::Output.render(rendered)\n end",
"def save_as(name)\n File.open(name, \"wb\") { |f| f.write self.render }\n end",
"def print_to_output(text)\n if Object.const_defined?('Shamus')\n asset = Shamus.current.current_step.add_inline_asset('.txt', Shamus::Cucumber::InlineAssets::RENDER_AS_TEXT)\n File.open(asset, 'w') { |f| f.puts(\"#{text}\") }\n else\n puts \"#{text}\"\n end\n end",
"def write_html_to(io, options = T.unsafe(nil)); end",
"def write_html_to(io, options = T.unsafe(nil)); end",
"def output_report\n\t\toutput_start\n\t\toutput_head\n\t\toutput_body_start\n\t\toutput_body\n\t\toutput_body_end\n\t\toutput_end\n\tend",
"def saveTextOutput(iter, tosave, width, height, divisions)\n\tfileName = \"output\" + iter.to_s + \".txt\"\n\tif not File.exists?(fileName) \n\t\tsaveText = 'Generated area of size ' + width.to_s + ' x ' + height.to_s + ' with ' + divisions.to_s + \" divisions.\\n\"\n\t\tsaveFile = File.new(fileName, \"w\")\n\t\tfor y in 0..height \n\t\t\tfor x in 0..width \n\t\t\t\tsaveText = saveText + tosave[x][y]\n\t\t\tend \n\t\t\tsaveText = saveText + \"\\n\"\n\t\tend\n\t\tsaveFile.syswrite(saveText)\n\telse \n\t\tsaveTextOutput(iter + 1, tosave, width, height, divisions)\n\tend\nend",
"def save_page(file_name = nil)\r\n file_name ||= Time.now.strftime(\"%Y%m%d%H%M%S\") + \".html\"\r\n puts \"about to save page: #{File.expand_path(file_name)}\" if $DEBUG\r\n File.open(file_name, \"w\").puts page_source\r\n end",
"def save(file=nil)\n file = file || path \n text = format.render(number)\n ::File.open(file, 'w'){ |f| f << text }\n end",
"def output_file\n @output\n end",
"def write_it( output_file, final_content )\n File.open(output_file, \"w\") {|f| f.write( final_content ) }\n end",
"def dumpAsHTML\n\t\treturn \"File is Binary: Not dumped here.\"\n\tend",
"def save_as(filename)\n document.render_file(filename)\n end",
"def to_file( filename )\n File.open(filename, 'w') do |f|\n f.puts self.header\n @body.each do |section|\n f.puts section\n end\n f.puts self.footer\n end\n end",
"def files_to_page\n insert_to_page('div', html)\n insert_to_page('script', js, false)\n insert_to_page('style', style, false)\n end",
"def to_html\n html = ''\n text_runs.each do |text_run|\n html << text_run.to_html\n end\n styles = {}\n #styles = { 'font-size' => \"#{font_size}pt\" }\n styles['text-align'] = @alignment if @alignment\n html_tag(:p, content: html, styles: styles)\n end",
"def create_output_file(content)\n\t\t\tf = File.new(@params[:output_file], 'w')\n\t\t\tf << content\n\t\t\tf.close\n\t\tend",
"def write_spec_to_file!\n formatted_output = format_output(output, extension)\n abs_path = File.join(write_path, suggested_filename)\n\n assert_directory_exists!(abs_path)\n write_method.call(abs_path, formatted_output)\n end",
"def save_to_file\n File.open(\"results/#{seq_name}\"+\".txt\", 'w') { |file|\n \n n=1\n \n @actions.each do |a|\n file.puts a.description\n n +=1 \n end\n } \n \n end",
"def create_mark_output_file(mark_output_file_path)\n # Write test output contents to file.\n File.open(mark_output_file_path, \"w+\") do |file|\n # file.write(collect_mark_file_content)\n\n file.puts(collect_mark_file_content)\n end\n end",
"def to_html\r\n html = ''\r\n text_runs.each { |text_run| html << text_run.to_html }\r\n styles = {}\r\n styles['font-size'] = \"#{font_size}pt\" unless font_size.nil?\r\n styles['text-align'] = @style.text_align unless @style.aligned_left?\r\n html_tag(:p, content: html, styles: styles)\r\n end",
"def save_thank_you_letters(id, form_letter)\n Dir.mkdir(\"output\") unless Dir.exists? \"output\"\n\n filename = \"output/thanks_#{id}.html\"\n\n File.open(filename, 'w') do |file|\n file.puts form_letter\n end\nend",
"def to_html(options = {})\n to_format SaveOptions::DEFAULT_HTML, options\n end",
"def create_summary\r\n puts \"Creating a summary...\"\r\n #@lists.disp_summary\r\n create_html_summary\r\n file = File.open('test.html','w')\r\n file << @html\r\n file.close\r\n end",
"def write(f)\n f.puts \"Version: \" + VERSION\n f.puts \"Label: #{@label}\"\n f.puts \"Host: #{@host}\"\n f.puts \"Dir: #{@dir}\"\n f.puts \"Prune: \" + (@prune_leading_dir ? \"true\" : \"false\")\n f.puts\n super(f)\n end",
"def output_file(type)\n if (type == :html)\n \"#{DirMap.public}#{News.public_path}/#{self.filename}.html\"\n else\n \"#{DirMap.public}#{News.public_path}/#{self.filename}.html\"\n end\n end",
"def export_html(path=\"./plot.html\")\n path = File.expand_path(path, Dir::pwd)\n str = generate_html\n File.write(path, str)\n end",
"def save\n require 'yaml'\n File.open(output_file, 'w') { |f| f.puts(generate.to_yaml) }\n end",
"def write(options=nil)\n temp_options(options) if options\n\n @fingerprint = file_fingerprint\n @file = output_file\n\n js = \"/* Build fingerprint: #{@fingerprint} */\\n\" + compile\n\n if has_fingerprint(@file, @fingerprint)\n info \"Stitch \" + \"identical \".green + @file.sub(\"#{Dir.pwd}/\", '')\n reset_options if options\n true\n else\n begin\n write_msg = (File.exists?(@file) ? \"overwrite \" : \"created \").yellow + @file.sub(\"#{Dir.pwd}/\", '')\n cleanup(@file) if @options[:cleanup]\n\n FileUtils.mkdir_p(File.dirname(@file))\n File.open(@file, 'w') { |f| f.write js }\n\n info \"Stitch \" + write_msg\n true\n rescue StandardError => e\n error \"Stitch failed to write #{@file.sub(\"#{Dir.pwd}/\", '')}\".red\n error e\n reset_options if options\n false\n end\n end\n\n end",
"def output_to_file (products_hash, brands_hash)\n\t_sales_report_header\n\t_products_header\n\tproducts_section(products_hash)\n\tend_of_section\n\t_brands_header\n\tbrands_section(brands_hash)\n\tend_of_section\n\t$report_file.puts 'THIS REPORT HAS BEEN CREATED BY MROHDE'\nend",
"def html_out(*args, &block)\n self.html_out_proc = block\n self.html_out_args = args\n end",
"def to_textile\n \n \n headings(@workingcopy)\n structure(@workingcopy)\n text_formatting(@workingcopy)\n entities(@workingcopy)\n tables(@workingcopy)\n @workingcopy = CGI::unescapeHTML(@workingcopy)\n @workingcopy\n \n end",
"def create_output(descriptions)\n# render view which will create actual mail report\n body = DcApplicationController.new.render_to_string(\n :template => 'models/dump_models',\n :locals => { descriptions: descriptions },\n :layout => 'models' \n ) \n File.open(Rails.root.join('public','models_dump.html'),'w') {|f| f.write(body)}\n#\n body = ''\n descriptions.each do |description|\n collection = description.first\n all_fields = description.last \n body << \"#\\n# == Schema information\\n#\\n\"\n body << \"# Collection name: #{collection['id']} : #{collection['description']}\\n#\\n\"\n \n all_fields.each do |field|\n body << \"# #{field['field'].ljust(20)} #{field['type'].to_s.ljust(20)} #{field['description']}\\n\"\n end\n body << \"\\n\\n\"\n end \n File.open(Rails.root.join('public','description_dump.html'),'w') {|f| f.write(body)}\nend",
"def to_html\n render_file(main)\n end",
"def save(filename=@filename)\n backup_filename = filename + '~'\n File.delete(backup_filename) if File.exist? backup_filename\n FileUtils.mv(filename, backup_filename)\n File.open(filename, 'w') do |f|\n f.puts @header\n f.puts @body\n f.puts @gem_dependencies\n f.puts @dev_dependencies\n f.puts @footer\n end\n end",
"def output\n super(@file_format => @file_path)\n end",
"def write_contents(options={})\n File.write(path('epub/OEBPS/content.opf'), content_opf(options))\n end",
"def send_doc\n if EdiHelper.current_out_is_cumulative\n File.open(File.join(EdiHelper.edi_out_process_join_dir, EdiHelper.current_out_subdirs, @filename), 'w') {|f| f.puts @edi_string }\n else\n File.open(File.join(EdiHelper.edi_out_process_dir, EdiHelper.current_out_subdirs, @filename), 'w') {|f| f.puts @edi_string }\n end\n end",
"def dump_content_to_file_debug_html( content )\n\n return content unless logger.level == Logger::DEBUG\n\n outname = \"#{@name}.debug.html\"\n\n puts \" Dumping content before html post processing to #{outname}...\"\n\n File.open( outname, 'w' ) do |f|\n f.write( content )\t\n end\n\n content\nend",
"def before_save\n\t\tself.html = RedCloth.new(self.text).to_html\n\tend",
"def save_html(directory_path, file_name, body, charset)\n # Starting directory path must public path(Rails.public_path) for security\n public_and_under_directory_path = \"#{Rails.public_path}/#{directory_path}\"\n directory_full_path = \"#{Rails.public_path}/#{directory_path}/#{file_name}\"\n\n if FileTest.exist?(public_and_under_directory_path)\n body.force_encoding(charset) if charset # For 2 byte chars.\n File.open(directory_full_path, \"w\") do |f|\n f.puts( body.gsub(/\\r\\n|\\r|\\n|\\t/, '') ) # Get response data with deleted empty lines).\n end\n end\n end",
"def to_file(filename)\n File.open(filename, 'w') do |f|\n f.puts self.header\n @body.each { |section| f.puts section }\n f.puts self.footer\n end\n end",
"def write(output, indent); end",
"def write_txt\n true\n end",
"def run\n print_line\n print_status 'Creating HTML report...'\n\n plugins = format_plugin_results( auditstore.plugins )\n @base_path = File.dirname( options['tpl'] ) + '/' +\n File.basename( options['tpl'], '.erb' ) + '/'\n\n title_url = auditstore.options['url']\n begin\n title_url = uri_parse( auditstore.options['url'] ).host\n rescue\n end\n\n params = prepare_data.merge(\n title_url: escapeHTML( title_url ),\n audit_store: auditstore,\n plugins: plugins,\n base_path: @base_path\n )\n\n File.open( outfile, 'w' ) { |f| f.write( erb( options['tpl'], params ) ) }\n\n print_status \"Saved in '#{outfile}'.\"\n end",
"def save_thank_you_letters(id,form_letter)\n Dir.mkdir(\"output\") unless Dir.exists?(\"output\")\n filename = \"output/thanks_#{id}.html\"\n File.open(filename,'w') do |file|\n file.puts form_letter\n end\nend",
"def exportCompleteFile()\r\n completeFileName = @outputDir.join(\"index.html\")\r\n completeFile = HtmlOutputFile.new(completeFileName, @options[:title])\r\n @options[:log].begin(\"Exporting chat to \\\"#{completeFileName.to_s}\\\"\")\r\n\r\n if @options[:title]\r\n htmlTitle = uniToHtml(@options[:title])\r\n completeFile.puts(\"<h1>#{htmlTitle}</h1>\")\r\n end\r\n\r\n years = @messages.getYears()\r\n years.each { |year|\r\n exportAnnualContent(completeFile, year)\r\n }\r\n\r\n completeFile.close()\r\n @options[:log].end()\r\n end",
"def render(context)\n # super is the input\n file = Tempfile.new('')\n file.write(super)\n file.close # close temp file; flush content\n output = `/Users/pushpendrerastogi/Dropbox/se4u_github_io/_plugins/org2html.py #{file.path}`\n file.unlink # Delete temp file\n output\n end",
"def log(person)\n @file << person.to_markdown\n @file << \"\\n\\n\"\n end",
"def save_content(title, content)\n\tFile.open(\"pages/#{title}.txt\" , \"w\") do |file|\n\t file.print(content)\n end \t\t\nend",
"def save_as_xhtml document, filename\n @document = document\n remove_remaining_tags\n FileWriter.write document.to_html, get_full_path(filename.force_html_extension)\n end",
"def create_display_template_file(directory)\n html = %{<!-- Template File -->\\n\n<div class=\"myWidget\">Hello World</div>}\n\n File.open(directory, \"w\") do |f|\n f.write(html)\n end\n end",
"def page_output\n stdout = STDOUT.clone\n\n less = open(\"|less\", \"w\")\n STDOUT.reopen(less)\n\n at_exit do\n STDOUT.reopen(stdout)\n less.close\n end\nend",
"def save(file_name)\n\t\tsvg = File.new(file_name, \"w\")\n\t\tsvg.puts(doc.to_html)\n\t\tsvg.close\n\tend",
"def modify_file\n file_path = \"./app/views/hocr_files/_p#{self.filename}_hocr.html\"\n file = File.open(file_path, \"r\")\n data = file.read\n data = self.replace_bbox(data)\n data = self.add_image(data)\n File.open(file_path, 'w') {|f| f.write(data) }\n end",
"def output_ext; end",
"def output_ext; end",
"def output_ext; end",
"def dump_page( output_file = ENV['HOME'] + '/Desktop/a.htm' )\n File.write( output_file, agent.page.body )\n end"
] | [
"0.69958144",
"0.6527814",
"0.651571",
"0.64858437",
"0.6472231",
"0.6387234",
"0.6373998",
"0.6227278",
"0.6227233",
"0.6194358",
"0.61680895",
"0.61304563",
"0.61276233",
"0.6038381",
"0.6024614",
"0.6015311",
"0.59880507",
"0.5960089",
"0.59393054",
"0.5933858",
"0.5930584",
"0.59278435",
"0.5927734",
"0.5908856",
"0.5908856",
"0.5889455",
"0.58837277",
"0.5879286",
"0.58663017",
"0.5841156",
"0.5834047",
"0.5825268",
"0.5821684",
"0.58108",
"0.5809758",
"0.57668585",
"0.5754233",
"0.57304233",
"0.5730309",
"0.5725405",
"0.5723635",
"0.56964874",
"0.56675947",
"0.5663112",
"0.5662245",
"0.5662245",
"0.56552786",
"0.56333494",
"0.56125337",
"0.5604149",
"0.56030715",
"0.558971",
"0.55850977",
"0.5583323",
"0.5570673",
"0.55313694",
"0.5530641",
"0.5526658",
"0.5520359",
"0.5520056",
"0.5519133",
"0.5516683",
"0.5511652",
"0.5502997",
"0.550216",
"0.55007154",
"0.549936",
"0.5496619",
"0.5495414",
"0.54925567",
"0.5484604",
"0.5484377",
"0.54813623",
"0.54799336",
"0.5477335",
"0.54746723",
"0.54672205",
"0.54668",
"0.5466125",
"0.5463108",
"0.5460288",
"0.5457004",
"0.5453239",
"0.5450017",
"0.5448398",
"0.5447009",
"0.5444112",
"0.5432843",
"0.5418405",
"0.5411779",
"0.5409675",
"0.54082936",
"0.5407713",
"0.5407139",
"0.5392248",
"0.53870517",
"0.5378698",
"0.5378698",
"0.5378698",
"0.5376069"
] | 0.7856954 | 0 |
GET /participants GET /participants.xml | def index
scan_procedure_array = (current_user.view_low_scan_procedure_array).split(' ').map(&:to_i)
hide_date_flag_array = (current_user.hide_date_flag_array).split(' ').map(&:to_i)
@hide_page_flag = 'N'
if hide_date_flag_array.count > 0
@hide_page_flag = 'Y'
end
# @search = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_visit_memberships.enrollment_id from enrollment_visit_memberships where enrollment_visit_memberships.visit_id in
# (select visit_id from scan_procedures_visits where scan_procedure_id in (?)))) ", scan_procedure_array).search(params[:search])
# @search = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_visit_memberships.enrollment_id
# from enrollment_visit_memberships, scan_procedures_visits
# where enrollment_visit_memberships.visit_id = scan_procedures_visits.visit_id and scan_procedures_visits.scan_procedure_id in (?))) ", scan_procedure_array).search(params[:search])
@search = Participant.where(" participants.id in ( select participant_id from enrollments,enrollment_vgroup_memberships, scan_procedures_vgroups
where enrollments.id = enrollment_vgroup_memberships.enrollment_id
and enrollment_vgroup_memberships.vgroup_id = scan_procedures_vgroups.vgroup_id and scan_procedures_vgroups.scan_procedure_id in (?)) ", scan_procedure_array).search(params[:search])
@participants = @search.relation.page(params[:page])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @participants }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def index\n @participants = Participant.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.xml { render :xml => @participants }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def get_participants(id, params = {})\n get \"/api/v2/projects/#{id}/participants\", params\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def get_conversation_participants(id)\n @client.raw('get', \"/content/conversations/#{id}/participants\")\n end",
"def get_participants\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n\n if user != nil and meeting != nil\n users = meeting.participants\n send_json(users)\n else\n send_error 401\n end\n end",
"def tournaments\n get('sports/en/tournaments.xml')\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def show\n @user = User.find_by_name(params[:name])\n @participants = Participant.find_all_by_user_id(@user.id).paginate(:page => params[:page], :per_page => 5)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @participant }\r\n end\r\n end",
"def index\n @transaction_participants = Transaction::Participant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transaction_participants }\n end\n end",
"def get_conversation_participants(id)\r\n #TODO: Test if this method needs data in options.\r\n @client.raw('get', \"/content/conversations/#{id}/participants\", nil, nil, @contact_v1_url)\r\n end",
"def getParticipants\r\n\t\t\t\t\treturn @participants\r\n\t\t\t\tend",
"def participants( params={} )\n participants = get_connections(\"participants\", params)\n return map_connections participants, :to => Facebook::Graph::Generic\n end",
"def index\n @participants = Participant.paginate :all, :page => params[:page], :order => \"lastname ASC, firstname ASC\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def index\n @participants = Participant.paginate :all, :page => params[:page], :order => \"lastname ASC, firstname ASC\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def index\n\t\t@participants = Participant.all\n\n\t\trender json: @participants\n\tend",
"def show\n @transaction_participant = Transaction::Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction_participant }\n end\n end",
"def participants\n expose Challenge.participants(@oauth_token, params[:challenge_id].strip)\n end",
"def participants\n attributes['participants'] ||= []\n attributes['participants']\n end",
"def show\n @participant = Participant.find(params[:id])\n end",
"def get_all_participants(params = {})\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n res = call_api(:method => :get, :uri => @api_base.merge(\"room/#{room_id}/participant\"), :query_params => params)\n return unless res.successful?\n Users.new(res.data)\n end",
"def index\n @participants = @event.participants\n end",
"def show\n @call = Call.find(params[:id])\n @participants = @call.participants\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @call }\n end\n end",
"def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @partners.to_xml }\n end\n end",
"def index\n @participantes = Participante.all\n end",
"def show\n #head :status => 405\n #return\n \n @participant = Participant.find(params[:id])\n \n # debugging\n #@meeting = Meeting.find(@participant.meeting_id)\n #send_invitation\n\n respond_to do |format|\n format.html # show.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def index\n @tournaments = @resource_finder.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tournaments }\n end\n end",
"def show\n\t\trender json: @participant\n\tend",
"def participants\n recipients\n end",
"def index\n @activity_participants = Activity::Participant.all\n \n end",
"def participants\n return @participants\n end",
"def participants\n return @participants\n end",
"def followers\n @person = Person.find(params[:id]) \n @project = Project.find(params[:project_id])\n @persons = @person.get_all_followers\n \n respond_to do |format|\n format.html # followers.html.erb\n format.xml { render :xml => @persons }\n end\n \n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def index\n @participants = @current_event.participants rescue nil || []\n end",
"def list_participants request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_participants_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::Dialogflow::V2::ListParticipantsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def index\n @recipients = @user.recipients\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @recipients }\n end\n end",
"def index\n @participants = Participant.all\n redirect_to display_project_participants_path(params[:project_id])\n end",
"def members\n participants\n end",
"def members\n participants\n end",
"def show\n @participante = Participante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participante }\n end\n end",
"def show\n @participante = Participante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participante }\n end\n end",
"def participants\n return recipients\n end",
"def index\n @participant_contact_emails = Participant::Contact::Email.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participant_contact_emails }\n end\n end",
"def show\n @recipient = @user.recipients.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recipient }\n end\n end",
"def index\n unless ( params[:organization_id].blank? )\n @organization = Organization.find(params[:organization_id])\n @participants = @organization.participants\n else\n @participants = Participant.all\n end\n\n @participants = @participants.paginate(:page => params[:page]).per_page(20)\n end",
"def to_s\n '#<Twilio.Api.V2010.ParticipantList>'\n end",
"def participants=(value)\n @participants = value\n end",
"def participants=(value)\n @participants = value\n end",
"def index\n if params[:organization_id].blank?\n @participants = Participant.all\n else\n @organization = Organization.find(params[:organization_id])\n @participants = @organization.participants\n end\n\n # @participants = @participants.paginate(:page => params[:page]).per_page(20)\n end",
"def tournaments_info(tournament_id, tournament_type = 'sr:tournament')\n get(\"sports/en/tournaments/#{tournament_type}:#{tournament_id}/info.xml\")\n end",
"def index\n @search = get_participant_search_obj\n\n @participants = @search.result.not_dnd\n .page(params[:page] || 1) .per(10)\n .includes(pin_code: [:center])\n end",
"def participants\n participant_ids.blank? ? User.none : User.where(id: participant_ids)\n end",
"def index\n @participants = Participant.includes(:responses, :participant_test_cases).order(created_at: :desc)\n .paginate(:page => params[:page])\n end",
"def participants\n users.where(parent_id: parent_id || current_user_id).flat_map(&:participants)\n end",
"def get_safebox_participants(safebox_guid)\n handle_error { sendsecure_connection.get(\"api/v2/safeboxes/#{safebox_guid}/participants.json\") }\n end",
"def to_s\n '#<Twilio.Api.V2010.ParticipantList>'\n end",
"def new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @participant }\r\n end\r\n end",
"def show\n @game = Game.find(params[:game_id])\n @participant = Participant.find(params[:participant_id])\n respond_to do |format|\n format.html\n format.json { render json: @participant }\n end\n end",
"def former_participants( params={} )\n former_participants = get_connections(\"former_participants\", params)\n return map_connections former_participants, :to => Facebook::Graph::Generic\n end",
"def participants\n @participants ||= ParticipantSet.new\n end",
"def friends\n @person = Person.find(params[:id]) \n @project = Project.find(params[:project_id]) \n @persons = @person.get_all_friends\n \n respond_to do |format|\n format.html # friends.html.erb\n format.xml { render :xml => @persons }\n end\n \n end",
"def index\n @members = Member.members\n @participants = Member.participants\n @invited_count = Member.count\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def index\n @user = User.find(params[:user_id]) \n @invitations = @user.invitations\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\nend",
"def show\n @annex1_project_participant = Annex1ProjectParticipant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @annex1_project_participant }\n end\n end",
"def show\n @people = People.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def show\n @participant_contact_email = Participant::Contact::Email.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participant_contact_email }\n end\n end",
"def show\n redirect_to '/participants/new'\n end",
"def partners\n @users = User.get_users(:partner, @page)\n end",
"def participants # :nodoc:\n @participant_ids.map { |p| @context.users[p] }\n end",
"def show\n @memberships = @participant.memberships.all\n end",
"def participants_on_issue(project, id)\n get(\"/projects/#{url_encode project}/issues/#{id}/participants\")\n end",
"def deal_participants(id:, **args)\n params = parameters(args) do\n optional_params :start, :limit\n end\n request(:get, \"deals/#{id}/participants\", params)\n end",
"def past_meeting_participants(*args)\n options = Zoom::Params.new(Utils.extract_options!(args))\n options.require(%i[meeting_uuid])\n Utils.parse_response self.class.get(\"/past_meetings/#{options[:meeting_uuid]}/participants\", headers: request_headers)\n end",
"def index\n @leagueplayers = Leagueplayer.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @leagueplayers }\n end\n end",
"def index\n @subscribers = Subscriber.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscribers }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @teammembers }\n end\n end",
"def index\n @committeemembers = Committeemember.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @committeemembers }\n end\n end",
"def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end",
"def show\n @listener = Listener.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @listener }\n end\n end",
"def new\n head :status => 405\n return\n \n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def index\n # Find all participants that match search criteria.\n @participants = Participant.search(params[:search])\n # Export all member's information to a csv file.\n @exports = Participant.all\n respond_to do |format|\n format.html\n format.csv { send_data @exports.to_csv }\n end\n end",
"def get_challenge_event_participants_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ReportingChallengesApi.get_challenge_event_participants ...\"\n end\n # resource path\n local_var_path = \"/reporting/events/participants\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_event'] = opts[:'filter_event'] if !opts[:'filter_event'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].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 = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'PageResourceChallengeEventParticipantResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReportingChallengesApi#get_challenge_event_participants\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] | [
"0.75301546",
"0.75301546",
"0.75301546",
"0.7211292",
"0.71730536",
"0.69233406",
"0.68727845",
"0.67522633",
"0.6745673",
"0.67305",
"0.6725285",
"0.667992",
"0.667992",
"0.667992",
"0.667992",
"0.667992",
"0.667992",
"0.6631142",
"0.65574384",
"0.652753",
"0.6451678",
"0.6442563",
"0.6439247",
"0.63943267",
"0.63943267",
"0.6381723",
"0.6380802",
"0.6380802",
"0.6380802",
"0.6380802",
"0.6331869",
"0.6260059",
"0.6248497",
"0.62427664",
"0.62034255",
"0.61928505",
"0.6164549",
"0.6149722",
"0.61331886",
"0.60962677",
"0.6091683",
"0.6084973",
"0.6083599",
"0.6082113",
"0.60403365",
"0.60156566",
"0.60156566",
"0.5942253",
"0.5941544",
"0.59339356",
"0.59278256",
"0.5924381",
"0.5924381",
"0.5924381",
"0.5920334",
"0.59085554",
"0.5892167",
"0.5892167",
"0.587904",
"0.587904",
"0.5870401",
"0.58415264",
"0.5840317",
"0.5818738",
"0.57902634",
"0.57886744",
"0.57886744",
"0.5784781",
"0.57838434",
"0.5782783",
"0.5773401",
"0.5768093",
"0.57622945",
"0.576044",
"0.57603765",
"0.5727534",
"0.5722152",
"0.57089144",
"0.56877685",
"0.56818736",
"0.56787074",
"0.5672661",
"0.5669387",
"0.5666944",
"0.56655467",
"0.563863",
"0.5636658",
"0.56361586",
"0.56314266",
"0.56265086",
"0.56190133",
"0.56166524",
"0.5598869",
"0.5593986",
"0.55920833",
"0.55895644",
"0.5580437",
"0.55726814",
"0.5569593",
"0.55578643",
"0.55501634"
] | 0.0 | -1 |
GET /participants/1 GET /participants/1.xml | def show
scan_procedure_array = (current_user.view_low_scan_procedure_array).split(' ').map(&:to_i)
hide_date_flag_array = (current_user.hide_date_flag_array).split(' ').map(&:to_i)
@hide_page_flag = 'N'
if hide_date_flag_array.count > 0
@hide_page_flag = 'Y'
end
# @participant = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_visit_memberships.enrollment_id from enrollment_visit_memberships where enrollment_visit_memberships.visit_id in
# (select visit_id from scan_procedures_visits where scan_procedure_id in (?)))) ", scan_procedure_array).find(params[:id])
@participants = Participant.where("participants.id in ( select vgroups.participant_id from vgroups, scan_procedures_vgroups where vgroups.id = scan_procedures_vgroups.vgroup_id
and vgroups.participant_id in (?) and scan_procedures_vgroups.scan_procedure_id in (?)) ", params[:id],scan_procedure_array)
if(@participants.blank?)
@participants = Participant.where("participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_vgroup_memberships.enrollment_id from enrollment_vgroup_memberships, scan_procedures_vgroups
where enrollment_vgroup_memberships.vgroup_id = scan_procedures_vgroups.vgroup_id and scan_procedures_vgroups.scan_procedure_id in (?)))",scan_procedure_array)
end
# problems if no vgroup or enumber -- no way to link to scan procedure and access control
@participant = @participants.find(params[:id])
@vgroups = Vgroup.where("participant_id in ( select participant_id from enrollments where participant_id = ? and enrollments.id in (select enrollment_vgroup_memberships.enrollment_id from enrollment_vgroup_memberships, scan_procedures_vgroups
where enrollment_vgroup_memberships.vgroup_id = scan_procedures_vgroups.vgroup_id and scan_procedures_vgroups.scan_procedure_id in (?))) ", params[:id],scan_procedure_array)
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @participant }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def index\n @participants = Participant.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.xml { render :xml => @participants }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def show\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @participant }\r\n end\r\n end",
"def show\n @user = User.find_by_name(params[:name])\n @participants = Participant.find_all_by_user_id(@user.id).paginate(:page => params[:page], :per_page => 5)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def get_participants(id, params = {})\n get \"/api/v2/projects/#{id}/participants\", params\n end",
"def show\n @transaction_participant = Transaction::Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction_participant }\n end\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def index\n @transaction_participants = Transaction::Participant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transaction_participants }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n end",
"def index\n @participants = Participant.paginate :all, :page => params[:page], :order => \"lastname ASC, firstname ASC\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def index\n @participants = Participant.paginate :all, :page => params[:page], :order => \"lastname ASC, firstname ASC\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def get_conversation_participants(id)\n @client.raw('get', \"/content/conversations/#{id}/participants\")\n end",
"def tournaments\n get('sports/en/tournaments.xml')\n end",
"def show\n #head :status => 405\n #return\n \n @participant = Participant.find(params[:id])\n \n # debugging\n #@meeting = Meeting.find(@participant.meeting_id)\n #send_invitation\n\n respond_to do |format|\n format.html # show.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def get_participants\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n\n if user != nil and meeting != nil\n users = meeting.participants\n send_json(users)\n else\n send_error 401\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def followers\n @person = Person.find(params[:id]) \n @project = Project.find(params[:project_id])\n @persons = @person.get_all_followers\n \n respond_to do |format|\n format.html # followers.html.erb\n format.xml { render :xml => @persons }\n end\n \n end",
"def show\n @recipient = @user.recipients.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recipient }\n end\n end",
"def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @partners.to_xml }\n end\n end",
"def show\n @call = Call.find(params[:id])\n @participants = @call.participants\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @call }\n end\n end",
"def get_conversation_participants(id)\r\n #TODO: Test if this method needs data in options.\r\n @client.raw('get', \"/content/conversations/#{id}/participants\", nil, nil, @contact_v1_url)\r\n end",
"def show\n @participante = Participante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participante }\n end\n end",
"def show\n @participante = Participante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participante }\n end\n end",
"def index\n @tournaments = @resource_finder.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tournaments }\n end\n end",
"def participants( params={} )\n participants = get_connections(\"participants\", params)\n return map_connections participants, :to => Facebook::Graph::Generic\n end",
"def new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @participant }\r\n end\r\n end",
"def index\n @activity_participants = Activity::Participant.all\n \n end",
"def friends\n @person = Person.find(params[:id]) \n @project = Project.find(params[:project_id]) \n @persons = @person.get_all_friends\n \n respond_to do |format|\n format.html # friends.html.erb\n format.xml { render :xml => @persons }\n end\n \n end",
"def index\n @recipients = @user.recipients\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @recipients }\n end\n end",
"def index\n\t\t@participants = Participant.all\n\n\t\trender json: @participants\n\tend",
"def show\n @annex1_project_participant = Annex1ProjectParticipant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @annex1_project_participant }\n end\n end",
"def show\n\t\trender json: @participant\n\tend",
"def show\n @participant_contact_email = Participant::Contact::Email.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participant_contact_email }\n end\n end",
"def getParticipants\r\n\t\t\t\t\treturn @participants\r\n\t\t\t\tend",
"def index\n @participantes = Participante.all\n end",
"def show\n @listener = Listener.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @listener }\n end\n end",
"def index\n @participants = @event.participants\n end",
"def show\n @people = People.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def new\n head :status => 405\n return\n \n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def index\n @participants = Participant.all\n redirect_to display_project_participants_path(params[:project_id])\n end",
"def index\n @user = User.find(params[:user_id]) \n @invitations = @user.invitations\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\nend",
"def show\n @game = Game.find(params[:game_id])\n @participant = Participant.find(params[:participant_id])\n respond_to do |format|\n format.html\n format.json { render json: @participant }\n end\n end",
"def get_all_participants(params = {})\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n res = call_api(:method => :get, :uri => @api_base.merge(\"room/#{room_id}/participant\"), :query_params => params)\n return unless res.successful?\n Users.new(res.data)\n end",
"def participants\n expose Challenge.participants(@oauth_token, params[:challenge_id].strip)\n end",
"def show\n @meeting = Meeting.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @person.to_xml }\n end\n end",
"def new\n @transaction_participant = Transaction::Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_participant }\n end\n end",
"def index\n @participant_contact_emails = Participant::Contact::Email.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participant_contact_emails }\n end\n end",
"def show\n @person = Person.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person.to_xml}\n end\n end",
"def show\n @reviewer = Reviewer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reviewer }\n end\n end",
"def tournaments_info(tournament_id, tournament_type = 'sr:tournament')\n get(\"sports/en/tournaments/#{tournament_type}:#{tournament_id}/info.xml\")\n end",
"def index\n unless ( params[:organization_id].blank? )\n @organization = Organization.find(params[:organization_id])\n @participants = @organization.participants\n else\n @participants = Participant.all\n end\n\n @participants = @participants.paginate(:page => params[:page]).per_page(20)\n end",
"def participants\n attributes['participants'] ||= []\n attributes['participants']\n end",
"def show\n @actor = Actor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @actor }\n end\n end",
"def index\n if params[:organization_id].blank?\n @participants = Participant.all\n else\n @organization = Organization.find(params[:organization_id])\n @participants = @organization.participants\n end\n\n # @participants = @participants.paginate(:page => params[:page]).per_page(20)\n end",
"def participants\n recipients\n end",
"def show\n redirect_to '/participants/new'\n end",
"def friends(id)\n friends_data(request(\"users/friends/#{id}.xml\", :auth => true))\n end",
"def show\n @partner_person = PartnerPerson.find(params[:id])\n @title = \"association partners <--> peoples\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @partner_person }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @teammembers }\n end\n end",
"def show\n @followership = Followership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @followership }\n end\n end",
"def show\n @invite_friend = InviteFriend.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @invite_friend.to_xml }\n end\n end",
"def show\n @who_member = WhoMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @who_member }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def show\n @user = @person.user\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @user.to_xml }\n end\n end",
"def show\n @tournament = @resource_finder.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tournament }\n end\n end",
"def show\n @person = Person.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def show\n @test_score = @participant.test_scores.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_score }\n end\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"def update\n debugger\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n if @participants.update_attributes(params[:participant])\n AuditTrail.audit(\"Participant #{@participants.fullname} updated by #{current_user.login}\", edit_participant_url(@participants))\n flash[:notice] = 'Participants was successfully updated.'\n format.html { redirect_to(participants_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participants.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def index\n @committeemembers = Committeemember.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @committeemembers }\n end\n end",
"def index\n @test_scores = @participant.test_scores.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @test_scores }\n end\n end",
"def index\n @subscribers = Subscriber.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscribers }\n end\n end",
"def show\n @counterparty = Counterparty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @counterparty }\n end\n end",
"def index\n # Find all participants that match search criteria.\n @participants = Participant.search(params[:search])\n # Export all member's information to a csv file.\n @exports = Participant.all\n respond_to do |format|\n format.html\n format.csv { send_data @exports.to_csv }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def index\n @participants = @current_event.participants rescue nil || []\n end",
"def show\n @leagueplayer = Leagueplayer.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @leagueplayer }\n end\n end"
] | [
"0.7610412",
"0.7610412",
"0.7610412",
"0.7206566",
"0.7199847",
"0.71683496",
"0.6933899",
"0.6729997",
"0.660732",
"0.66044706",
"0.65247947",
"0.64980125",
"0.64980125",
"0.64980125",
"0.64980125",
"0.64980125",
"0.64980125",
"0.6490464",
"0.6490464",
"0.6490464",
"0.6490464",
"0.6488974",
"0.6481295",
"0.64592546",
"0.64070475",
"0.64070475",
"0.6396715",
"0.63172126",
"0.62985665",
"0.6213688",
"0.6210485",
"0.6210485",
"0.6210485",
"0.6178059",
"0.6125324",
"0.61244386",
"0.6122851",
"0.611985",
"0.61099076",
"0.60784674",
"0.60784674",
"0.6010698",
"0.6009032",
"0.5959303",
"0.59396434",
"0.59370285",
"0.5930827",
"0.5929985",
"0.59186995",
"0.59133726",
"0.5906396",
"0.58983606",
"0.5893913",
"0.58774644",
"0.5855078",
"0.5854842",
"0.5848881",
"0.5826535",
"0.5825534",
"0.58232576",
"0.58225375",
"0.58219385",
"0.5816995",
"0.5810741",
"0.5798558",
"0.5788986",
"0.57880336",
"0.5781904",
"0.5762517",
"0.57581604",
"0.5753958",
"0.573191",
"0.57239527",
"0.5711996",
"0.5709421",
"0.5702282",
"0.5693786",
"0.5691904",
"0.56830233",
"0.5682916",
"0.5679919",
"0.5679919",
"0.5679919",
"0.5679919",
"0.56795865",
"0.5670069",
"0.5666016",
"0.5659922",
"0.56540245",
"0.5650808",
"0.5650696",
"0.5650696",
"0.5650696",
"0.56402177",
"0.5629598",
"0.56179833",
"0.5616534",
"0.56098145",
"0.56048787",
"0.56010866",
"0.5597601"
] | 0.0 | -1 |
GET /participants/new GET /participants/new.xml | def new
@participant = Participant.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @participant }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n head :status => 405\n return\n \n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @participant }\r\n end\r\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end",
"def new\n @transaction_participant = Transaction::Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_participant }\n end\n end",
"def new\n @participante = Participante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participante }\n end\n end",
"def new\n @participante = Participante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participante }\n end\n end",
"def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def new\n session[:operate_mode] = nil\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def create\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n AuditTrail.audit(\"Participant #{@participant.fullname} created by #{current_user.login}\", edit_participant_url(@participant))\n flash[:notice] = \"Participant #{@participant.fullname} was successfully created.\"\n # TODO: is this right? was new_user_path for this participant; test didn't match\n format.html { redirect_to participants_path }\n else\n flash[:error] = @participant.errors.full_messages.join(\", \")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n AuditTrail.audit(\"Participant #{@participant.fullname} created by #{current_user.login}\", edit_participant_url(@participant))\n flash[:notice] = \"Participant #{@participant.fullname} was successfully created.\"\n # TODO: is this right? was new_user_path for this participant; test didn't match\n format.html { redirect_to participants_path }\n else\n flash[:error] = @participant.errors.full_messages.join(\", \")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @person = Person.new\n @title = \"people\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @participant = Participant.new \n end",
"def new\n @participant = Participant.new \n end",
"def create\r\n respond_to do |format|\r\n if @participant.save\r\n format.html { redirect_to(@participant, :notice => 'Participant was successfully created.') }\r\n format.xml { render :xml => @participant, :status => :created, :location => @participant }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def new\n @participant = Participant.new\n end",
"def new\n @participant = Participant.new\n end",
"def new\n @participant = Participant.new\n end",
"def new\n @followership = Followership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @followership }\n end\n end",
"def new\n @tournament = @resource_finder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tournament }\n end\n end",
"def new\n @annex1_project_participant = Annex1ProjectParticipant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @annex1_project_participant }\n end\n end",
"def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end",
"def new\n @person = Person.new\n @person.names.new\n \n respond_to do |format|\n format.html { render :layout => \"main\" } # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def create\n @family = Family.find(params[:participant][:family]) rescue nil\n params[:participant][:family] = @family\n @participants = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participants.save\n AuditTrail.audit(\"Participant #{@participants.fullname} created by #{current_user.login}\", edit_participant_url(@participants))\n flash[:notice] = 'Participants was successfully created.'\n format.html { params[:commit] == 'Save' ? redirect_to(participants_path) : redirect_to(new_participant_path) }\n format.xml { render :xml => @participants, :status => :created, :location => @participants }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participants.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @counterparty = Counterparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @counterparty }\n end\n end",
"def new\n @volunteer = Volunteer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @volunteer }\n end\n end",
"def new\n @volunteer = Volunteer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @volunteer }\n end\n end",
"def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"def new\n @listener = Listener.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @listener }\n end\n end",
"def new\n\t\t@person = Person.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @person }\n\t\tend\n\tend",
"def new\n @partner_person = PartnerPerson.new\n @title = \"association partner <--> people\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partner_person }\n end\n end",
"def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @who_member = WhoMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @who_member }\n end\n end",
"def new\n @user = User.new\n get_list\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @user }\n end\n end",
"def new\n @personas = PersonaTeam.find(:all, :conditions => ['account_id = ?', session[:account_id]])\n @persona_team = PersonaTeam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @persona_team }\n end\n end",
"def new\n @election = Election.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @election }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @team }\n end\n end",
"def new\n @persona = Persona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @persona }\n end\n end",
"def new\n @conference = Conference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @conference }\n end\n end",
"def new\n @partyrelationship = Partyrelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partyrelationship }\n end\n end",
"def new\n @teammember = Teammember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @teammember }\n end\n end",
"def new\n @partner = Partner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partner }\n end\n end",
"def new\n @personal = Personal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @team }\n end\n end",
"def new\n @persona = Persona.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @persona }\n end\n end",
"def new\n @league = League.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @league }\n end\n end",
"def new\n @league = League.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @league }\n end\n end",
"def new\n @follower = Follower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @follower }\n end\n end",
"def new\n @team = Team.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @team }\n end\n end",
"def new\n @click_to_talk = ClickToTalk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @click_to_talk }\n end\n end",
"def new\n @game = Game.new\n @participants = Participant.find_all_by_meeting_id(@meeting.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @nickname = Nickname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nickname }\n end\n end",
"def new\n @participate = Participate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participate }\n end\n end",
"def new\n @relationship = Relationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relationship }\n end\n end",
"def new\n @reviewer = Reviewer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reviewer }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @online_retailer_user }\n end\n end",
"def new\n @participant_contact_email = Participant::Contact::Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant_contact_email }\n end\n end",
"def new\n @person = Person.new\n @project = Project.find(params[:project_id])\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def create\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to participants_url, notice: 'Participant was successfully created.' }\n format.json { render json: @participant, status: :created, location: @participant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n if get_login.nil? then\n raise 'only logged in users can create new leagues'\n end\n @league = League.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @league }\n end\n end",
"def new\n @volunteer = Volunteer.new\n @groups = Group.find(:all)\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @volunteer }\n end\n end",
"def new\n @nom = Nom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nom }\n end\n end",
"def new\n @participation = Participation.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participation }\n end\n end",
"def new\n @test_score = @participant.test_scores.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_score }\n end\n end",
"def new\n @recipient = Recipient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipient }\n end\n end",
"def new\n @recipient = Recipient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipient }\n end\n end",
"def new\n @proposed_person = ProposedPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proposed_person }\n end\n end",
"def new\n @telecom_room = TelecomRoom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @telecom_room }\n end\n end",
"def new\n @partytype = Partytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partytype }\n end\n end",
"def new_nonva_porca_pupazza\n @person= Person.new\n respond_to do |format|\n format.html\n format.xml { render :xml => @person }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def create\n @participant = Participant.new(participant_params)\n respond_to do |format|\n if @participant.save\n format.html { redirect_to participants_path }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors }\n end\n end\n end",
"def index\n redirect_to '/participants/new'\n end",
"def new\n @friend = current_user_or_guest.friends.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @friend }\n format.json { render json: @friend }\n end\n end",
"def new\n @leagueplayer = Leagueplayer.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @leagueplayer }\n end\n end",
"def new\n @usr = Usr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usr }\n end\n end",
"def new\n @classified_person = ClassifiedPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified_person }\n end\n end",
"def new\n @friend = Friend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @friend }\n end\n end",
"def new\n @person_verse = PersonVerse.new\n\n respond_to do |format|\n format.html { render :layout => \"main\" } # new.html.erb\n format.xml { render :xml => @person_verse }\n end\n end",
"def new\n @member = Member.new\n @title = \"New member\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member }\n end\n end",
"def new\n @user_team = UserTeam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_team }\n end\n end",
"def new\n @leader = Leader.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @leader }\n end\n end",
"def new\n @tour = Tour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tour }\n end\n end",
"def new\n @lecture = Lecture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lecture }\n end\n end"
] | [
"0.7934836",
"0.78061885",
"0.77111936",
"0.73798215",
"0.73798215",
"0.73798215",
"0.7350297",
"0.70026046",
"0.70026046",
"0.69834095",
"0.68899137",
"0.68822193",
"0.68822193",
"0.68822193",
"0.68822193",
"0.68822193",
"0.68822193",
"0.68822193",
"0.68822193",
"0.68822193",
"0.68822193",
"0.68634844",
"0.68634844",
"0.68355155",
"0.6823045",
"0.6823045",
"0.67709476",
"0.67209595",
"0.67209595",
"0.67209595",
"0.6701224",
"0.66973805",
"0.6681041",
"0.66757035",
"0.6669353",
"0.6652946",
"0.66324914",
"0.663052",
"0.663052",
"0.6608269",
"0.66078526",
"0.6593979",
"0.65856504",
"0.6578847",
"0.65703565",
"0.65671474",
"0.6556077",
"0.65375394",
"0.65347415",
"0.6533752",
"0.65309024",
"0.6530562",
"0.6528796",
"0.6522401",
"0.6520033",
"0.65153915",
"0.6515366",
"0.6515366",
"0.65148944",
"0.64943826",
"0.64943826",
"0.6493586",
"0.6491624",
"0.64863646",
"0.6485594",
"0.6470675",
"0.64687383",
"0.64578015",
"0.6456356",
"0.64557785",
"0.64555985",
"0.6453803",
"0.6442388",
"0.64404696",
"0.6434624",
"0.6433106",
"0.64287996",
"0.6428326",
"0.64278495",
"0.64278495",
"0.6426379",
"0.6421819",
"0.64138436",
"0.64123785",
"0.6405068",
"0.6404869",
"0.6398347",
"0.63931704",
"0.6390572",
"0.6390079",
"0.6384402",
"0.6382402",
"0.6378103",
"0.63778806",
"0.63755256",
"0.63716084",
"0.63711137",
"0.63609"
] | 0.7878028 | 3 |
POST /participants POST /participants.xml | def create
@participant = Participant.new(participant_params)#params[:participant])
if @participant.dob > 365.days.ago.to_date # form is setting a default date of today sometimes
@participant.dob = nil
end
connection = ActiveRecord::Base.connection();
if !params[:enumber].blank?
@enrollment = Enrollment.where("participant_id is not NULL and enumber = ?",params[:enumber] )
if !@enrollment.blank?
flash[:notice] = 'There is a participant with enumber '+params[:enumber]
else
@enrollment = Enrollment.where(" enumber = ?",params[:enumber] )
end
end
if !params[:participant][:wrapnum].blank?
@participant2 = Participant.where("wrapnum in (?)",params[:participant][:wrapnum] )
if !@participant2.blank?
flash[:notice] = 'There is a participant with wrapnumber '+params[:participant][:wrapnum]
end
end
if !params[:participant][:reggieid].blank?
@participant3 = Participant.where("reggieid = ?",params[:participant][:reggieid] )
if !@participant3.blank?
flash[:notice] = 'There is a participant with reggieid '+params[:participant][:reggieid]
end
end
respond_to do |format|
if (!@enrollment.blank? and !(@enrollment[0].participant_id).blank? ) or !@participant2.blank? or !@participant3.blank?
format.html { render :action => "new" }
format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }
elsif @participant.save
sql = "update participants set apoe_e1 = NULL where apoe_e1 = '0' "
results = connection.execute(sql)
sql = "update participants set apoe_e2 = NULL where apoe_e2 = '0' "
results = connection.execute(sql)
sql = "update participants set wrapnum = NULL where trim(wrapnum) = '' "
results = connection.execute(sql)
sql = "update participants set reggieid = NULL where trim(reggieid) = '' "
results = connection.execute(sql)
if !params[:enumber].blank? and @enrollment.blank?
sql = " insert into enrollments(enumber,participant_id)values('"+params[:enumber].gsub(/[;:'"()=<>]/, '')+"',"+@participant.id.to_s+")"
results = connection.execute(sql)
elsif !params[:enumber].blank? and !@enrollment.blank?
sql = " update enrollments set participant_id = "+@participant.id.to_s+" where enumber ='"+params[:enumber].gsub(/[;:'"()=<>]/, '')+"' "
results = connection.execute(sql)
end
flash[:notice] = 'Participant was successfully created.'
format.html { redirect_to(participant_search_path) }
format.xml { render :xml => @participant, :status => :created, :location => @participant }
else
format.html { render :action => "new" }
format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @participant = Participant.new(participant_create_params)\n @participant.save\n respond_with(@participant)\n end",
"def create\n @participant = Participant.new(participant_create_params)\n @participant.save\n respond_with(@participant)\n end",
"def create\n @participant = Participant.new(participant_params)\n respond_to do |format|\n if @participant.save\n format.html { redirect_to participants_path }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors }\n end\n end\n end",
"def create\r\n respond_to do |format|\r\n if @participant.save\r\n format.html { redirect_to(@participant, :notice => 'Participant was successfully created.') }\r\n format.xml { render :xml => @participant, :status => :created, :location => @participant }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @family = Family.find(params[:participant][:family]) rescue nil\n params[:participant][:family] = @family\n @participants = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participants.save\n AuditTrail.audit(\"Participant #{@participants.fullname} created by #{current_user.login}\", edit_participant_url(@participants))\n flash[:notice] = 'Participants was successfully created.'\n format.html { params[:commit] == 'Save' ? redirect_to(participants_path) : redirect_to(new_participant_path) }\n format.xml { render :xml => @participants, :status => :created, :location => @participants }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participants.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to participants_url, notice: 'Participant was successfully created.' }\n format.json { render json: @participant, status: :created, location: @participant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction_participant = Transaction::Participant.new(params[:transaction_participant])\n\n respond_to do |format|\n if @transaction_participant.save\n format.html { redirect_to(@transaction_participant, :notice => 'Participant was successfully created.') }\n format.xml { render :xml => @transaction_participant, :status => :created, :location => @transaction_participant }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction_participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \n @participant = current_user.build_participant(participant_params)\n \n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant, notice: \"Participant was successfully created.\" }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@participant = Participant.new(participant_params)\n\n\t\tif @participant.save\n\t\t\trender json: @participant, status: :created, location: @participant\n\t\telse\n\t\t\trender json: @participant.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def create\n \n @participant = Participant.new(:remote_ip => params[:participant][:remote_ip],\n\t :user_id => params[:participant][:user_id], \n\t\t\t\t\t\t\t\t\t:contact_describe_id=> params[:participant][:contact_describe_id], \n\t\t\t\t\t\t\t\t\t:instructions => params[:participant][:instructions], \n\t\t\t\t\t\t\t\t\t:goodwill => params[:participant][:goodwill], \n\t\t\t\t\t\t\t\t\t:age_18_or_more => params[:participant][:age_18_or_more],\n\t\t\t\t\t\t\t\t\t:created_at => Time.current, \n\t\t\t\t\t\t\t\t\t:updated_at => Time.current,\n\t\t\t\t\t\t\t\t\t:date_deleted => Time.current) \n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = Participant.new(participant_params)\n\n respond_to do |format|\n if @participant.save\n # format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n format.html { redirect_to '/confirmation/thankyou'}\n # format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n # format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def conversation_params\n params.permit(:participants, participants: [])\n end",
"def create\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n AuditTrail.audit(\"Participant #{@participant.fullname} created by #{current_user.login}\", edit_participant_url(@participant))\n flash[:notice] = \"Participant #{@participant.fullname} was successfully created.\"\n # TODO: is this right? was new_user_path for this participant; test didn't match\n format.html { redirect_to participants_path }\n else\n flash[:error] = @participant.errors.full_messages.join(\", \")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n AuditTrail.audit(\"Participant #{@participant.fullname} created by #{current_user.login}\", edit_participant_url(@participant))\n flash[:notice] = \"Participant #{@participant.fullname} was successfully created.\"\n # TODO: is this right? was new_user_path for this participant; test didn't match\n format.html { redirect_to participants_path }\n else\n flash[:error] = @participant.errors.full_messages.join(\", \")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = Participant.new(participant_params)\n @participant.competences = @competence\n respond_to do |format|\n if @participant.save\n TeamParticipant.create(participant: @participant, team: @team)\n format.html { redirect_to participants_url }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n head :status => 405\n return\n \n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def create\n @meeting.add_new_participant(@participant)\n respond_to do |format|\n if @participant.save && @meeting.save\n flash[:notice] = 'Participant and meeting updates were successfully created.'\n format.html { redirect_to(meeting_path(@meeting)) }\n format.xml { render :xml => @participant, :status => :created, :location => @participant }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = Participant.new(participant_params)\n\n if @participant.save\n redirect_to participants_path\n flash[:success] = \"Participant was successfully created.\"\n else\n flash[:danger] = \"Participant was unsuccessfully created.\"\n render :new\n end\n end",
"def participant_params\n params.require(:participant).permit(:name)\n end",
"def create\n @room = Room.create(:user => current_user)\n \n # Creation from web form.\n if params[:room][:participant_attributes]\n @room.phonebrowser_service = PhonebrowserService.create(:room => @room)\n @room.video_service = VideoService.create(:room => @room)\n params[:room][:participant_attributes].each do |part|\n p = Participant.new\n if part[:phonebrowser_service] == '1'\n p.phonebrowser_service_id = Service.find_by_name('phonebrowser').id\n end\n if part[:video_service_id] == '1'\n p.video_service_id = Service.find_by_name('video').id\n end\n p.name = part[:name]\n p.phone = part[:phone]\n p.sip = part[:sip]\n p.browser = part[:browser]\n p.save\n @room.participants << p\n end\n @room.save\n redirect_to rooms_path\n \n # Creation from RESTful request\n elsif params[:room][:participant]\n participants_array = []\n if params[:room][:participant].class == Array\n participants_array = params[:room][:participant]\n else\n participants_array << params[:room][:participant]\n end\n participants_array.each do |part|\n p = Participant.new\n p.name = part[:name]\n p.phone = part[:phone]\n p.sip = part[:sip]\n p.browser = part[:browser]\n p.save\n @room.participants << p\n end\n @room.phonebrowser_service = PhonebrowserService.create(:room => @room)\n @room.video_service = VideoService.create(:room => @room)\n @room.save\n if params[:room][:start_now] and !params[:room][:start_now].nil? and params[:room][:start_now] == \"1\"\n @room.start\n end\n # @ltest.to_xml(:include => :sub_tests) \n respond_to do |format|\n format.html {redirect_to rooms_path}\n format.xml { render :xml => @room.to_xml(:include => [:phonebrowser_service, :participants]) } #.to_xml(:include => :phonebrowser_service)\n format.json {render :json => @room.to_json(:include => [:phonebrowser_service, :participants]) }\n end\n end\n end",
"def create\n @participant = @event.participants.new(participant_params)\n @participant.organization_id = @event.organization.id\n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def create\n @participant = Participant.new(participant_params)\n @participant.agent = request.user_agent\n @participant.ip = request.remote_ip\n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def participant_params\n params.require(:participant).permit(:email, :match_degree, :last_responded)\n end",
"def participant_params\n params.require(:participant).permit(:name)\n end",
"def create\n @participant = Participant.new(participant_params)\n @participant.session_id = session[:session_id]\n @participant.ip_address = request.ip\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to directions_path }\n format.json { render action: 'show', status: :created, location: @participant }\n else\n format.html { render action: 'new' }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_participant\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n participant_ids = params[\"participant_ids\"]\n comment = params[\"comment\"].nil? ? \"\" : params[\"comment\"]\n\n if user != nil and meeting != nil and participant_ids.length > 0\n participant_ids.each do |participant_id|\n unless meeting.participants.exists?(participant_id)\n new_participant = User.find(participant_id)\n meeting.participants << new_participant\n # add default vote for the new added participant to each suggestion\n meeting.suggestions.each do |suggestion|\n suggestion.votes << Vote.new(:voter => new_participant, :decision => \"?\")\n end\n\n NotificationService.send_meeting_invitation(user, new_participant, meeting, comment)\n end\n end\n self.send_ok\n else\n self.send_error 401\n end\n end",
"def create\n if params[:participant][:accepted] == \"1\" and params[:participant][:prereq] == \"1\"\n unless current_user.participants.exists?(:school_id => params[:school_id])\n @participant = @school.participants.new(params[:participant])\n @participant.user_id = current_user.id\n @participant.accepted = 0\n @participant.save\n end\n end\n \n respond_to do |format|\n if @participant\n Notifier.participant_user(@participant,@school).deliver\n Notifier.participant_admins(@participant,@school).deliver\n format.js { render \"register_success\" }\n else\n format.js { render \"register_failure\" }\n end\n end\n end",
"def create\n # @attention = Attention.new(attention_params)\n # @attention.participants = params[:participants]\n # @attention.responsible = params[:responsible]\n # @attention.nro_involved = params[:participants].count + 1\n\n # respond_to do |format|\n # if @attention.save\n # format.html { redirect_to @attention, notice: 'Attention was successfully created.' }\n # format.json { render :show, status: :created, location: @attention }\n # else\n # format.html { render :index }\n # format.json { render json: @attention.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def ajoutParticipants(participant)\n @participants.push(participant)\n end",
"def new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @participant }\r\n end\r\n end",
"def participant_params\n params.require(:participant).permit(:firstname, :familyname, :kyc_approved, :agreement, :privacy_agr, :eth_adress, :cont_amount, :eth_tx, :user_id)\n end",
"def index\n @participants = Participant.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.xml { render :xml => @participants }\n end\n end",
"def create\n params[:participant] = convert_school_name_to_id params[:participant]\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n format.json { render json: @participant, status: :created, location: @participant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def create\n @participante = Participante.new(params[:participante])\n\n respond_to do |format|\n if @participante.save\n format.html { redirect_to(@participante, :notice => 'Participante was successfully created.') }\n format.xml { render :xml => @participante, :status => :created, :location => @participante }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participante.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @activity_participant = Activity::Participant.new(activity_participant_params)\n @activity_participant.user = current_user\n @activity_participant.activity = Activity.find_by_id(params[:activity_id])\n\n respond_to do |format|\n if @activity_participant.save\n format.html { redirect_to activity_participants_url, notice: \"Participant was successfully created.\" }\n format.json { render :show, status: :created, location: @activity_participant }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @activity_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def participant_params\n params.require(:participant).permit(:first_name, :last_name, :instructor, :email)\n end",
"def create\n @trainees = TraineeBatch.new(params[:participants][:ids], params[:training_calendar_id])\n respond_to do |format|\n if @trainees.save\n format.html { redirect_to training_calendar_path(params[:training_calendar_id]), :notice => 'The participant(s) were successfully added.' }\n format.json { render :json => @trainees, :status => :created, :location => @trainees }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @trainees.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def participant_params\n params.require(:participant).permit(:event_id, :name, :title, :telephone_number, :email, :organization_name, :organization_type_id, :directorate_id, :responsibility, :place_of_work, :group_id, :field_visit_id, :stay_at, :participant_type_id, :checked_in)\n end",
"def create\n @participant = Participant.new(participant_params)\n #@participant.password = Devise.friendly_token.first(8)\n respond_to do |format|\n if @participant.save\n #RegistrationMailer.welcome(user, generated_password).deliver\n format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @participant }\n else\n format.html { render action: 'new' }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_participant = ProjectParticipant.new(project_participant_params)\n\n respond_to do |format|\n if @project_participant.save\n format.html { redirect_to @project_participant, notice: 'Project participant was successfully created.' }\n format.json { render :show, status: :created, location: @project_participant }\n else\n format.html { render :new }\n format.json { render json: @project_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def participant_params\n params.require(:participant).permit(:email, :dynamic_id,:avatar,:name,:vote)\n end",
"def participant_params\n params.require(:participant).permit(:title)\n end",
"def setParticipants(participants)\r\n\t\t\t\t\t@participants = participants\r\n\t\t\t\tend",
"def participant_params\n params.require(:participant).permit(:code, :first_name, :second_name, :third_name, :fourth_name, :gender_id, :birthdate, :email, :participant_type_id, :address, :website, :legal_representative, :phone, :mobile_phone, :param_matrix_id, :score, :created_by_id, :is_pep)\n end",
"def new_participants=(value)\n @new_participants = value\n end",
"def participant_params\n params.require(:participant).permit(:name, :birthday, :function, :sex)\n end",
"def participants=(value)\n @participants = value\n end",
"def participants=(value)\n @participants = value\n end",
"def create\n @partner_person = PartnerPerson.new(params[:partner_person])\n @title = \"association partner <--> people\"\n\n respond_to do |format|\n if @partner_person.save\n format.html { redirect_to(@partner_person, :notice => 'PartnerPerson was successfully created.') }\n format.xml { render :xml => @partner_person, :status => :created, :location => @partner_person }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @partner_person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @participante = Participante.new(params[:participante])\n\n respond_to do |format|\n if @participante.save\n flash[:notice] = 'PARTICIPANTE CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@participante) }\n format.xml { render :xml => @participante, :status => :created, :location => @participante }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participante.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @game = Game.find(params[:game_id])\n @participant = Participant.new(participant_params)\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to show_participant_path(@game, @participant) }\n else\n format.html { render :new }\n end\n end\n end",
"def participant_params\n params.require(:participant).permit(:first_name, :last_name, :email, :phone_number,\n :address, :address2, :city, :state, :zip, :birthdate,\n :password, :password_confirmation, :picture)\n end",
"def participant_params\n params.require(:participant).permit(:opponent_id, :owner_id, :game_id, :winner_id, :waiting_for_user_id, :status, :game_data)\n end",
"def create_participant(safebox_guid, participant_params)\n handle_error { sendsecure_connection.post(\"api/v2/safeboxes/#{safebox_guid}/participants.json\", participant_params) }\n end",
"def participant_params\n params.permit(:first_name, :last_name, :email, :phone)\n end",
"def update\n debugger\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n if @participants.update_attributes(params[:participant])\n AuditTrail.audit(\"Participant #{@participants.fullname} updated by #{current_user.login}\", edit_participant_url(@participants))\n flash[:notice] = 'Participants was successfully updated.'\n format.html { redirect_to(participants_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participants.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end",
"def new\n @transaction_participant = Transaction::Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_participant }\n end\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def create\n @participant = Participant.new(params[:participant])\n @participant.ganador_flag = false\n respond_to do |format|\n if @participant.save\n format.html { redirect_to new_participant_path, notice: 'Participante creado.' }\n format.json { render json: @participant, status: :created, location: @participant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def participant_params\n params.require(:participant).permit(:first_name => [] , :last_name => [], :email => [], :gender => [])\n end",
"def destroy\r\n @participant.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(participants_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def participant_params\n params.require(:participant).permit(:participantID, :fname, :lname, :phone, :expirydate, :dr_note_date, :password, :email, :birthday, :role)\n end",
"def create\n params[:recipient][:tag_list] = params[:\"hidden-recipient\"][:tag_list]\n @recipient = Recipient.new(params[:recipient])\n\n respond_to do |format|\n if @recipient.save\n format.html { redirect_to @recipient, notice: 'Recipient was successfully created.' }\n format.json { render json: @recipient, status: :created, location: @recipient }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def participant_params\n params.require(:participant).permit(:first_name, :last_name, :email, :company, :location, :job_title)\n end",
"def create\n @participant_type = ParticipantType.new(participant_type_params)\n\n respond_to do |format|\n if @participant_type.save\n format.html { redirect_to @participant_type, notice: 'Participant type was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def create\n @participante = Participante.new(participante_params)\n\n respond_to do |format|\n if @participante.save\n format.html { redirect_to @participante, notice: 'Participante was successfully created.' }\n format.json { render :show, status: :created, location: @participante }\n else\n format.html { render :new }\n format.json { render json: @participante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = Participant.new(participant_params)\n if @participant.organization_type and @participant.organization_type.name == 'FMOH'\n @directorates = Directorate.all\n end\n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_and_invitation_studant(params = {})\n run(:post, \"/invitations\", [201,422], JSON.dump(params))\n end",
"def participant_params\n params.require(:participant).permit(:login, :paid)\n end",
"def participants=(new_participants)\n @participants = new_participants\n self.participant_ids = new_participants.collect(&:id)\n end",
"def participants\n attributes['participants'] ||= []\n attributes['participants']\n end",
"def destroy\n @participants = Participant.find(params[:id])\n success = @participants.destroy\n\n if success and @participants.errors.empty?\n AuditTrail.audit(\"Participant #{@participants.fullname} destroyed by #{current_user.login}\")\n flash[:success] = \"Participant #{@participants.fullname} destroyed\"\n else\n flash[:error] = @participants.errors.full_messages\n end\n respond_to do |format|\n format.html { redirect_to(participants_url) }\n format.xml { head :ok }\n end\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def create\n @annex1_project_participant = Annex1ProjectParticipant.new(params[:annex1_project_participant])\n\n respond_to do |format|\n if @annex1_project_participant.save\n format.html { redirect_to @annex1_project_participant, notice: 'Annex1 project participant was successfully created.' }\n format.json { render json: @annex1_project_participant, status: :created, location: @annex1_project_participant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @annex1_project_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = Participant.new(participant_params)\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to \"/dynamics/#{@participant.dynamic.id}\", notice: '' }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n if(User.all.where(email:\"user@ideatouch.pt\").last.id!=nil)\n Notification.create :user_id => User.all.where(email:@participant.email).last.id , :text => \"you were added to dynamic #{@participant.dynamic.name}\", :estado => false\n end \n end\n end",
"def create\n @partner = Partner.new(params[:partner])\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner, notice: 'Partner was successfully created.' }\n format.json { render json: @partner, status: :created, location: @partner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @partner = Partner.new(params[:partner])\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner, notice: 'Partner was successfully created.' }\n format.json { render json: @partner, status: :created, location: @partner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_participant_to_deal(id:, **args)\n params = parameters(args) do\n required_params :person_id\n optional_params :person_id\n end\n request(:post, \"deals/#{id}/participants\", params)\n end",
"def create\n @reunion_participante = ReunionParticipante.new(reunion_participante_params)\n respond_to do |format|\n if @reunion_participante.save\n format.html { redirect_to @reunion_participante, notice: 'Reunion participante was successfully created.' }\n format.json { render :show, status: :created, location: @reunion_participante }\n else\n format.html { render :new }\n format.json { render json: @reunion_participante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @partner = Partner.new(partner_params)\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner, notice: 'You are partnered up!' }\n format.json { render :show, status: :created, location: @partner }\n else\n format.html { render :new }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie_participant = MovieParticipant.new(movie_participant_params)\n\n respond_to do |format|\n if @movie_participant.save\n format.html { redirect_to @movie_participant, notice: 'Movie participant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @movie_participant }\n else\n format.html { render action: 'new' }\n format.json { render json: @movie_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @partner = Partner.new(partner_params)\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner, notice: 'Partner was successfully created.' }\n format.json { render :show, status: :created, location: @partner }\n else\n format.html { render :new }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n tournament = Tournament.find(params[:tournament_id])\n s = Subscription.new\n s.tournament_id = tournament.id\n if tournament.is_individual?\n s.participant_id = params[:participant_id] || session[:user_id]\n \n flash[:valid] = I18n.t('subscription.ok') if s.save\n else\n if params[:membership_id]\n s.participant_id = params[:membership_id]\n\n flash[:valid] = I18n.t('subscription.ok') if s.save\n end\n end\n redirect_to :back\n end"
] | [
"0.6477641",
"0.6477641",
"0.64547783",
"0.6425662",
"0.64193356",
"0.6417889",
"0.6339285",
"0.6265307",
"0.62553793",
"0.6244246",
"0.62189275",
"0.61577004",
"0.61544013",
"0.61544013",
"0.6124953",
"0.61127096",
"0.60809004",
"0.6026621",
"0.60184425",
"0.5984262",
"0.5938944",
"0.5919101",
"0.59074455",
"0.59064955",
"0.58950853",
"0.5882917",
"0.5863111",
"0.58572966",
"0.58474827",
"0.58428794",
"0.5828855",
"0.5828855",
"0.5828855",
"0.5803456",
"0.5788823",
"0.5773529",
"0.57707274",
"0.57667506",
"0.5762731",
"0.57471776",
"0.5723466",
"0.5692961",
"0.5671502",
"0.56623",
"0.56599534",
"0.5653008",
"0.5651967",
"0.5638091",
"0.56123215",
"0.5606191",
"0.5602591",
"0.5602448",
"0.55938077",
"0.55938077",
"0.55854845",
"0.55684036",
"0.55578315",
"0.5554454",
"0.5553271",
"0.5537907",
"0.5531031",
"0.5527316",
"0.551222",
"0.551222",
"0.551222",
"0.5507342",
"0.54843014",
"0.54843014",
"0.54843014",
"0.54843014",
"0.54843014",
"0.54843014",
"0.54817873",
"0.5480896",
"0.5477122",
"0.5462706",
"0.5460627",
"0.5459175",
"0.5446577",
"0.5436575",
"0.5430764",
"0.54295844",
"0.54294527",
"0.5426258",
"0.5424497",
"0.54243225",
"0.5416937",
"0.5416937",
"0.5415842",
"0.5415842",
"0.5415842",
"0.54109013",
"0.54070866",
"0.5402227",
"0.5402227",
"0.5401826",
"0.5397613",
"0.53936255",
"0.5390494",
"0.53717613",
"0.5369196"
] | 0.0 | -1 |
PUT /participants/1 PUT /participants/1.xml | def update
scan_procedure_array = (current_user.edit_low_scan_procedure_array).split(' ').map(&:to_i)
hide_date_flag_array = (current_user.hide_date_flag_array).split(' ').map(&:to_i)
@hide_page_flag = 'N'
if hide_date_flag_array.count > 0
@hide_page_flag = 'Y'
end
# @participant = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_visit_memberships.enrollment_id from enrollment_visit_memberships where enrollment_visit_memberships.visit_id in
# (select visit_id from scan_procedures_visits where scan_procedure_id in (?)))) ", scan_procedure_array).find(params[:id])
if current_user.role == 'Admin_High'
@participant = Participant.where(" participants.id in ( select vgroups.participant_id from vgroups where vgroups.id in (select scan_procedures_vgroups.vgroup_id from scan_procedures_vgroups
where scan_procedures_vgroups.scan_procedure_id in (?))) ", scan_procedure_array).find(params[:id])
else
@participant = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_vgroup_memberships.enrollment_id from enrollment_vgroup_memberships, scan_procedures_vgroups
where enrollment_vgroup_memberships.vgroup_id = scan_procedures_vgroups.vgroup_id and scan_procedures_vgroups.scan_procedure_id in (?))) ", scan_procedure_array).find(params[:id])
end
respond_to do |format|
if @participant.update(participant_params)#params[:participant], :without_protection => true)
connection = ActiveRecord::Base.connection();
sql = "update participants set apoe_e1 = NULL where apoe_e1 = '0' "
results = connection.execute(sql)
sql = "update participants set apoe_e2 = NULL where apoe_e2 = '0' "
results = connection.execute(sql)
sql = "update participants set wrapnum = NULL where trim(wrapnum) = '' "
results = connection.execute(sql)
sql = "update participants set reggieid = NULL where trim(reggieid) = '' "
results = connection.execute(sql)
if @participant.dob > 365.days.ago.to_date # form is setting a default date of today sometimes
@participant.dob = nil
@participant.save
end
if !@participant.dob.blank?
@appointments = Appointment.where("appointments.vgroup_id in (select vgroups.id from vgroups where participant_id is not null and participant_id in (?))", params[:id])
@appointments.each do |appt|
appt.age_at_appointment = ((appt.appointment_date - @participant.dob)/365.25).round(2)
if appt.age_at_appointment > 0
appt.save
end
end
end
flash[:notice] = 'Participant was successfully updated.'
format.html { redirect_to(@participant) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n debugger\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n if @participants.update_attributes(params[:participant])\n AuditTrail.audit(\"Participant #{@participants.fullname} updated by #{current_user.login}\", edit_participant_url(@participants))\n flash[:notice] = 'Participants was successfully updated.'\n format.html { redirect_to(participants_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participants.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @participant.update_attributes(params[:participant])\r\n format.html { redirect_to(@participant, :notice => 'Participant was successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @participant = Participant.find(params[:id])\n respond_to do |format|\n if @participant.update_attributes(participant_params)\n format.html { redirect_to @participant, notice: 'Participant was successfully updated.' }\n format.json { render json: @participant }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @transaction_participant = Transaction::Participant.find(params[:id])\n\n respond_to do |format|\n if @transaction_participant.update_attributes(params[:transaction_participant])\n format.html { redirect_to(@transaction_participant, :notice => 'Participant was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction_participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@participant = Participant.find(params[:id])\n\n\t\tif @participant.update(participant_params)\n\t\t\thead :no_content\n\t\telse\n\t\t\trender json: @participant.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def update\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n if @participant.update_attributes(params[:participant])\n format.html { redirect_to @participant, notice: 'Participante actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @participant.update(participant_update_params)\n respond_with(@participant)\n end",
"def update\n @participant.update_attributes(participant_update_params)\n respond_with(@participant)\n end",
"def update\n @participant = Participant.find(params[:id])\n respond_to do |format|\n begin\n if @participant.update_attributes(params[:participant])\n AuditTrail.audit(\"Participant #{@participant.fullname} updated by #{current_user.login}\", edit_participant_url(@participant))\n flash[:notice] = 'Participants was successfully updated.'\n format.html { redirect_to(participants_url) }\n format.xml { head :ok }\n else\n flash[:error] = format_flash_error(\"Error updating #{@participant.fullname}\",\n \"participant update(): \\n #{format_validation_errors(@participant.errors)}\")\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n rescue Exception => e\n flash[:error] = format_flash_error(\"Error updating #{@participant.fullname}\", \"participant update(): \\n #{e.to_s}\")\n logger.error \"ERROR updating participant \\n#{@participant.inspect}\"\n logger.error e.backtrace.join(\"\\n\\t\")\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @participant.update(participant_params)\n format.html { redirect_to @participant, notice: 'Participant was successfully updated.' }\n format.json { render :show, status: :ok, location: @participant }\n else\n format.html { render :edit }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @participant.update(participant_params)\n format.html { redirect_to @participant, notice: \"Participant was successfully updated.\" }\n format.json { render :show, status: :ok, location: @participant }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @participant.update(participant_params)\n format.html { redirect_to @participant, notice: 'Participant was successfully updated.' }\n # format.json { render :show, status: :ok, location: @participant }\n else\n format.html { render :edit }\n # format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @participant.update(participant_params)\n format.html { redirect_to @participant, notice: 'Participant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @participant = Participant.find(params[:id])\n # @participant.city = City.find(params[:participant][:city])\n\n respond_to do |format|\n if @participant.update_attributes(params[:participant])\n format.html { redirect_to participants_url, notice: 'Participant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @participant.update(participant_params)\n format.html { redirect_to participant_path }\n format.json { render :show, status: :ok, location: @participant }\n else\n format.html { render :edit }\n format.json { render json: @participant.errors }\n end\n end\n end",
"def update\n resource_path = \"/projects/#{project_id}/people/#{id}\"\n Request.put(resource_path, self.to_xml('person'))\n end",
"def update\n respond_to do |format|\n if @participant.update_attributes(params[:participant]) && @meeting.update_attributes(@meeting.new_meeting_params_from(@participant, params[:participant]))\n flash[:notice] = 'Participant was successfully updated.'\n format.html { redirect_to(meeting_path(@meeting)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n game = Game.find(params[:game_id])\n participant = Participant.find(params[:participant_id])\n respond_to do |format|\n if participant.update(participant_params)\n format.html { redirect_to show_participant_path(game, participant) }\n format.json\n else\n format.html { render :edit }\n format.json\n end\n end\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def update\n params[:participant] = convert_school_name_to_id params[:participant]\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n if @participant.update_attributes(params[:participant])\n format.html { redirect_to @participant, notice: 'Participant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n if @participant.update(participant_params)\n flash[:success] = 'Participant was successfully updated.'\n redirect_to participants_url\n else\n flash[:danger] = 'Failed to update participant.'\n render :edit\n end\n end",
"def update\n @participant = Participant.find(params[:id])\n @notice = nil\n respond_to do |format|\n if @participant.update_attributes(params[:participant])\n format.html { redirect_to(@participant, :notice => 'Participant was successfully updated.') }\n #format.xml { head :ok }\n format.js\n else\n @notice = \"Cannot update your status at thte moment\"\n format.html { render :action => \"edit\" }\n #format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n @participant = Participant.find(params[:id])\n if params[:participant][:active] == '1'\n @participant.make_active\n end\n\n respond_to do |format|\n if @participant.update_attributes(params[:participant])\n session[:operate_mode] = nil\n format.html { redirect_to(@participant, :notice => t('global.operate_success')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def update\n @annex1_project_participant = Annex1ProjectParticipant.find(params[:id])\n\n respond_to do |format|\n if @annex1_project_participant.update_attributes(params[:annex1_project_participant])\n format.html { redirect_to @annex1_project_participant, notice: 'Annex1 project participant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @annex1_project_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @participant.update(participant_params)\n render_participant_modified_message \"updated\"\n format.html { redirect_to display_project_participants_path(params[:project_id]) }\n format.json { render :show, status: :ok, location: @participant }\n else\n format.html { render :edit }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_participant\n @participant = Participant.find_by_id(params[:id])\n end",
"def update\n @partner_person = PartnerPerson.find(params[:id])\n @title = \"association partner <--> people\"\n\n respond_to do |format|\n if @partner_person.update_attributes(params[:partner_person])\n format.html { redirect_to(@partner_person, :notice => 'PartnerPerson was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @partner_person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @participant = @school.participants.find(params[:id])\n\n respond_to do |format|\n if @participant.update_attributes(params[:participant])\n @team = Team.find(params[:coreteam])\n @team.add_member(@participant.user)\n format.js\n if @participant.accepted == 2\n Notifier.participant_acceptance(@participant,@school).deliver\n end \n else\n format.js { render \"register_failure\" }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update_participant(safebox_guid, participant_guid, participant_params)\n handle_error { sendsecure_connection.patch(\"api/v2/safeboxes/#{safebox_guid}/participants/#{participant_guid}.json\", participant_params) }\n end",
"def update\n respond_to do |format|\n if @activity_participant.update(activity_participant_params)\n format.html { redirect_to @activity_participant, notice: \"Participant was successfully updated.\" }\n format.json { render :show, status: :ok, location: @activity_participant }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @activity_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @participante = Participante.find(params[:id])\n\n respond_to do |format|\n if @participante.update_attributes(params[:participante])\n format.html { redirect_to(@participante, :notice => 'Participante was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participante.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def update\n params[:interview][:participant_ids].each do |participant_id|\n unless participant_id.empty?\n participant = Participant.find(participant_id)\n @interview.participants << participant\n end\n end\n respond_to do |format|\n\n if @interview.update(interview_params)\n participants = @interview.participants\n emails = []\n participants.each do |p|\n emails += [p.email]\n ReminderMailer.update_email(p.email).deliver_now\n end\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 @participante = Participante.find(params[:id])\n respond_to do |format|\n if @participante.update_attributes(params[:participante])\n flash[:notice] = 'PARTICIPANTE ATUALIZADO COM SUCESSO.'\n format.html { redirect_to(@participante) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participante.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n if params[:update]\n validated = true\n end\n respond_to do |format|\n if @trip.update(validated: validated)\n if validated == true\n @trip.participants.each do |u|\n u.update(token: u.token + 5)\n end\n format.js { render :layout => false , notice: 'Success of acceptance of correspondance status' }\n else\n flash[:danger] = 'Failure of modification of correspondance status.'\n redirect_to current_user\n end\n end\n end\n end",
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def update\n @draft_partnership = DraftPartnership.find(params[:id])\n\n respond_to do |format|\n if @draft_partnership.update_attributes(params[:partnership])\n\n format.xml \n else\n \n format.xml { render :xml => @draft_partnership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @participant_id = args[:participant_id] if args.key?(:participant_id)\n end",
"def update\n @participant_bkp = Participant.new(@participant.attributes)\n respond_to do |format|\n if @participant.update(participant_params)\n @participant.competences.delete_all\n @competence.each {|competence| competence.participant = @participant; competence.save}\n @participant_bkp.id = nil\n @participant_bkp.original_participant_id = @participant.id\n @participant_bkp.save(validate: false)\n @participant_bkp.delete\n format.html { redirect_to add_to_list_participant_url(@participant), notice: 'Participant was successfully updated.' }\n format.json { render :show, status: :ok, location: @participant }\n else\n format.html { render :edit }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setParticipants(participants)\r\n\t\t\t\t\t@participants = participants\r\n\t\t\t\tend",
"def update\n @partner = Partner.find(params[:id])\n\n respond_to do |format|\n if @partner.update_attributes(params[:partner])\n format.html { redirect_to @partner }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @participant.update(participant_params)\n format.html { redirect_to \"/dynamics/#{@participant.dynamic_id}\", notice: '' }\n format.json { render :show, status: :ok, location: @participant }\n else\n format.html { render :edit }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(@person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(@person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @meeting.add_new_participant(@participant)\n respond_to do |format|\n if @participant.save && @meeting.save\n flash[:notice] = 'Participant and meeting updates were successfully created.'\n format.html { redirect_to(meeting_path(@meeting)) }\n format.xml { render :xml => @participant, :status => :created, :location => @participant }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(person_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @family = Family.find(params[:participant][:family]) rescue nil\n params[:participant][:family] = @family\n @participants = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participants.save\n AuditTrail.audit(\"Participant #{@participants.fullname} created by #{current_user.login}\", edit_participant_url(@participants))\n flash[:notice] = 'Participants was successfully created.'\n format.html { params[:commit] == 'Save' ? redirect_to(participants_path) : redirect_to(new_participant_path) }\n format.xml { render :xml => @participants, :status => :created, :location => @participants }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participants.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_participant_document\n @participant_document = ParticipantDocument.find(params[:id])\n end",
"def update\n @partner = Partner.find(params[:id])\n\n respond_to do |format|\n if @partner.update_attributes(params[:partner])\n format.html { redirect_to @partner, notice: 'Partner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @partner = Partner.find(params[:id])\n\n respond_to do |format|\n if @partner.update_attributes(params[:partner])\n format.html { redirect_to @partner, notice: 'Partner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to(@person, :notice => 'Person was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def update\n @people = People.find(params[:id])\n\n respond_to do |format|\n if @people.update_attributes(params[:people])\n flash[:notice] = 'People was successfully updated.'\n format.html { redirect_to(@people) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @people.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @subscriber = Subscriber.where(openid: volunteer_params[:openid]).first\n @volunteer = @subscriber.volunteer\n @volunteer.name = volunteer_params[:name]\n @volunteer.tel = volunteer_params[:tel]\n @volunteer.commun = volunteer_params[:commun]\n @volunteer.neighborhood = volunteer_params[:neighborhood]\n respond_to do |format|\n if @volunteer.save\n # format.html { redirect_to @volunteer, notice: 'Volunteer was successfully updated.' }\n format.html { render \"volunteers/success\" }\n format.json { render :show, status: :ok, location: @volunteer }\n else\n format.html { render :edit }\n format.json { render json: @volunteer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @followership = Followership.find(params[:id])\n\n respond_to do |format|\n if @followership.update_attributes(params[:followership])\n flash[:notice] = 'Followership was successfully updated.'\n format.html { redirect_to(@followership) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @followership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @participants = Participant.find(params[:id])\n success = @participants.destroy\n\n if success and @participants.errors.empty?\n AuditTrail.audit(\"Participant #{@participants.fullname} destroyed by #{current_user.login}\")\n flash[:success] = \"Participant #{@participants.fullname} destroyed\"\n else\n flash[:error] = @participants.errors.full_messages\n end\n respond_to do |format|\n format.html { redirect_to(participants_url) }\n format.xml { head :ok }\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Pessoa atualizada com sucesso!'\n format.html { redirect_to(@person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_participant 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_update_participant_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::Dialogflow::V2::Participant.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def update\n @person = Person.find(params[:id])\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n\n path = people_path\n msg = 'Person was successfully updated.'\n if @participant\n path = participant_path(@participant, :anchor => \"relationships_tab\")\n msg = 'Person was successfully updated.'\n end\n if @provider\n path = provider_path(@provider)\n msg = \"Person was successfully updated for #{@provider}.\"\n end\n\n format.html { redirect_to(path, :notice => msg) }\n format.json { render :json => @person }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @project_participant.update(project_participant_params)\n format.html { redirect_to @project_participant, notice: 'Project participant was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_participant }\n else\n format.html { render :edit }\n format.json { render json: @project_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n respond_to do |format|\r\n if @participant.save\r\n format.html { redirect_to(@participant, :notice => 'Participant was successfully created.') }\r\n format.xml { render :xml => @participant, :status => :created, :location => @participant }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @volunteer = Volunteer.find(params[:id])\n #@user = @volunteer.user\n #@user.email = params[:email]\n #update emil here\n old = @volunteer.orientation\n \n respond_to do |format|\n if @volunteer.update_attributes(params[:volunteer])\n\t if old != @volunteer.orientation\n\t old.numCurrParticipant = old.numCurrParticipant - 1\n\t old.save\n\t @volunteer.orientation.numCurrParticipant = @volunteer.orientation.numCurrParticipant + 1\n\t @volunteer.orientation.save\n\t end\n \n @volunteer.user.email = @volunteer.email\n @volunteer.user.save\n \n\t format.html { \n\t redirect_to @volunteer, \n\t notice: 'Volunteer was successfully updated.' }\n\t format.json { head :no_content }\n else\n\t format.html { render action: \"edit\" }\n\t format.json { \n\t render json: @volunteer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @actor = Actor.find(params[:id])\n\n respond_to do |format|\n if @actor.update_attributes(params[:actor])\n format.html { redirect_to @actor, notice: 'Actor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @actor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to(@person, :notice => 'Person was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(@person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\", :layout => \"main\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tournament = @resource_finder.find(params[:id])\n\n respond_to do |format|\n if @tournament.update_attributes(params[:tournament])\n flash[:notice] = 'Tournament was successfully updated.'\n format.html { redirect_to_resource }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tournament.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participants }\n end\n end",
"def destroy\r\n @participant.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(participants_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to people_url }\n format.xml { head :ok }\n else\n flash[:warning] = 'Please check every information that you are entering and fill the required fields.'\n format.html { render :edit }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n #params[:trip][:participations] ||=[]\n respond_to do |format|\n if @trip.owner_id == current_user.id && @trip.update_attributes(params[:trip])\n flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @person_verse = PersonVerse.find(params[:id])\n\n respond_to do |format|\n if @person_verse.update_attributes(params[:person_verse])\n flash[:notice] = 'PersonVerse was successfully updated.'\n format.html { redirect_to(@person_verse) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\", :layout => \"main\" }\n format.xml { render :xml => @person_verse.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(uid, params, membership)\n data = {\n initials: (params[4].nil? ? params[5][0] : params[4].tr('^a-zA-Z', '')),\n email: (params[3].nil? ? 'unknown@nieuwedelft.nl.invalid' : params[3]),\n gender: params[9] == 'Vrouw' ? 'F' : 'M',\n phone: params[14],\n mobile: params[2],\n phone_parents: params[24],\n address: [params[10], params[11], params[12]].join(' '),\n membership: membership,\n }\n begin\n unless params[15].nil?\n data[:dateofbirth] = Date.strptime(params[15], '%d-%m-%Y').strftime('%Y-%m-%d')\n end\n rescue\n $problems.write \"#{$index}, #{data[:firstname]} #{data[:lastname]}, Birthdate ignored\\n\"\n end\n patch(\"https://people.i.bolkhuis.nl/persons/#{uid}\", data)\n\n # Send payload to operculum\n put(\"https://operculum.i.bolkhuis.nl/person/#{uid}\", {\n nickname: params[8],\n study: params[16],\n alive: params[17].nil?,\n inauguration: params[25],\n resignation_letter: params[26],\n resignation: params[27],\n })\nend",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participant }\n end\n end",
"def update\n @meeting = Meeting.find(params[:id])\n\n respond_to do |format|\n if developer?\n #take care of meeting participants\n param_users = (params[:users].map {|i| i.to_i} rescue []).to_set\n meeting_users = (@meeting.meeting_participants.map {|mp| mp.user.id}).to_set\n (param_users - meeting_users).each {|uid| MeetingParticipant.create(:user => User.find(uid), :meeting => @meeting)}\n (meeting_users - param_users).each {|uid| MeetingParticipant.find(:first, :conditions => [\"meeting_id = ? and user_id = ?\", @meeting.id, uid]).destroy rescue nil}\n\n if @meeting.update_attributes(params[:meeting])\n flash[:notice] = 'Meeting was successfully updated.'\n format.html { redirect_to(iteration_stories_url(@meeting.iteration)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meeting.errors, :status => :unprocessable_entity }\n end\n else\n format.xml { render :xml => XML_ERRORS[:not_authorized] }\n end\n end\n end",
"def update\n @recipient = @user.recipients.find(params[:id])\n\n respond_to do |format|\n if @recipient.update_attributes(params[:recipient])\n format.html { redirect_to(user_recipients_path(@user), :notice => 'Recipient was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recipient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @participant_contact_email = Participant::Contact::Email.find(params[:id])\n\n respond_to do |format|\n if @participant_contact_email.update_attributes(params[:participant_contact_email])\n format.html { redirect_to(@participant_contact_email, :notice => 'Email was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participant_contact_email.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @participants = Participant.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.xml { render :xml => @participants }\n end\n end",
"def update\n respond_to do |format|\n if @participant_type.update(participant_type_params)\n format.html { redirect_to @participant_type, notice: 'Participant type was successfully updated.' }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def destroy\n @participant.destroy\n flash[:notice] = 'Participant was successfully removed.'\n respond_to do |format|\n format.html { redirect_to(meeting_participants_path(@meeting)) }\n format.xml { head :ok }\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end"
] | [
"0.70595413",
"0.67215466",
"0.65886676",
"0.6568778",
"0.649423",
"0.6486298",
"0.6454561",
"0.6453501",
"0.640855",
"0.63106656",
"0.6295969",
"0.62650514",
"0.6241024",
"0.61904854",
"0.6134768",
"0.6086217",
"0.6079291",
"0.6013151",
"0.6009334",
"0.6009334",
"0.5967649",
"0.59533405",
"0.59432095",
"0.5917553",
"0.59159535",
"0.5880869",
"0.5880869",
"0.5880869",
"0.5880869",
"0.5880869",
"0.5880869",
"0.5880869",
"0.5880869",
"0.5880869",
"0.5880869",
"0.5880869",
"0.5880869",
"0.5880869",
"0.5880869",
"0.5880869",
"0.586865",
"0.58414304",
"0.5837918",
"0.5834825",
"0.5830312",
"0.582802",
"0.58093435",
"0.5798589",
"0.57621235",
"0.5753641",
"0.57469356",
"0.57354313",
"0.57257426",
"0.5714114",
"0.56756675",
"0.56647474",
"0.5652496",
"0.5601377",
"0.5596027",
"0.5579506",
"0.5569909",
"0.5569909",
"0.5556866",
"0.55563486",
"0.5547216",
"0.55431205",
"0.5517811",
"0.5517811",
"0.55171704",
"0.55009204",
"0.55009204",
"0.55009204",
"0.549818",
"0.5494896",
"0.5490274",
"0.54897106",
"0.548851",
"0.5483419",
"0.5480389",
"0.54671735",
"0.5458636",
"0.54552096",
"0.545392",
"0.54467136",
"0.5444714",
"0.5443584",
"0.5441919",
"0.5422598",
"0.5411609",
"0.54073626",
"0.5394577",
"0.5381207",
"0.5373488",
"0.53719354",
"0.53584695",
"0.53502744",
"0.53466606",
"0.5344193",
"0.534235",
"0.5326678",
"0.5322149"
] | 0.0 | -1 |
DELETE /participants/1 DELETE /participants/1.xml | def destroy
scan_procedure_array = (current_user.edit_low_scan_procedure_array).split(' ').map(&:to_i)
hide_date_flag_array = (current_user.hide_date_flag_array).split(' ').map(&:to_i)
@hide_page_flag = 'N'
if hide_date_flag_array.count > 0
@hide_page_flag = 'Y'
end
# @participant = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_visit_memberships.enrollment_id from enrollment_visit_memberships where enrollment_visit_memberships.visit_id in
# (select visit_id from scan_procedures_visits where scan_procedure_id in (?)))) ", scan_procedure_array).find(params[:id])
@participant = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in
(select enrollment_vgroup_memberships.enrollment_id from enrollment_vgroup_memberships, scan_procedures_vgroups
where enrollment_vgroup_memberships.vgroup_id = scan_procedures_vgroups.vgroup_id and scan_procedures_vgroups.scan_procedure_id in (?))) ", scan_procedure_array).find(params[:id])
@participant.destroy
respond_to do |format|
format.html { redirect_to(participants_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\r\n @participant.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(participants_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @participant = Participant.find(params[:id])\n @participant.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 @participant.destroy\n flash[:notice] = 'Participant was successfully removed.'\n respond_to do |format|\n format.html { redirect_to(meeting_participants_path(@meeting)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @participants = Participant.find(params[:id])\n success = @participants.destroy\n\n if success and @participants.errors.empty?\n AuditTrail.audit(\"Participant #{@participants.fullname} destroyed by #{current_user.login}\")\n flash[:success] = \"Participant #{@participants.fullname} destroyed\"\n else\n flash[:error] = @participants.errors.full_messages\n end\n respond_to do |format|\n format.html { redirect_to(participants_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @transaction_participant = Transaction::Participant.find(params[:id])\n @transaction_participant.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_participants_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @participante = Participante.find(params[:id])\n @participante.destroy\n\n respond_to do |format|\n format.html { redirect_to(participantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @participante = Participante.find(params[:id])\n @participante.destroy\n\n respond_to do |format|\n format.html { redirect_to(participantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\t@participant.destroy\n\n\t\thead :no_content\n\tend",
"def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.studysite.destroy_all\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: '' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipient = @user.recipients.find(params[:id])\n @recipient.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_recipients_path(@user)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to admin_participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Participant was successfully destroyed.' }\n end\n end",
"def destroy\n @participant.destroy\n respond_with(@participant)\n end",
"def destroy\n @participant.destroy\n respond_with(@participant)\n end",
"def destroy\n @participant.destroy\n flash[:success] = 'Participant was successfully destroyed.'\n redirect_to participants_url\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n Partextra.where(participant_id: @participant.id).destroy_all\n Badge.where(participant_id: @participant.id).destroy_all\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def destroy\n @annex1_project_participant = Annex1ProjectParticipant.find(params[:id])\n @annex1_project_participant.destroy\n\n respond_to do |format|\n format.html { redirect_to annex1_project_participants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @participant.destroy\n # respond_to do |format|\n # format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def delete\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n\n if user != nil and meeting != nil\n participants = meeting.participants\n meeting.participants.delete(participants)\n meeting.delete\n self.send_ok\n else\n self.send_error 401\n end\n end",
"def destroy\n @activity_participant.destroy\n respond_to do |format|\n format.html { redirect_to activity_participants_url, notice: \"Participant was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant_contact_email = Participant::Contact::Email.find(params[:id])\n @participant_contact_email.destroy\n\n respond_to do |format|\n format.html { redirect_to(participant_contact_emails_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if current_user.admin?\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: \"Participant was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end \n end",
"def destroy\n @partner_person = PartnerPerson.find(params[:id])\n @partner_person.destroy\n @title = \"association partner <--> people\"\n\n respond_to do |format|\n format.html { redirect_to(partner_people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @partner = Partner.find(params[:id])\n @partner.destroy\n\n respond_to do |format|\n format.html { redirect_to partners_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person_verse = PersonVerse.find(params[:id])\n @person_verse.destroy\n\n respond_to do |format|\n format.html { redirect_to(person_verses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @correspondence = Correspondence.find(params[:id])\n @correspondence.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy if @person.users.empty?\n \n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to event_participants_url(@event), notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user = @person.user\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_people_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @relatorio = Relatorio.find(params[:id])\n @relatorio.destroy\n\n respond_to do |format|\n format.html { redirect_to(home_path) }\n format.xml { head :ok }\n end\n end",
"def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to(emple_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @conference.destroy\n\n respond_to do |format|\n format.html { redirect_to(conferences_path) }\n format.xml { head :ok }\n end\n end",
"def removeFromTournament\n @tournament = Tournament.find(params[:tournament_id])\n \t@team = Team.find(params[:id])\n \t@tournament.teams.delete(@team)\n\t\n respond_to do |format|\n format.html { redirect_to(tournament_path(@tournament)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @conference = Conference.find(params[:id])\n @conference.destroy\n\n respond_to do |format|\n format.html { redirect_to(conferences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invitee = Invitee.find(params[:id])\n @invitee.destroy\n\n respond_to do |format|\n format.html { redirect_to(invitees_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @corporacion_policiaca = CorporacionPoliciaca.find(params[:id])\n if @corporacion_policiaca.participantes.empty?\n @corporacion_policiaca.destroy\n flash[:notice] = \"Registro eliminado correctamente\"\n else\n flash[:error] = \"Registro no se pudo eliminar\"\n end\n\n respond_to do |format|\n format.html { redirect_to(corporacion_policiacas_url) }\n format.xml { head :ok }\n end\n end",
"def remove_participant\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n participant_ids = params[\"participant_ids\"]\n\n if user != nil and meeting != nil and participant_ids.length > 0\n participant_ids.each do |participant_id|\n if meeting.participants.exists?(participant_id)\n # remove all the participant's votes from each suggestion\n meeting.suggestions.each do |suggestion|\n vote = Vote.where(:voter_id => participant_id, :suggestion_id => suggestion.id)\n if vote != nil\n suggestion.votes.delete(vote)\n end\n end\n meeting.participants.delete(User.find(participant_id))\n end\n end\n self.send_ok\n else\n self.send_error 401\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to( :action => 'index' ) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @participant = @school.participants.find(params[:id])\n @participant.remove_school_teams(current_user.id, @school)\n @participant.destroy\n\n respond_to do |format|\n Notifier.participant_deleted(@participant,@school).deliver\n format.html { redirect_to admin_tools_personnel_url }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to(personas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @listener = Listener.find(params[:id])\n @listener.destroy\n\n respond_to do |format|\n format.html { redirect_to(listeners_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @followership = Followership.find(params[:id])\n @followership.destroy\n\n respond_to do |format|\n format.html { redirect_to(followerships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @participant = Participant.find(params[:id])\n\t\tif @participant.ganador_flag\n\t\t\t@ganador = Ganador.find_by_id_participante(@participant.id)\n\t\t\t@ganador.destroy\n\t\tend\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @committeemember = Committeemember.find(params[:id])\n @committeemember.destroy\n\n respond_to do |format|\n format.html { redirect_to(club_committees_path(params[:club_id])) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @passage = Passage.find(params[:id])\n @passage.destroy\n\n respond_to do |format|\n format.html { redirect_to(passages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n \n \n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n email = @participant.email\n @participant.rankings\n @participant.destroy\n flash[:success] = \"Successfully deleted participant #{email}.\"\n redirect_to display_project_participants_path(@participant.project_id)\n end",
"def destroy\n @telefono = @persona.telefonos.find(params[:id])\n @telefono.destroy\n\n respond_to do |format|\n format.html { redirect_to(persona_telefonos_url(@persona)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invite_friend = InviteFriend.find(params[:id])\n @invite_friend.destroy\n\n respond_to do |format|\n format.html { redirect_to invite_friends_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @chirp = Chirp.find(params[:id])\n @chirp.destroy\n\n respond_to do |format|\n format.html { redirect_to(chirps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n @supervisor_estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to(supervisor_estagios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pneighbour = Pneighbour.find(params[:id])\n @pneighbour.destroy\n\n respond_to do |format|\n format.html { redirect_to(pneighbours_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @click_to_talk = ClickToTalk.find(params[:id])\n @click_to_talk.destroy\n\n respond_to do |format|\n format.html { redirect_to(click_to_talks_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def remove\n @user = User.find(params[:id])\n @study.contacts.delete(@user)\n\n respond_to do |format|\n format.xml { head :ok }\n format.js\n end\n end",
"def destroy\n @student_correspondence = StudentCorrespondence.find(params[:id])\n @student_correspondence.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_correspondences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @volunteer = Volunteer.find(params[:id])\n @volunteer.destroy\n\n respond_to do |format|\n format.html { redirect_to(volunteers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @volunteer = Volunteer.find(params[:id])\n @volunteer.destroy\n\n respond_to do |format|\n format.html { redirect_to(volunteers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @volunteer = Volunteer.find(params[:id])\n @volunteer.destroy\n\n respond_to do |format|\n format.html { redirect_to(volunteers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n logger.info(\"#{Time.now} Se elimina el miembro ##{@member.id}!\")\n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @counterparty = Counterparty.find(params[:id])\n @counterparty.destroy\n\n respond_to do |format|\n format.html { redirect_to(counterparties_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invite_request = InviteRequest.find(params[:id])\n @invite_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(invite_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @recipient = Recipient.find(params[:id])\n @recipient.destroy\n\n respond_to do |format|\n format.html { redirect_to recipients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n pedigree = @person.pedigree\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(pedigree_url(pedigree)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @nom = Nom.find(params[:id])\n @nom.destroy\n\n respond_to do |format|\n format.html { redirect_to(noms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @people = People.find(params[:id])\n @people.destroy\n\n respond_to do |format|\n format.html { redirect_to(peoples_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @recipient = Recipient.find(params[:id])\n @recipient.destroy\n\n respond_to do |format|\n format.html { redirect_to recipients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @talk = Talk.find(params[:id])\n @talk.destroy\n\n respond_to do |format|\n format.html { redirect_to(talks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @election = Election.find(params[:id])\n @election.destroy\n\n respond_to do |format|\n format.html { redirect_to(elections_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trial = Trial.find(params[:id])\n @trial.destroy\n\n respond_to do |format|\n format.html { redirect_to(trials_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trial = Trial.find(params[:id])\n @trial.destroy\n\n respond_to do |format|\n format.html { redirect_to(trials_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @telecom_room = TelecomRoom.find(params[:id])\n @telecom_room.destroy\n\n respond_to do |format|\n format.html { redirect_to(telecom_rooms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @utilisateur = Utilisateur.find(params[:id])\n @utilisateur.destroy\n\n respond_to do |format|\n format.html { redirect_to(utilisateurs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @participant_type.destroy\n respond_to do |format|\n format.html { redirect_to participant_types_url }\n end\n end",
"def destroy\n @differentiator_answer = DifferentiatorAnswer.find(params[:id])\n @differentiator_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(differentiator_answers_url) }\n format.xml { head :ok }\n end\n end",
"def delete_participant(account_id,\r\n participant_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/participants/{participantId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'participantId' => { 'value' => participant_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end"
] | [
"0.73595655",
"0.7291958",
"0.72203684",
"0.719783",
"0.7180345",
"0.7086956",
"0.7086956",
"0.7050125",
"0.6904703",
"0.6904703",
"0.6884381",
"0.6838106",
"0.6752201",
"0.6752201",
"0.6716238",
"0.66887695",
"0.6665926",
"0.6664324",
"0.6657975",
"0.6657975",
"0.6630124",
"0.6594805",
"0.6594805",
"0.6594805",
"0.6580024",
"0.65787274",
"0.6577567",
"0.655675",
"0.6548996",
"0.6534051",
"0.64885944",
"0.64688194",
"0.6456961",
"0.64569503",
"0.64100426",
"0.6399195",
"0.6399195",
"0.6399195",
"0.6399195",
"0.6399195",
"0.6399195",
"0.6399195",
"0.6399195",
"0.6382319",
"0.63707316",
"0.6352031",
"0.63466907",
"0.63466907",
"0.6329331",
"0.63253397",
"0.63213813",
"0.63193744",
"0.631253",
"0.6312454",
"0.6299731",
"0.6291935",
"0.6291644",
"0.62805223",
"0.6269952",
"0.6261739",
"0.62550527",
"0.6253384",
"0.6245527",
"0.62446195",
"0.62443656",
"0.6235455",
"0.62309366",
"0.6222611",
"0.622137",
"0.6221152",
"0.6204874",
"0.6192102",
"0.6184736",
"0.61828774",
"0.61825526",
"0.618219",
"0.61668867",
"0.61650527",
"0.61630476",
"0.61598504",
"0.61598504",
"0.61598504",
"0.6158806",
"0.6157183",
"0.615219",
"0.6148973",
"0.6148577",
"0.61449206",
"0.6133731",
"0.61309004",
"0.6127386",
"0.61272824",
"0.612663",
"0.6120923",
"0.6120923",
"0.61184084",
"0.61177945",
"0.6116467",
"0.61162",
"0.611064",
"0.61051315"
] | 0.0 | -1 |
returns an error string if it exists, otherwise just the error code | def get_error(error)
string = ''
if @@errors[error]
string = @@errors[error]
else
string = sprintf('0x%.8x',error)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_error_code\n codes = get_error_codes\n return '' if codes.empty?\n codes[0]\n end",
"def geterrorcode()\r\n return getvalue(@@ERROR_CODE)\r\n end",
"def error_code\n @data[\"code\"] || 0\n end",
"def code\n @errorcode\n end",
"def error_text(error_code)\n ERRORS[error_code.to_i]\n end",
"def code\n @error['code']\n end",
"def get_error_text\n if error_code == CartoDB::NO_ERROR_CODE\n CartoDB::NO_ERROR_CODE\n elsif error_code.blank? || error_code == GENERIC_ERROR_CODE\n connector_error_message || CartoDB::IMPORTER_ERROR_CODES[GENERIC_ERROR_CODE]\n else\n CartoDB::IMPORTER_ERROR_CODES[error_code]\n end\n end",
"def lookup_error_code(err)\n @@ErrorPatternsToCode.each do |rx,code|\n return code if rx =~ err\n end\n @@UnknownErrorCode\n end",
"def error\n return {error: \"\"}\n end",
"def error_string\n # This method should be overridden\n end",
"def error_msg\n name\n end",
"def error_message\n err = details[\"err\"] || details[\"errmsg\"] || details[\"$err\"]\n if code = details[\"code\"]\n \"failed with error #{code}: #{err.inspect}\\n\\n\" <<\n \"See #{ERROR_REFERENCE}\\nfor details about this error.\"\n elsif code = details[\"assertionCode\"]\n assertion = details[\"assertion\"]\n \"failed with error #{code}: #{assertion.inspect}\\n\\n\" <<\n \"See #{ERROR_REFERENCE}\\nfor details about this error.\"\n else\n \"failed with error #{err.inspect}\"\n end\n end",
"def error(rc)\n return rc[0].strip if rc[2].success?\n\n puts \"ERROR: #{rc[1]}\"\n\n exit(-1)\nend",
"def evaluate_error_message(error_code)\n case error_code\n when '0' then\n return 'We did not find a candidate profile matching your account. Please fill out your candidate profile first.'\n when '1' then\n return 'We did not find a faculty profile matching your account. Please fill out your faculty profile first.'\n when '2' then\n return 'We did not find the application form you are creating an appointment for.'\n else\n return 'Sorry. This page has encountered an error.'\n end\n else\n end",
"def error_message\n if error == 'on_reserve'\n 'another user has already reserved this item'\n elsif error == 'too_many'\n \"you cannot renew a loan more than 10 times\"\n elsif code == 'PatronNotFound'\n 'problem with user id - please contact an administrator for assistance'\n end\n end",
"def error(string); end",
"def error(string); end",
"def error_code\n extract_raw_value __callee__\n end",
"def error_code\n @request['error']['code'].to_i\n end",
"def error(ex) [:error, ex]; end",
"def error\n return if success? unless parse_error?\n @data['error'] || @data['message']\n end",
"def error\n return nil if reply_code == \"0000\" \n return \"#{reply_text}\"\n end",
"def error_message\n error.message\n end",
"def error\n return unless error?\n err || GenericError.new(error_code, error_msg)\n end",
"def get_error_code(code)\n assert_not_nil @rdigg.info.get_error_code(\"500\")\n end",
"def error_number; end",
"def error_message\n return @error_message\n end",
"def error_message; end",
"def error\n return unless id.nil?\n @error ||= @response['message']\n end",
"def get_message(key)\n msg = error_messages[key]\n return msg.nil? ? 'An unspecified error occurred.' : msg\n end",
"def error\r\n\t\t\t`#{BITS::BITSADMIN} /geterror {#{@id}}`\r\n\t\tend",
"def get_error_message(error)\n case error\n when Dentaku::UnboundVariableError\n vars = error.unbound_variables\n t 'errors.unbound_variable', count: vars.size,\n vars: map_to_code(vars).to_sentence,\n prefix: Bot.prefix\n when Dentaku::ParseError\n case error.reason\n when :undefined_function\n t('errors.parse.undefined_function', func: error.meta[:function_name])\n when :too_many_operands\n t('errors.parse.too_many_operands')\n when :too_few_operands\n t('errors.parse.too_few_operands')\n else\n t('errors.unknown')\n end\n when Dentaku::TokenizerError\n case error.reason\n when :too_many_opening_parentheses\n t('errors.token.open_paren')\n when :too_many_closing_parentheses\n t('errors.token.close_paren')\n else\n t('errors.unknown')\n end\n when ZeroDivisionError\n t('errors.div_zero')\n when Math::DomainError\n t('errors.domain')\n else\n t('errors.unknown')\n end\n end",
"def error_code\n if ( @error_code ||= nil ).nil?\n @error_code = jdbc_exception ? jdbc_exception.getErrorCode : nil\n else\n @error_code\n end\n end",
"def error_msg\n ERROR_MSG[upcase_class_sym]\n end",
"def message\n @errormsg\n end",
"def error_code\n raise BASICRuntimeError.new(:te_err_no_err) if @error_stack.empty?\n\n code = @error_stack[-1]\n NumericConstant.new(code)\n end",
"def error\n valid? ? nil : @error_message\n end",
"def shell_error_string ( e )\n if e > 32\n return nil\n else\n return case e\n when 0 then \"Out of memory or resources\"\n #define ERROR_FILE_NOT_FOUND 2L\n #define SE_ERR_FNF 2\n when 2 then \"File not found\"\n #define ERROR_PATH_NOT_FOUND 3L\n #define SE_ERR_PNF 3\n when 3 then \"Path not found\"\n #define SE_ERR_ACCESSDENIED 5\n when 5 then \"Access denied\"\n #define SE_ERR_OOM 8\n when 8 then \"Not enough memory\"\n #define ERROR_BAD_FORMAT 11L\n when 11 then \"Invalid exe\"\n #define SE_ERR_SHARE 26\n when 26 then \"Sharing violation\"\n #define SE_ERR_ASSOCINCOMPLETE 27\n when 27 then \"Invalid file association\"\n #define SE_ERR_DDETIMEOUT 28\n when 28 then \"DDE timeout\"\n #define SE_ERR_DDEFAIL 29\n when 29 then \"DDE fail\"\n #define SE_ERR_DDEBUSY 30\n when 30 then \"DDE busy\"\n #define SE_ERR_NOASSOC 31\n when 31 then \"No file association\"\n #define SE_ERR_DLLNOTFOUND 32\n when 32 then \"DLL not found\"\n else \"Unspecified error\"\n end # case\n end # else\nend",
"def errors_handling(err_code)\n\n\t\terr_code = err_code.to_i + 32000\n\n\t\t# PJL File System Errors (32xxx)\n\t\tfs_errors = {\n\t\t\t'32000' => 'General error',\n\t\t\t'32001' => 'Volume not available',\n\t\t\t'32002' => 'Disk full',\n\t\t\t'32003' => 'File not found',\n\t\t\t'32004' => 'No free file descriptors',\n\t\t\t'32005' => 'Invalid number of bytes',\n\t\t\t'32006' => 'File already exists',\n\t\t\t'32007' => 'Illegal name',\n\t\t\t'32008' => 'Can\\'t delete root',\n\t\t\t'32009' => 'File operation attempted on a directory',\n\t\t\t'32010' => 'Directory operation attempted on a file',\n\t\t\t'32011' => 'Not same volume',\n\t\t\t'32012' => 'Read only',\n\t\t\t'32013' => 'Directory full',\n\t\t\t'32014' => 'Directory not empty',\n\t\t\t'32015' => 'Bad disk',\n\t\t\t'32016' => 'No label',\n\t\t\t'32017' => 'Invalid parameter',\n\t\t\t'32018' => 'No contiguous space',\n\t\t\t'32019' => 'Can\\'t change root',\n\t\t\t'32020' => 'File Descriptor obsolete',\n\t\t\t'32021' => 'Deleted',\n\t\t\t'32022' => 'No block device',\n\t\t\t'32023' => 'Bad seek',\n\t\t\t'32024' => 'Internal error',\n\t\t\t'32025' => 'Write only',\n\t\t\t'32026' => 'Write protected',\n\t\t\t'32027' => 'No filename',\n\t\t\t'32051' => 'End of directory',\n\t\t\t'32052' => 'No file system',\n\t\t\t'32053' => 'No memory',\n\t\t\t'32054' => 'Vol name out of range',\n\t\t\t'32055' => 'Bad FS',\n\t\t\t'32056' => 'Hardware failure'\n\t\t}\n\n\t\tif (fs_errors.has_key?(err_code.to_s))\n\t\t\treturn fs_errors[err_code.to_s]\n\t\telse\n\t\t\treturn 'Bad command or error'\n\t\tend\n\tend",
"def errors_handling(err_code)\n\n\t\terr_code = err_code.to_i + 32000\n\n\t\t# PJL File System Errors (32xxx)\n\t\tfs_errors = {\n\t\t\t'32000' => 'General error',\n\t\t\t'32001' => 'Volume not available',\n\t\t\t'32002' => 'Disk full',\n\t\t\t'32003' => 'File not found',\n\t\t\t'32004' => 'No free file descriptors',\n\t\t\t'32005' => 'Invalid number of bytes',\n\t\t\t'32006' => 'File already exists',\n\t\t\t'32007' => 'Illegal name',\n\t\t\t'32008' => 'Can\\'t delete root',\n\t\t\t'32009' => 'File operation attempted on a directory',\n\t\t\t'32010' => 'Directory operation attempted on a file',\n\t\t\t'32011' => 'Not same volume',\n\t\t\t'32012' => 'Read only',\n\t\t\t'32013' => 'Directory full',\n\t\t\t'32014' => 'Directory not empty',\n\t\t\t'32015' => 'Bad disk',\n\t\t\t'32016' => 'No label',\n\t\t\t'32017' => 'Invalid parameter',\n\t\t\t'32018' => 'No contiguous space',\n\t\t\t'32019' => 'Can\\'t change root',\n\t\t\t'32020' => 'File Descriptor obsolete',\n\t\t\t'32021' => 'Deleted',\n\t\t\t'32022' => 'No block device',\n\t\t\t'32023' => 'Bad seek',\n\t\t\t'32024' => 'Internal error',\n\t\t\t'32025' => 'Write only',\n\t\t\t'32026' => 'Write protected',\n\t\t\t'32027' => 'No filename',\n\t\t\t'32051' => 'End of directory',\n\t\t\t'32052' => 'No file system',\n\t\t\t'32053' => 'No memory',\n\t\t\t'32054' => 'Vol name out of range',\n\t\t\t'32055' => 'Bad FS',\n\t\t\t'32056' => 'Hardware failure'\n\t\t}\n\n\t\tif (fs_errors.has_key?(err_code.to_s))\n\t\t\treturn fs_errors[err_code.to_s]\n\t\telse\n\t\t\treturn 'Bad command or error'\n\t\tend\n\tend",
"def error_message\n return '' if url.nil? || status_code == 200\n\n case status_code\n when 400\n 'The URL was not entered correctly. Be sure to use http:// or https:// to start all URLS'\n when 401\n 'The URL was not authorized for download.'\n when 403..404\n 'The URL was not found.'\n when 410\n 'The requested URL is no longer available.'\n when 411\n 'URL cannot be downloaded, please link directly to data file'\n when 414\n \"The server will not accept the request, because the URL #{url} is too long.\"\n when 408, 499\n 'The server timed out waiting for the request to complete.'\n when 409\n \"You've already added this URL in this version.\"\n when 500..511\n 'Encountered a remote server error while retrieving the request.'\n else\n 'The given URL is invalid. Please check the URL and resubmit.'\n end\n end",
"def http_err_code\n http_codes[@http_err]\n end",
"def error_msg\n IBM_DB.getErrormsg(@conn, IBM_DB::DB_CONN)\n end",
"def error_message\n @response.reason_phrase\n end",
"def errmsg(message); end",
"def error\n errors.full_messages.first\n end",
"def error message\n message = \"ERROR: \" + process_message(message)\n output_message message, @error_color if valid_conditions 3\n end",
"def get_error_message(str)\n tmp=str.split(/\\n/)\n return \"Unknown error\" if !tmp[0]\n tmp[0]\n end",
"def failed_message\n Online::OPERATION_FAILED_ADVICES[@data['error_code'].to_i || \"Errore sconosciuto (#{error_code})\"]\n end",
"def error_message(obj, name = \"\")\n if name.present? && obj.get_operation_result.code.zero?\n \"Could not find user '#{name}'\"\n else\n \"#{obj.get_operation_result.message} (code #{obj.get_operation_result.code})\"\n end\n end",
"def describe_error\n message = \"\"\n if self.account_number == nil\n message = message + I18n.t(:wrong_or_missing_account_number, :scope => [:model, :index]) + \" \"\n end\n if self.account_bank_number == nil\n message = message + I18n.t(:wrong_or_missing_account_bank_number, :scope => [:model, :index]) + \" \"\n end\n if self.student.uic == nil\n message = message + I18n.t(:missing_uic, :scope => [:model, :index]) + \" \"\n end\n if self.sident == -666\n message = message + I18n.t(:missing_sident_666, :scope => [:model, :index]) + \" \"\n end\n if self.sident == nil\n message = message + I18n.t(:missing_sident, :scope => [:model, :index]) + \" \"\n end\n return message\n\n end",
"def get_error_message(str)\n tmp=str.scan(/^ERROR MESSAGE --8<------\\n(.*?)ERROR MESSAGE ------>8--$/m)\n return \"Error message not available\" if !tmp[0]\n tmp[0][0].strip\n end",
"def error_string\n LibZMQ.zmq_strerror(errno).read_string\n end",
"def error\n errors.first\n end",
"def error\n errors.first\n end",
"def message\n \"Telphin returned an error #{@error_code}: '#{@error_msg}'\"\n end",
"def get_error(error_text,tenant_id)\n error = Error.find_by_error_text_and_tenant_id(error_text.downcase,tenant_id)\n if error.nil? or error.blank?\n error = create_error(error_text.downcase,tenant_id)\n end\n return error.id\n end",
"def getError\n return @error\n end",
"def error_message\n @@state[@server] ? @@state[@server][:message] : \"\"\n end",
"def request_error( err_str )\n case err_str\n when \"MAINTENANCE COMPANY NOT SPECIFIED\"\n return \"יש לבחור חברת אחזקה\";\n else\n return translate( \"QUERY_ERROR_#{err_str}\" );\n end\n end",
"def connection_error_msg\n if not connection_valid?\n return status.message\n end\n end",
"def refute_error(error_code)\n refute_nil error_code if error_code.nil?\n return if error_code >= 0\n name = UV.err_name(error_code) || error_code\n msg = UV.strerror(error_code)\n raise RuntimeError, \"#{msg} - #{name}\", caller\nend",
"def error\n params[\"ErrDesc\"]\n end",
"def error_message (errors)\n\tmessage = \"\"\n\terror_array = errors.split\n\n\terror_array.each do |error|\n\t\tcase error\n\t\twhen \"name\"\n\t\t\tmessage += \"Invalid Name \\n\"\n\t\twhen \"email\"\n\t\t\tmessage += \"Invalid Email \\n\"\n\t\twhen \"dup\"\n\t\t\tmessage += \"Duplicate Name \\n\"\n\t\twhen \"bName\"\n\t\t\tmessage += \"Invalid Business Name \\n\"\n\t\tend\n\tend\n\t\n\treturn message\nend",
"def error_name\n self.class.error_name\n end",
"def error_name\n self.class.error_name\n end",
"def error\n @error\n end",
"def oracle_error_codes(e)\n string = case\n when e.code == 1400 : \"At least one of the required fields is blank and cannot be. Please fill in required fields.\\n\" << e\n when e.code == 1407 : \"At least one of the required fields is blank and cannot be. Please fill in required fields.\\n\" << e \n when e.code == 20000 : \"ERROR! This stored procedure is broken.\\n\" << e\n when e.code == 12899 : \"One of your values is too large.\\n\" << e\n when e.code == 20024 : \"Incorrect username or password.\\n\" << e\n when e.code == 20025 : \"Incorrect username or password.\\n\" << e\n when e.code == 1459 : \"Please fill in the required fields.\\n\" << e\n else nil\n end \n end",
"def error\n return @error\n end",
"def error_message\n @error_message || \"Could not log in\"\n end",
"def error(str, opts = { print: true })\n str = str.dup.to_s\n result = \"\"\n result += color? ? ANSI_CODES[:bold] + ANSI_CODES[:color][:red] : \"\"\n result += \"ERROR:\"\n result += color? ? ANSI_CODES[:reset] : \"\"\n result += \" \"\n result += str\n result += \"\\n\"\n print_or_return(result, opts[:print])\n end",
"def error\n\t\t\t\t\"ERROR\"\n\t\t\tend",
"def error\n data['error']\n end",
"def error\n errors.first\n end",
"def message_from(response)\n if not response.has_key?(:ErrInfo)\n return 'Success'\n end\n\n # The ErrInfo key can contain a | separated string of multiple error\n # codes. By default we start at the end and work our way backwards to\n # try and find the highest-level one we can.\n if response[:ErrInfo].index('|')\n error_codes = response[:ErrInfo].split('|')\n else\n error_codes = [response[:ErrInfo]]\n end\n\n error_codes.reverse.each do |code|\n if ERROR_CODES.has_key?(code)\n return ERROR_CODES[code]\n end\n end\n\n \"Error #{error_codes[-1]}\"\n end",
"def to_s\n <<~ERROR\n ERROR [#{@code}]: #{@message}\n #{@errors.collect { |err| \"> #{err.code}: #{err.message}\" }.join \"\\n\"}\n ERROR\n end",
"def msg_ERROR(source, args)\n return args[0]\n end",
"def error_message\n if @errors\n @errors.map { |(k,v)|\n \"#{k} #{v.join(',')}\"\n }.join(\"; \")\n end\n end",
"def error_msg(code=ErrorCodes::INTERNAL_SERVER_ERROR, detail=\"Unspecified error\", errors = nil, data = nil)\n @response[:errors] = {\n code: code[:code],\n detail: detail,\n errors: errors,\n data: data\n }\n end",
"def error(body)\n parsed_body = JSON.parse(body)\n \"#{parsed_body['errorNum']}: #{parsed_body[\"errorMessage\"]}\"\n end",
"def first_error_message\n response_as_json[\"errors\"].first[\"message\"]\n end",
"def extract_error_code response\n return unless response\n return unless response['data'] && response['data'].class == Hash\n return unless response['data']['errorCode']\n\n response['data']['errorCode'].to_i\n end",
"def error\n nil\n end",
"def lookup_error(failed_operation = nil)\n error_no = FFI::LastError.error\n case error_no\n when 1223\n raise SystemCallError.new(\"The operation was canceled by the user\", error_no)\n when -2146885628\n raise SystemCallError.new(\"Cannot find object or property\", error_no)\n when -2146885629\n raise SystemCallError.new(\"An error occurred while reading or writing to a file.\", error_no)\n when -2146881269\n raise SystemCallError.new(\"ASN1 bad tag value met. -- Is the certificate in DER format?\", error_no)\n when -2146881278\n raise SystemCallError.new(\"ASN1 unexpected end of data.\", error_no)\n when -2147024891\n raise SystemCallError.new(\"System.UnauthorizedAccessException, Access denied..\", error_no)\n else\n raise SystemCallError.new(\"Unable to #{failed_operation} certificate.\", error_no)\n end\n end",
"def error\n %i[error fatal]\n end",
"def error_code(exception)\n case exception\n when Java::JavaSql::SQLException\n exception.getErrorCode\n else\n nil\n end\n end",
"def error\n @obj['error']\n end",
"def error\n @data['error']\n end",
"def error\n @data['error']\n end",
"def errnum\r\n self.class.errnum\r\n end",
"def error\n nil\n end",
"def error_msg\n return nil if result\n\n bad_emails = email_addresses.reject { |email| regex.match(email) }\n\n \"#{bad_emails.count == 1 ? 'Email does' : 'Emails do'} not meet criteria: #{bad_emails.join(', ')}\"\n end",
"def results_errno()\n r = attr_get(\"status\")\n if(r.eql?(\"passed\"))\n 0\n end\n r = attr_get(\"errno\")\n unless r\n r = -1\n end\n r\n end",
"def http_error_code_for(errors)\n if errors.any? { |message| message.include? CONFLICT_MESSAGE }\n :conflict\n else :unprocessable_entity end\n end",
"def error_message\n @data[\"message\"]\n end",
"def operation_error\n (connection.get_operation_result.code == 0) ? nil : connection.get_operation_result\n end",
"def serialize_error\n case error\n when Common::Exceptions::BaseError\n base_error\n when Common::Client::Errors::ClientError\n client_error\n when EMISRedis::VeteranStatus::NotAuthorized\n emis_error(:not_authorized)\n when EMISRedis::VeteranStatus::RecordNotFound\n emis_error(:not_found)\n when MPI::Errors::RecordNotFound\n mpi_error(404)\n when MPI::Errors::FailedRequestError\n mpi_error(503)\n when MPI::Errors::DuplicateRecords\n mpi_error(404)\n else\n standard_error\n end\n end",
"def check_error_no\n @error_no = 0\n if @err_bit\n if @data != nil && @data.size > 0\n @error_no = (0x0 - 0xFFFFFFFF + (BioPacket.swap_dword(@data.first) - 1)).to_i\n @error_desc = BioPacket.format_err_desc(@error_no)\n $test_logger.log(\"Error#{(\" in ACK\" if @ack_bit)}: #{@error_no} #{@error_desc}\")\n else \n $test_logger.log(\"Error bit is set but error code not found!!\")\n end\n end\n end",
"def error_line msg\n return \"llmk error: #{msg}\"\n end",
"def print_error(error_message)\n error \"An error occurred!\"\n if error_message.include? \"400\"\n # 400 error indicates a bad request. At this point, it's most likely that\n # the user has passed an invalid Font Family ID. However, the API also \n # returns a 400 error in the case that a new Kit is attempting to be\n # created when the user is at their maximim Kit capacity.\n say \"The API indicated that the request was bad.\"\n say \"It's likely because the entered Font Family ID was invalid,\"\n say \"or that you've reached your maximum Kit limit.\"\n elsif error_message.include? \"404\"\n # 404 error indicates that a resource wasn't found. This is likely \n # because of an invalid ID. This shouldn't show up, as the menu shouldn't\n # let the user make a request on an ID that doesn't exist, but it's still\n # a common error code so include some message for it.\n say \"The API indicated that it couldn't find the resource.\"\n say \"Make sure that the the Kit wasn't deleted while using this application.\"\n end\n end"
] | [
"0.83683896",
"0.759948",
"0.74977714",
"0.7461778",
"0.740444",
"0.7294125",
"0.7203687",
"0.7194286",
"0.71031255",
"0.70884675",
"0.70692676",
"0.7053955",
"0.7029813",
"0.7019458",
"0.6984064",
"0.6968237",
"0.6968237",
"0.6951904",
"0.69264865",
"0.6924769",
"0.6835028",
"0.68112",
"0.68088716",
"0.67950654",
"0.67823464",
"0.6782212",
"0.67332596",
"0.67212164",
"0.67098147",
"0.6707954",
"0.6703717",
"0.6701216",
"0.66545695",
"0.66388696",
"0.6632615",
"0.6632253",
"0.66296667",
"0.6628141",
"0.66254765",
"0.66254765",
"0.6619985",
"0.66118383",
"0.65838206",
"0.658288",
"0.65626276",
"0.656146",
"0.6560534",
"0.6559971",
"0.6517517",
"0.6498022",
"0.64786905",
"0.6476287",
"0.64730734",
"0.64727885",
"0.64727885",
"0.64705163",
"0.6467366",
"0.64671993",
"0.64459556",
"0.64458436",
"0.64423174",
"0.64413714",
"0.64203155",
"0.63959765",
"0.6393374",
"0.6393374",
"0.6384004",
"0.6363894",
"0.6360029",
"0.6357394",
"0.63558966",
"0.6355808",
"0.635112",
"0.6343484",
"0.6338707",
"0.6334821",
"0.6333057",
"0.6330965",
"0.63280594",
"0.63191944",
"0.63179076",
"0.6314242",
"0.6306639",
"0.6292982",
"0.6290617",
"0.62851244",
"0.6276323",
"0.6265362",
"0.6265362",
"0.6256955",
"0.6247641",
"0.6241565",
"0.62333727",
"0.620803",
"0.6199435",
"0.6195599",
"0.6185636",
"0.6185343",
"0.61837703",
"0.61781985"
] | 0.7057953 | 11 |
Actions for User Rights subform | def add_user_rights_row
@organization = Organization.find(params[:organization_id])
@new_ur_identity = Identity.find_or_create(params[:new_ur_identity_id])
@user_rights = user_rights(@organization.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def self_edit_only\n #if current_user.id != Integer(params[:id]) && !current_user.is_admin\n if !can_edit\n redirect_to user_url, :notice => \"You don't have permission to do that.\"\n else\n end\n end",
"def edit\n if current_user.access == 2\n redirect_to \"/users/indexU\"\n end\n end",
"def update_access_controls!\n update!(edit_users: permission_template.agent_ids_for(access: 'manage', agent_type: 'user'),\n edit_groups: permission_template.agent_ids_for(access: 'manage', agent_type: 'group'))\n end",
"def edit\n @user = User.find(params[:id])\n logger.tagged(\"edit current user: \") {logger.debug @current_user.attributes}\n #TODO : make sure permissions are handled correctly\n can_edit_hash = Permissions.currentLoggedInOrHasMorePermissions(@current_user,@user)\n logger.tagged(\"edit user perm hash: \") {logger.debug can_edit_hash}\n if can_edit_hash[:has_permission]\n can_destroy_hash = Permissions.hasMorePermissions(@current_user,@user)\n @can_destroy = can_destroy_hash[:has_permission]\n else\n flash[:warning] = can_edit_hash[:permission_message]\n redirect_to user_path(@user)\n end\n\n end",
"def edit\n authorize @user_information\n end",
"def edit\n require_user\n end",
"def user_permission_fields(form)\n ubiquo_user_roles = form.object.ubiquo_user_roles.map(&:role)\n check_boxes = @roles.map do |role|\n content_tag(\"div\", :class => \"form-item\") do\n label_tag(\"role\"+role.id.to_s, role.name) + ' ' +\n check_box_tag(\"ubiquo_user[role_ids][]\", role.id, ubiquo_user_roles.include?(role), {:class => \"checkbox\", :id => \"role\"+role.id.to_s})\n end\n end\n content_tag(\"fieldset\") do\n content_tag(\"legend\", t(\"ubiquo.auth.roles\")) + check_boxes.join(\"\\n\").html_safe\n end + hidden_field_tag(\"ubiquo_user[role_ids][]\", '')\n end",
"def edit\n authorize! :update, @user\n end",
"def edit\n enforce_update_permission(@user)\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 edit\n @user = User.all.deep.find(current_user.id)\n authorize! :edit, @user\n\n render 'users/settings'\n end",
"def edit\n @corr = Corrective.find(params[:id])\n if @corr.user.id != current_user.id || current_user.role == 0\n flash[:danger] = \"Permission Denied!\"\n redirect_to current_user\n end\n end",
"def edit_current_user\n end",
"def AccessRights=(arg0)",
"def user_permitted_to_edit(item)\n item.user == current_user \n end",
"def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end",
"def check_if_user_can_perform_action_on_user\n is_current_user = (admin_user == @item)\n current_user_is_root = admin_user.is_root? && is_current_user\n\n case params[:action]\n when 'edit'\n # Edit other items is not allowed unless current user is root\n # and is not the current user.\n not_allowed if admin_user.is_not_root? && !is_current_user\n when 'toggle', 'destroy'\n not_allowed if admin_user.is_not_root? || current_user_is_root\n when 'update'\n # Admin can update himself except setting the status to false!. Other\n # users can update their profile as the attributes (role & status)\n # are protected.\n status_as_boolean = params[@object_name][:status] == \"1\" ? true : false\n\n status_changed = !(@item.status == status_as_boolean)\n role_changed = !(@item.role == params[@object_name][:role])\n\n root_changed_his_status_or_role = current_user_is_root && (status_changed || role_changed)\n not_root_tries_to_change_another_user = admin_user.is_not_root? && !is_current_user\n\n not_allowed if root_changed_his_status_or_role || not_root_tries_to_change_another_user\n end\n end",
"def edit\n id = params[ :id ]\n\n if ( @current_user.restricted? and @current_user.id != id.to_i )\n return appctrl_not_permitted()\n end\n\n @user = User.find( id )\n @control_panel = @user.control_panel\n end",
"def edit\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n \t@user = User.find(params[:id])\n else \n redirect_to '/'\n end\n end",
"def create\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:role_id])\n access_right_hash = params[:access_right]\n \n if current_user.super_admin\n is_ok = true\n else\n current_user.roles.each { |r|\n r.access_rights.each { |ar|\n puts access_right_hash['model_name']\n if ar.model_name == access_right_hash['model_name'] && ar.action == access_right_hash['action']\n is_ok = true\n end\n }\n }\n end\n \n respond_to do |format|\n if is_ok\n @access_right = @role.access_rights.create(params[:access_right])\n @access_right.company_id = current_user.company_id\n @access_right.save\n format.html { redirect_to company_role_path(@company, @role) }\n else\n format.html { redirect_to company_role_path(@company, @role), notice: 'Usted no puede conceder este permiso.' }\n end\n end\n end",
"def user_access_control_all\n @user = User.find(params[:user_id])\n\n unless !@user.admin? && current_user.admin? || current_user?(@user)\n response_access_denied\n end\n\n rescue\n response_access_denied\n end",
"def edit\n authorize @volunteer_position\n end",
"def allows?(action, user)\n case action.to_sym\n when :view then user.may_edit or user == self\n when :edit then user.may_authorize or user == self\n else false\n end\n end",
"def update\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n #return render :text => params\n @user = User.find(params[:user][:id])\n if @user.update_attributes(params[:user])\n redirect_to :action => 'index'\n else\n render 'edit'\n end\n else \n redirect_to '/'\n end\n end",
"def facility_admin\n facility_controller_check\n unless current_user.role == \"site_admin\" || (@facility_role_access.present? && current_user.role == \"facility_admin\")\n flash[:error] = 'You are not authorized. Please request access from your manager'\n redirect_to root_url\n end\n end",
"def set_rights\n @rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def can_edit?(user)\n\n end",
"def user_edits\n redirect_to home_path if current_user != User.find(params[:id])\n end",
"def set_editability\n @editable = user_signed_in? && (current_user.member.role.name.eql? \"University Admin\") &&\n current_user.member.institution.id == @course.department.institution.id\n end",
"def access_control(object = nil)\n if object.present? && @cur_user.present?\n author = author?\n end\n perm = Permission\n perm.getReq(params[:controller], params[:action], request.request_method)\n redirect t('redirect.denied') unless perm.grant?(user_perm, author)\n end",
"def edit\n set_user\n end",
"def action_allowed?\n case params[:action]\n when 'edit'\n @questionnaire = Questionnaire.find(params[:id])\n current_user_has_admin_privileges? ||\n (current_user_is_a?('Instructor') && current_user_id?(@questionnaire.try(:instructor_id))) ||\n (current_user_is_a?('Teaching Assistant') && session[:user].instructor_id == @questionnaire.try(:instructor_id))\n else\n current_user_has_student_privileges?\n end\n end",
"def validate_permission\n unless current_user.permissions.include?(:sermons)\n flash[:error] = 'You do not have permission to edit Sermons.'\n redirect_to '/admin'\n end\n end",
"def update\n authorize! :assign_roles, @user if params[:user][:assign_roles]\n if @user.update_attributes(params[:user])\n redirect_to @user, notice: 'User was successfully updated.'\n else\n render \"edit\"\n end\n end",
"def can_edit\n redirect_to @tree unless @tree.can_edit? current_user\n end",
"def update\n load_user\n build_user\n assign_roles\n save_user or render :edit\n end",
"def reseller_allow_edit(permission)\n return reseller_right(permission) == 2\n end",
"def user_profile_edit\n\n\n end",
"def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end",
"def publisher_admin(role)\n\n can :manage, Publication, :publisher_id => role.publisher_id\n can :update, Publisher, :id => role.publisher_id\n can :update, IssueState\n can :update, AdminUser, :id => @user.id\n\n\n\n end",
"def modificar\n if user_signed_in?\n unless current_user.employee.nil?\n @permiso_modificar = false\n @security_role_type = Security::RoleType.find_by(name: \"Modificar\").name\n current_user.employee.security_profile.security_role.security_role_menus.each do |security_role_menu| \n if security_role_menu.security_menu.controller == params[:controller] \n security_role_menu.security_role_type_menus.each do |role_type|\n if @security_role_type == role_type.security_role_type.name\n @permiso_modificar = true\n break\n end\n end\n elsif params[:controller] == \"security/role_type_menus\"\n params[:controller] = \"security/roles\"\n if security_role_menu.security_menu.controller == params[:controller] \n security_role_menu.security_role_type_menus.each do |role_type|\n if @security_role_type == role_type.security_role_type.name\n @permiso_modificar = true\n break\n end\n end\n end\n end\n if params[:controller] == \"service/services\" && current_user.employee.provider_provider_id.nil?\n @permiso_modificar = true\n end\n end\n if current_user.username == \"aadmin\" \n @permiso_modificar = true\n end\n\n if params[:action] == \"edit\" && @permiso_modificar == false\n redirect_to root_path\n end\n return @permiso_modificar\n end\n end\n end",
"def edit\n @user = User.find(params[:id])\n authorize! :update, @user \n end",
"def set_access_rights\n # @access_rights = current_v1_user.rights.where(campground_id: params[:campground_id])\n @access_rights = User.find(1).rights.find_by(campground_id: params[:campground_id])\n end",
"def edit\n @user = User.friendly.find(params[:id])\n if not_owner_check(@user)\n redirect_to current_user\n end\n end",
"def update\n if any_unsub? && @user.update(user_updatable_params)\n # In case of Request #3 (unsubscriptions)\n # redirect_to confirmation for this request.\n redirect_to limit_right_confirmation_requests_path(user: @user)\n else\n #flash[:danger] = \"Erreur.\"\n if !any_unsub?\n flash[:danger]=\"Vous devez sélectionner au moins un choix\"\n end\n redirect_to limit_right_requests_path(user_id: @user.id)\n end\n end",
"def can_edit?(user)\n user == self.user\n end",
"def correct_user_to_edit\n not_allow if (@job.user.id != current_user.id) \n end",
"def only_admin\n if user_role == 'admin'\n else\n redirect_to clients_path, notice: \"У вас нет прав для просмотра даного раздела, или редактирования информации\"\n end\n end",
"def permits_write_access_for(user)\n end",
"def can_edit_users?\n ['reseller', 'admin'].include?(session[:usertype]) or session[:acc_user_manage].to_i == 2\n end",
"def permits_read_acccess_for(user)\n end",
"def edit\n authorize! :edit, @user, :id => current_user.id\n end",
"def update\n authorize! :update, @user, :message => \"No puedes tienes acceso a esta opcion.\"\n if @user.is_admin? \n @user.remove_role :admin\n end\n if @user.is_adminInv?\n @user.remove_role :adminInv \n end\n if @user.is_adminExt?\n @user.remove_role :adminExt\n end\n if @user.is_investigador?\n @user.remove_role :Investigador\n end\n \n @user.add_role(params[:role])\n @user.update(user_params)\n redirect_to usuarios_path, notice: 'Usuario fue actualizado.'\n end",
"def assign\n useraccount = Useraccount.find_by_username(params[:username])\n right = Right.find(params[:right_id])\n useraccount.rights << right\n \n redirect_to :action => 'rightassignment', :username => params[:username]\n end",
"def edit\n @car = Car.find(params[:id])\n\n if current_user.admin == true\n authorize @car\n end\n\n\n authorize @car\n end",
"def check_role_update\n unless current_user.is_admin?\n params[:user][:is_admin] = \"0\"\n params[:user][:is_moderator] = \"0\"\n params[:user][:is_sales] = \"0\"\n end\n end",
"def assign_user_rights\n SysUserRight.joins(:sys_user_group).where(:sys_user_groups => {:user_group_name => session[:user_privilege].user_groups}).each do |right|\n action_on_table = right.sys_action_on_table\n session[(action_on_table.action + '_' + action_on_table.table_name).to_sym] = true if action_on_table.action[-4..-1] == '_all' #ex, session[:index_all_users], for table\n session[(action_on_table.action + '_' + action_on_table.table_name + '_' + right.accessible_column_name).to_sym] =\n true if right.accessible_column_name.present? #ex, session[:index_users_each_column] (full access), session[:index_users_name], for columns in a record\n end\n end",
"def update_choice\n redirect_to (\"/admin/users/#{params[\"id\"]}/edit\")\n end",
"def set_parent_view\n\n if current_user.role_id == 1\n \n else \n redirect_to unauthorised_path()\n end\n end",
"def require_same_user\n if current_user != @recipe.chef and !current_user.admin?\n flash[:danger] = \"You can only edit your own recipes\"\n redirect_to recipes_path\n end\n \n end",
"def admin_or_professor_user\n unless this_is_admin?(current_user) || this_is_professore?(current_user)\n flash[:danger] = \"You don't have the rights for this page.\"\n redirect_to(root_url)\n end\n end",
"def thesis_admin\n processor\n\n can :manage, :all\n cannot 'destroy', :copyright\n cannot 'destroy', :degree\n cannot 'destroy', :department\n cannot 'destroy', :hold_source\n cannot 'destroy', :license\n cannot 'destroy', :thesis\n end",
"def privileges(user, parent_priv = nil)\n\t\tif user.admin?\n\t\t\treturn PRIVILEGE_EDIT\n\t\tend\n\t\tif self.creator_id.nil? && user.privilege >= User::PRIVILEGE_STAFF\n\t\t return PRIVILEGE_EDIT\n\t\tend \n\t\tif self.creator_id == user.id\n\t\t\treturn PRIVILEGE_EDIT\n\t\tend\n\t\t\n\t\tparent_priv ||= self.notable.privileges(user)\n\t\t\n\t\treturn PRIVILEGE_EDIT if parent_priv[:edit_note]\n\t\treturn PRIVILEGE_VIEW if parent_priv[:view_note]\n\t\treturn PRIVILEGE_NONE\n\tend",
"def action_allowed?\n current_user_has_student_privileges?\n end",
"def registration_form\n redirect_to join_event_url(@event) unless @current_user.new_record?\n @role = get_role(:person => @current_user)\n end",
"def check_user_rights\n if( params[:id] && !admin_authorized? )\n @bundle = Bundle.find(params[:id])\n if( ! @bundle.public )\n if( @bundle.created_by_user_id != @user.id )\n \t\t\t\trender :action => \"not_allowed\" \n end\n end\n end\n end",
"def access_rights_for_user(usr)\n return unless usr\n return :all if administrator?(usr)\n\n rights = standard_authorized_user_rights\n \n usr.user_groups.each do |grp|\n permissions_for_user_group(grp) do |perm|\n rights += access_rights_for_permission(perm) \n end\n end\n rights\n end",
"def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n\n end",
"def authorize_admin\r\n unless session[:user_id] and\r\n User.find(session[:user_id]).level == 2\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"access_denied\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end",
"def check_access_control_all\n @user = User.find(params[:user_id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @user.id\n rescue\n response_access_denied\n end",
"def authorize\n render json: { status: 200, msg: 'You are not allowed to do this update' } unless current_user && current_user.can_modify_user?(params[:id])\n end",
"def professor_user\n unless this_is_professore?(current_user)\n flash[:danger] = \"You don't have the rights for this page/action.\"\n redirect_to(root_url)\n end\n end",
"def professor_user\n unless this_is_professore?(current_user)\n flash[:danger] = \"You don't have the rights for this page/action.\"\n redirect_to(root_url)\n end\n end",
"def require_moderator_access\n sub = Sub.friendly.find(params[:id])\n unless sub.moderators.include?(current_user)\n flash[:error] = \"Only moderators can perform this action.\"\n redirect_to sub_url(sub)\n end\n end",
"def authorize_edit\n authorize! :edit, @opportunity\n end",
"def index\n #@event_users = EventUser.where(event: @event)\n #@event_users = EventUserPolicy::Scope.new(current_user, [:admin, EventUser]).resolve\n @event_users = policy_scope(EventUser.where(event: @event))\n authorize @event_users\n\n add_breadcrumb \"#{@event.code}\", :admin_event_path\n add_breadcrumb \"Usuários\", :admin_event_users_path\n end",
"def validate\n\t\tif current_user.permissoes > 5\n\t\t\tform_irr = FormIrr.find(params[:id])\n\t\t\tif form_irr.update_column(:validated, true)\n\t\t\t\tredirect_to :back\n\t\t\tend\n\t\telse\n\t\t\trender 'common/noaccess'\n\t\tend\n\tend",
"def edit\n\t\tadd_breadcrumb \"Editar\"\n\t\tif @request.user_id != current_user.id\n\t\t\tredirect_to root_path, alert: \"Usted no es el creador de la solicitud, por lo que no puede modificarla. Contáctese con su administrador.\"\n\t\tend\n\tend",
"def can_submit?(user)\n can_student_submit?(user) || can_edit?(user)\n end",
"def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :color_pdf, :pdf, :edit, :browse_everything_files, :structure, :file_manager, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :color_pdf, :pdf, :edit, :browse_everything_files, :structure, :file_manager, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"def edit_my_details\n @user = User.find_by_id(current_user.id)\n authorize! :edit_my_details, User\n end",
"def edit\n @user = User.shod(params[:id])\n authorize! :update, @user\n end",
"def validate_permission\n unless current_user.permissions.include?(:events)\n flash[:error] = 'You do not have permission to edit Events.'\n redirect_to '/admin'\n end\n end",
"def edit\n\t @user = User.find(params[:id])\n\t redirect_to root_path unless current_user.is_admin? or @user == current_user\n\tend",
"def check_if_user_can_perform_action_on_resources\n if @item && @item.is_a?(Typus.user_class)\n check_if_user_can_perform_action_on_user\n else\n not_allowed if admin_user.cannot?(params[:action], @resource.model_name)\n end\n end",
"def admin_permission\n if session[:position].to_s == \"Secretary\" or\n session[:position].to_s == \"Treasurer\" or\n session[:position].to_s == \"Chairman\"\n flash[:notice] = \"RESTRICTED: you do not have access\"\n redirect_to controller: :access, action: :admin_menu, :id => session[:user_id],\n position: session[:position]\n return false\n end\n\n end",
"def update\n @user = User.find(params[:id])\n unless changing_his_own_role?(@user)\n User.update_all(params[:user], {:id => @user.id})\n # if @user.update_attribute(:role, params[:user][:role])\n # if @user.send(:attributes=, {:role => params[:user][:role]})\n flash[:notice] = \"User role updated!\"\n redirect_to admin_users_path\n # else\n # flash[:notice] = \"didn`t work\"\n # redirect_to admin_users_path\n # end\n else\n flash[:notice] = \"Can`t overwrite your own rights!\"\n redirect_to admin_users_path\n end\n end",
"def edit\n authorize @car\n end",
"def can_edit\n return current_user && (current_user.id == Integer(params[:id]) || current_user.is_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 permitted_for!(_course_user)\n raise NotImplementedError, 'Subclasses must implement a permitted_for! method.'\n end",
"def owner\n redirect_to shelters_path, notice: 'Woah there! Only owners can edit shelters.' unless current_user.owner || current_user.admin\n end",
"def edit_administering_users\n render partial: \"units/administering_users_form\", locals: { unit: @unit }\n end",
"def user_permissions\n if current_user.id == params[:id].to_i\n @user = User.find(params[:id])\n else\n flash[:danger] = 'Unauthorized action.'\n redirect_to edit_user_path(current_user) \n end\n end",
"def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n end",
"def admin_edit\n @guidance_groups = GuidanceGroup.where(org_id: current_user.org.id)\n @guidance_group = GuidanceGroup.find(params[:id])\n authorize @guidance_group\n end",
"def studente_user\n unless this_is_studente?(current_user)\n flash[:danger] = \"You don't have the rights for this page/action.\"\n redirect_to(root_url)\n end\n end",
"def access_rights_for_user(usr)\n return unless usr\n return :all if administrator?(usr)\n\n rights = standard_authorized_user_rights\n \n user_groups = usr.send(Lockdown.user_groups_hbtm_reference)\n user_groups.each do |grp|\n permissions_for_user_group(grp).each do |perm|\n rights += access_rights_for_permission(perm) \n end\n end\n rights\n end",
"def edit\n # Listing 9.14: Finding the correct user is now handled by the correct_user before_action.\n end",
"def edit\n\t\t# must have admin access or be in the course\n\tend"
] | [
"0.6229843",
"0.6174926",
"0.6099008",
"0.6061552",
"0.6059249",
"0.6041759",
"0.6030051",
"0.5976333",
"0.595651",
"0.5939111",
"0.59238595",
"0.5840466",
"0.5813331",
"0.57810396",
"0.5767399",
"0.57612205",
"0.57542527",
"0.5752309",
"0.57359934",
"0.5732222",
"0.57210875",
"0.5717741",
"0.5696819",
"0.56967413",
"0.5694208",
"0.5690191",
"0.5668708",
"0.565857",
"0.56557506",
"0.5653811",
"0.5643416",
"0.5636042",
"0.5633625",
"0.56315196",
"0.5623207",
"0.5618753",
"0.56158864",
"0.5593537",
"0.5590705",
"0.5580095",
"0.5577089",
"0.5574239",
"0.5573603",
"0.5569387",
"0.5565904",
"0.5557246",
"0.55521435",
"0.5549285",
"0.5544183",
"0.55440396",
"0.554161",
"0.5541287",
"0.5537894",
"0.55260414",
"0.5523434",
"0.55224097",
"0.5514843",
"0.55130553",
"0.5511915",
"0.5505031",
"0.5502759",
"0.55014956",
"0.5501017",
"0.55006766",
"0.54999846",
"0.54995376",
"0.54967785",
"0.5490371",
"0.54872465",
"0.54806095",
"0.5480007",
"0.5477695",
"0.5477695",
"0.54776776",
"0.54769146",
"0.54714376",
"0.5469303",
"0.5464227",
"0.54617447",
"0.54599375",
"0.54599375",
"0.5459839",
"0.545899",
"0.5456551",
"0.5454228",
"0.54520607",
"0.54489297",
"0.5447292",
"0.5446245",
"0.5445407",
"0.5444354",
"0.5442873",
"0.54393846",
"0.5433677",
"0.5428616",
"0.54268956",
"0.5425057",
"0.54210484",
"0.5416713",
"0.5416632",
"0.541598"
] | 0.0 | -1 |
Actions for Fulfillment Rights subform | def add_fulfillment_rights_row
@organization = Organization.find(params[:organization_id])
@new_fr_identity = Identity.find_or_create(params[:new_fr_identity_id])
@fulfillment_rights = fulfillment_rights(@organization_id)
set_registrar_enabled(@organization)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def single_item_action_form_fields(form, document, action)\n render '/collections/single_item_action_fields', form: form, document: document, action: action\n end",
"def reseller_allow_edit(permission)\n return reseller_right(permission) == 2\n end",
"def update\n # this action is not provided for partyroles\n end",
"def update_access_controls!\n update!(edit_users: permission_template.agent_ids_for(access: 'manage', agent_type: 'user'),\n edit_groups: permission_template.agent_ids_for(access: 'manage', agent_type: 'group'))\n end",
"def authorize_edit\n authorize! :edit, @opportunity\n end",
"def create\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:role_id])\n access_right_hash = params[:access_right]\n \n if current_user.super_admin\n is_ok = true\n else\n current_user.roles.each { |r|\n r.access_rights.each { |ar|\n puts access_right_hash['model_name']\n if ar.model_name == access_right_hash['model_name'] && ar.action == access_right_hash['action']\n is_ok = true\n end\n }\n }\n end\n \n respond_to do |format|\n if is_ok\n @access_right = @role.access_rights.create(params[:access_right])\n @access_right.company_id = current_user.company_id\n @access_right.save\n format.html { redirect_to company_role_path(@company, @role) }\n else\n format.html { redirect_to company_role_path(@company, @role), notice: 'Usted no puede conceder este permiso.' }\n end\n end\n end",
"def set_edit_form_information\n @information[:subtitle] = t('view.permissions.edit_title')\n @information[:form_url] = [@parent, 'permission', no_firm: @no_firm]\n end",
"def set_rights\n @rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def permissions\n frm.link(:text=>\"Permissions\").click\n AssignmentsPermissions.new(@browser)\n end",
"def rights(*values)\n if values.size == 0\n @rights\n else\n args = values.pop\n args[:permissions] ||= []\n values.each do |value|\n args[:permissions] |= Array(value)\n end\n @rights ||= []\n @rights << args\n end\n end",
"def rights(*values)\n if values.size == 0\n @rights\n else\n args = values.pop\n args[:permissions] ||= []\n values.each do |value|\n args[:permissions] |= Array(value)\n end\n @rights ||= []\n @rights << args\n end\n end",
"def rights=(new_rights)\n @rights = new_rights\n end",
"def single_item_action_add_form_fields(form, document)\n single_item_action_form_fields(form, document, 'add')\n end",
"def edit\n authorize @volunteer_position\n end",
"def as_nested_actions; end",
"def AccessRights=(arg0)",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def admin_edit\n @guidance_groups = GuidanceGroup.where(org_id: current_user.org.id)\n @guidance_group = GuidanceGroup.find(params[:id])\n authorize @guidance_group\n end",
"def add_right\n role = Role.find(params[:id])\n\tright = Right.find(params[:right_id])\n role.rights << right\n redirect_to roles_rights_url\n\n end",
"def user_permission_fields(form)\n ubiquo_user_roles = form.object.ubiquo_user_roles.map(&:role)\n check_boxes = @roles.map do |role|\n content_tag(\"div\", :class => \"form-item\") do\n label_tag(\"role\"+role.id.to_s, role.name) + ' ' +\n check_box_tag(\"ubiquo_user[role_ids][]\", role.id, ubiquo_user_roles.include?(role), {:class => \"checkbox\", :id => \"role\"+role.id.to_s})\n end\n end\n content_tag(\"fieldset\") do\n content_tag(\"legend\", t(\"ubiquo.auth.roles\")) + check_boxes.join(\"\\n\").html_safe\n end + hidden_field_tag(\"ubiquo_user[role_ids][]\", '')\n end",
"def element_form(context={}, aspect_model)\n \n app = context[:app]\n\n if resource.can_write?(app.user) and (not app.user.belongs_to?(Users::Group.get('anonymous')))\n renderer = ::UI::FieldSetRender.new('resourceaccesscontrol', app) \n renderer.render('form', 'em') \n else \n ''\n end\n\n end",
"def require_permission\n if current_user.id != @squad.owner_id\n redirect_to api_squads_path, notice: 'You must be owner of a squad to do that action.'\n end\n end",
"def findForms\n # initialize forms for first page (of mandatory forms)\n @policy.forms = \"IL0003(9/08) IL0017(11/98) IL0286(9/08) IL0030(1/06) IL0031(1/06)\"\n\n # add relevant commercial property declarations\n if (@policy.property.premium_total != 0)\n # mandatory forms\n @policy.property_forms = \"CP0010(6/07) CP0090(7/88) CP0120(1/08) CP0140(7/06) CP1032(8/08) IL0935(7/02) IL0953(1/08) CP1270(9/96) \"\n # optional forms\n # BUSINESS INCOME & EXTRA EXPENSE\n if (!@policy.property.locations.first.exposures.third.limit.nil? && !@policy.property.locations.first.exposures.third.limit != 0)\n @policy.property_forms += \"CP0030(6/07) \"\n end\n # SPOILAGE COVERAGE **\n if (!@policy.property.locations.first.coverage_type == \"Special\")\n @policy.property_forms += \"CP1030(6/07) \"\n end\n # SPECIAL FORM - CAUSE OF LOSS\n if (!@policy.property.locations.first.exposures.fifth.limit.nil? && @policy.property.locations.first.exposures.fifth.limit != 0)\n @policy.property_forms += \"CP0440(6/95) \"\n end\n # OUTDOOR SIGN\n if (!@policy.property.locations.first.exposures.fourth.limit.nil? && !@policy.property.locations.first.exposures.fourth.limit != 0)\n @policy.property_forms += \"CP1440(6/07) \"\n end\n # ELITE PROPERTY ENHANCEMENT\n if (@policy.property.locations.first.enhc_premium != 0)\n @policy.property_forms += \"PO-PRP-3(12/13) \"\n end\n # MANDATORY EQUIPMENT BREAKDOWN PROTECTION COVERAGE & MICHIGAN CHANGES\n if (@policy.property.locations.first.mech_premium != 0)\n @policy.property_forms += \"EB0020(08/08) EB0108(09/07) \"\n end\n\n # CP1218(6/95)\n if (@policy.docs.where(form_code:\"CP1218(6/95)\")[0].active == true)\n @policy.property_forms += \"CP1218(6/95) \"\n end\n\n # CP0440(6/95)\n if (@policy.docs.where(form_code:\"CP0440(6/95)\")[0].active == true)\n @policy.property_forms += \"CP0440(6/95) \"\n end\n\n # IL0415(04/98)\n if (@policy.docs.where(form_code:\"IL0415(04/98)\")[0].active == true)\n @policy.property_forms += \"IL0415(04/98) \"\n end\n\n # CG2028(7/04)\n if (@policy.docs.where(form_code:\"CG2028(7/04)\")[0].active == true)\n @policy.property_forms += \"CG2028(7/04)\"\n end\n\n end\n\n # add relevant general liability declarations\n if (@policy.gl.premium_total != 0)\n # mandatory forms\n @policy.gl_forms = \"CG0001(12/07) CG0068(5/09) CG0099(11/85) CG0168(12/4) CG2101(11/85) CG2146(7/98) CG2147(12/07) CG2149(9/99) CG2167(12/04) CG2175(6/08) CG2190(1/06) CG2231(7/98) CG2258(11/85) CG2407(1/96) IL0021(9/08) PO-GL-5(5/12) PO-GL-6(5/12) \"\n # optional forms\n # EXCLUSION MEDICAL PAYMENTS\n if (!@policy.gl.medical_expense.nil? && @policy.gl.medical_expense != 0)\n @policy.gl_forms += \"CG2135(10/01) \"\n end\n # EXCLUSION PERSONAL INJURY\n if (!@policy.gl.personal_advertising_injury.nil? && @policy.gl.personal_advertising_injury != 0)\n @policy.gl_forms += \"CG2138(11/85) \"\n end\n # EXCLUSION DAMAGE TO PREMISES RENTED\n if (!@policy.gl.fire_damage.nil? && @policy.gl.fire_damage != 0)\n @policy.gl_forms += \"CG2145(7/98) \"\n end\n # WATER IN THE GAS TANK\n if (!@policy.gl.water_gas_tank == \"Yes\")\n @policy.gl_forms += \"PO_GL_WIG(12/13)\"\n end\n\n # CG2026(7/04)\n if (@policy.docs.where(form_code:\"CG2026(7/04)\")[0].active == true)\n @policy.gl_forms += \"CG2026(7/04)\"\n end\n\n # CG2018(11/85)\n if (@policy.docs.where(form_code:\"CG2018(11/85)\")[0].active == true)\n @policy.gl_forms += \"CG2018(11/85)\"\n end\n\n # CG2011(1/96)\n if (@policy.docs.where(form_code:\"CG2011(1/96)\")[0].active == true)\n @policy.gl_forms += \"CG2011(1/96)\"\n end\n\n # CG2144(7/98)\n if (@policy.docs.where(form_code:\"CG2144(7/98)\")[0].active == true)\n @policy.gl_forms += \"CG2144(7/98)\"\n end\n end\n\n # add relevant crime declarations\n if (@policy.crime.premium_total != 0)\n # mandatory forms\n @policy.crime_forms = \"CR0021(5/06) CR0110(8/07) CR0246(8/07) CR0730(3/06) CR0731(3/06) IL0935(7/02) IL0953(1/08) \"\n # optional forms\n # EMPLOYEE THEFT AND FORGERY POLICY\n if ((!@policy.crime.exposures.first.limit.nil? && @policy.crime.exposures.first.limit != 0) ||\n (!@policy.crime.exposures.second.limit.nil? && @policy.crime.exposures.second.limit != 0))\n @policy.crime_forms += \"CR0029(5/06) \"\n end\n # INSIDE THE PREMISES-THEFT OF OTHER PROPERTY\n if (!policy.crime.exposures.fifth.limit.nil? && @policy.crime.exposures.fifth.limit != 0)\n @policy.crime_forms += \"CR0405(8/07) \"\n end\n # INSIDE THE PREMISES – ROBBERY OF A CUSTODIAN OR SAFE BURGLARY OF MONEY & SECURITIES\n if ((!@policy.crime.exposures.third.limit.nil? && @policy.crime.exposures.third.limit != 0) ||\n (!@policy.crime.exposures.fourth.limit.nil? && @policy.crime.exposures.fourth.limit != 0))\n @policy.crime_forms += \"CR0405(8/07) \"\n end\n end\n\n # add relevant commerical auto declarations\n if (@policy.auto.premium_total != \"0.00\")\n # mandatory forms\n @policy.auto_forms = \"CA0110(11/06) CA0217(3/94) CA0001(3/06) CA2384(1/06) PO-CA-1(5/12) \"\n end\n end",
"def accountant_allow_edit(permission)\n return accountant_right(permission) == 2\n end",
"def discovery_permissions\n return ['edit'] if blacklight_params[:works] == 'mine'\n super\n end",
"def right_params\n params.require(:right).permit(:user_id,\n :campground_id,\n :can_view_rights,\n :can_edit_rights,\n :can_view_campground,\n :can_edit_campground,\n :can_view_bookings,\n :can_edit_bookings,\n :can_create_bookings,\n :can_delete_bookings,\n :can_view_clients,\n :can_edit_clients,\n :can_delete_clients,\n :can_view_api_keys,\n :can_create_api_keys,\n :can_edit_api_keys,\n :can_delete_api_keys,\n :can_view_users,\n :can_create_users,\n :can_edit_users,\n :can_delete_users)\n end",
"def remove_rights(*values)\n if values.size == 0\n @remove_rights\n else\n args = values.pop\n args[:permissions] ||= []\n values.each do |value|\n args[:permissions] |= Array(value)\n end\n @remove_rights ||= []\n @remove_rights << args\n end\n end",
"def remove_rights(*values)\n if values.size == 0\n @remove_rights\n else\n args = values.pop\n args[:permissions] ||= []\n values.each do |value|\n args[:permissions] |= Array(value)\n end\n @remove_rights ||= []\n @remove_rights << args\n end\n end",
"def set_access_rights\n # @access_rights = current_v1_user.rights.where(campground_id: params[:campground_id])\n @access_rights = User.find(1).rights.find_by(campground_id: params[:campground_id])\n end",
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def edit_permissions\n can [:edit, :update], String do |pid|\n Rails.logger.debug(\"[EDITPERM] Checking from STRING\")\n test_edit(pid)\n end\n\n can [:edit, :update, :destroy], DRI::Batch do |obj|\n Rails.logger.debug(\"[EDITPERM] Checking from Batch\")\n test_edit(obj.id)\n end\n\n can [:edit, :update, :destroy], DRI::GenericFile do |obj|\n Rails.logger.debug(\"[EDITPERM] Checking from GenericFile\")\n test_edit(obj.id)\n end\n\n can :edit, SolrDocument do |obj|\n Rails.logger.debug(\"[EDITPERM] Checking from SOLRDOC\")\n cache.put(obj.id, obj)\n test_edit(obj.id)\n end\n end",
"def edit\n @corr = Corrective.find(params[:id])\n if @corr.user.id != current_user.id || current_user.role == 0\n flash[:danger] = \"Permission Denied!\"\n redirect_to current_user\n end\n end",
"def set_rights_metadata\n self.edit_groups = ['Chronos-Pligtaflevering']\n self.read_groups = ['Chronos-Alle']\n self.discover_groups = ['Chronos-Alle']\n end",
"def update\n render action: :edit unless @cancion.update_attributes(cancion_params)\n end",
"def edit\n authorize @car\n end",
"def authorize!\n Ability.allowed?(context[:current_user], :read_milestone, parent) || raise_resource_not_available_error!\n end",
"def forms_fields(form, action)\n section_fields = []\n form.form_sections.each do |section|\n if section['permissions'][\"#{current_user.role.short_name}\"][action] == '1'\n section_fields << section.section_fields.map do |field|\n if field.field_type.field_type.start_with?('select') && field.field_type.options['multivalue'] == '1'\n { field.id.to_s.to_sym => [] }\n else\n field.id.to_s.to_sym\n end\n end\n end\n end\n section_fields\n end",
"def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :color_pdf, :pdf, :edit, :browse_everything_files, :structure, :file_manager, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :color_pdf, :pdf, :edit, :browse_everything_files, :structure, :file_manager, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"def permit?(action)\n case action\n # -- list\n when :list\n permit?(:list_cases)\n\n # -- create\n when :create\n source? && @settings.working_hours?\n when :create_assignment\n agent? || enroller? || governor?\n when :create_note\n agent? || enroller?\n\n # -- edit\n when :edit\n agent? || governor? || enroller?\n when :edit_address\n agent? || source?\n when :edit_contact\n agent? || source?\n when :edit_address_geography\n source?\n when :edit_household\n agent? || governor? || permit?(:edit_household_source)\n when :edit_household_source\n permit?(:edit_household_ownership) || permit?(:edit_household_proof_of_income)\n when :edit_household_size\n agent? || governor?\n when :edit_household_ownership\n (agent? || source?) && requirement?(R::HouseholdOwnership)\n when :edit_household_proof_of_income\n (agent? || source?) && !requirement?(R::HouseholdProofOfIncomeDhs)\n when :edit_household_dhs_number\n (agent? || governor?) && proof_of_income?(P::Dhs)\n when :edit_household_size\n agent? || governor?\n when :edit_household_income\n (agent? || governor?) && proof_of_income?(P::Dhs)\n when :edit_supplier_account\n (agent? || source?) && requirement?(R::SupplierAccountPresent)\n when :edit_supplier\n agent? || (source? && !supplier?)\n when :edit_supplier_account_active_service\n agent? && requirement?(R::SupplierAccountActiveService)\n when :edit_food\n (source? || agent?) && requirement?(R::FoodDietaryRestrictions)\n when :edit_benefit\n agent? || enroller?\n when :edit_benefit_amount\n (agent? || enroller?)\n when :edit_benefit_contract\n (agent?) && requirement?(R::ContractPresent)\n when :edit_documents\n agent?\n when :edit_admin\n agent?\n\n # -- view\n when :view\n agent? || source? || enroller?\n when :view_details\n permit?(:view)\n when :view_details_status\n agent? || enroller?\n when :view_details_enroller\n agent?\n when :view_supplier_account\n permit?(:view) && requirement?(R::SupplierAccountPresent)\n when :view_food\n permit?(:view) && requirement?(R::FoodDietaryRestrictions)\n when :view_household_size\n (agent? || enroller?)\n when :view_household_ownership\n permit?(:view) && requirement?(R::HouseholdOwnership)\n when :view_household_proof_of_income\n (agent? || enroller?) && !requirement?(R::HouseholdProofOfIncomeDhs)\n when :view_household_dhs_number\n (agent? || enroller?) && proof_of_income?(P::Dhs)\n when :view_household_income\n (agent? || enroller?) && proof_of_income?(P::Dhs)\n when :view_supplier_account_active_service\n (agent? || enroller?) && requirement?(R::SupplierAccountActiveService)\n\n # -- actions\n when :convert\n agent?\n when :referral\n agent?\n when :complete\n agent? || enroller?\n\n # -- destroy\n when :destroy\n agent?\n when :destroy_assignment\n agent?\n\n # -- archive\n when :archive\n agent?\n else\n super\n end\n end",
"def update!(**args)\n @field_with_rights = args[:field_with_rights] if args.key?(:field_with_rights)\n end",
"def assign\n useraccount = Useraccount.find_by_username(params[:username])\n right = Right.find(params[:right_id])\n useraccount.rights << right\n \n redirect_to :action => 'rightassignment', :username => params[:username]\n end",
"def validate\n\t\tif current_user.permissoes > 5\n\t\t\tform_irr = FormIrr.find(params[:id])\n\t\t\tif form_irr.update_column(:validated, true)\n\t\t\t\tredirect_to :back\n\t\t\tend\n\t\telse\n\t\t\trender 'common/noaccess'\n\t\tend\n\tend",
"def actions\n %w[credit]\n end",
"def custom_permissions\n #Collection Manager Permissions\n #Higher power than edit user...[Dont want edit users to be able to DELETE a COLLECTION??, (Delete a DO?)]\n if current_user.applicable_policy?(SETTING_POLICY_COLLECTION_MANAGER)\n #Marked as being able to :manage_collection\n can :manage_collection_flag, :all\n can :create, [DRI::Batch, DRI::GenericFile]\n end\n\n\n #Admin Permissions\n if current_user.applicable_policy?(SETTING_POLICY_ADMIN)\n can :admin_flag, :all\n #Disabled for now..\n can :manage, :all\n end\n\n #Create_do flag (alias for :edit collection)\n can :create_do, String do |pid|\n test_create(pid)\n end\n\n can :create_do, DRI::Batch do |collection|\n test_create(collection)\n end\n end",
"def check_permissions\n\n case params[:action]\n when 'new'\n @item = @model.new\n action = \"add\" unless can_add? @item\n when 'edit'\n action = \"edit\" unless can_edit? @item\n when 'destroy'\n action = \"destroy\" unless can_destroy? @item\n when 'toggle'\n action = \"toogle\" unless can_toggle? @item\n end\n\n if action\n flash[:notice] = \"You can't #{action} a #{@item.class.to_s.titleize}.\"\n redirect_to :controller => 'typus', :action => 'index', :model => params[:model]\n end\n\n end",
"def edit\n authorize @competition, :update?\n\n @form = form Competition::Update\n end",
"def edit\n @user.build_contact unless @user.contact\n @roles = Role.accessible_roles\n @user.role = @user.role_ids[0]\n end",
"def rights\n self[\"rights_tesim\"]\n end",
"def update\n redirect_to :root and return unless @car_request.aasm.events.map(&:name).map(&:to_s).include? params[:form_action]\n @car_request.send(params[:form_action], nil, current_user)\n @car_request.save!\n redirect_to car_requests_url\n end",
"def build_parties_role_form(parties_role,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:parties_role_form]= Hash.new\n\trole_names = Role.find_by_sql('select distinct role_name from roles').map{|g|[g.role_name]}\n\trole_names.unshift(\"<empty>\")\n\t#generate javascript for the on_complete ajax event for each combo for fk table: parties\n\tcombos_js_for_parties = gen_combos_clear_js_for_combos([\"parties_role_party_type_name\",\"parties_role_party_name\"])\n\t#Observers for combos representing the key fields of fkey table: party_id\n\tparty_type_name_observer = {:updated_field_id => \"party_name_cell\",\n\t\t\t\t\t :remote_method => 'parties_role_party_type_name_changed',\n\t\t\t\t\t :on_completed_js => combos_js_for_parties [\"parties_role_party_type_name\"]}\n\n\tsession[:parties_role_form][:party_type_name_observer] = party_type_name_observer\n\n#\tcombo lists for table: parties\n\n\tparty_type_names = nil \n\tparty_names = nil \n \n\tparty_type_names = PartiesRole.get_all_party_type_names\n\tif parties_role == nil||is_create_retry\n\t\t party_names = [\"Select a value from party_type_name\"]\n\telse\n\t\tparty_names = PartiesRole.party_names_for_party_type_name(parties_role.party.party_type_name)\n\tend\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (party_id) on related table: parties\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[0] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'party_type_name',\n\t\t\t\t\t\t:settings => {:list => party_type_names},\n\t\t\t\t\t\t:observer => party_type_name_observer}\n \n\tfield_configs[1] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'party_name',\n\t\t\t\t\t\t:settings => {:list => party_names}}\n \n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (role_id) on related table: roles\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[2] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'role_name',\n\t\t\t\t\t\t:settings => {:list => role_names}}\n \n\tfield_configs[3] = {:field_type => 'DateField',\n\t\t\t\t\t\t:field_name => 'from_date'}\n\n\tfield_configs[4] = {:field_type => 'DateField',\n\t\t\t\t\t\t:field_name => 'to_date'}\n\n\tfield_configs[5] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'remarks'}\n\n field_configs[6] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'sequence_number'}\n\n\tbuild_form(parties_role,field_configs,action,'parties_role',caption,is_edit)\n\nend",
"def show\n authorize_action_for(@revise)\n end",
"def update\n @can_sub = CanSub.find(params[:id])\n\n respond_to do |format|\n if @can_sub.update_attributes(params[:can_sub])\n format.html { redirect_to(@can_sub, :notice => 'Can sub was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @can_sub.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @screen = session.active_screen\n @permission = Permission.new\n\n @permission_type = params[:type].constantize\n if @permission_type == Permissions::RoleScreen \n @permission[:role_id] = params[:role_id]\n @permission[:screen_id] = params[:screen_id]\n @all_actions = Permission.action_options[:screen]\n @screen_id = -1\n elsif @permission_type == Permissions::RoleField\n @permission[:role_id] = params[:role_id]\n @permission[:field_id] = params[:field_id]\n @all_actions = Permission.action_options[:field]\n @screen_id = params[:field_screen_id]\n @source_screen_id = params[:source_screen_id]\n elsif @permission_type == Permissions::UserScreen\n @permission[:user_id] = params[:user_id]\n @permission[:screen_id] = params[:screen_id]\n @all_actions = Permission.action_options[:screen]\n @screen_id = -1\n elsif @permission_type == Permissions::UserField\n @permission[:user_id] = params[:user_id]\n @permission[:field_id] = params[:field_id]\n @all_actions = Permission.action_options[:field]\n @screen_id = params[:field_screen_id]\n @source_screen_id = params[:source_screen_id]\n end\n\n @grant_actions = []\n @revoke_actions = []\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @permission }\n end\n end",
"def index\n @rights = Right.all\n end",
"def update\n @access_right = AccessRight.find(params[:id])\n\n respond_to do |format|\n if @access_right.update_attributes(params[:access_right])\n format.html { redirect_to @access_right, notice: 'Access right was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @access_right.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n authorize @user_information\n end",
"def set_refund\n @refund = @current_event.refunds.find(params[:id])\n authorize @refund\n end",
"def thesis_admin\n processor\n\n can :manage, :all\n cannot 'destroy', :copyright\n cannot 'destroy', :degree\n cannot 'destroy', :department\n cannot 'destroy', :hold_source\n cannot 'destroy', :license\n cannot 'destroy', :thesis\n end",
"def set_rules!(params)\n # implement the rules parent has set while manually approving the purchase\n # params should contain a normal hash and for that \n end",
"def update\n\t\traise CanCan::AccessDenied if !Requisito.accessible_by(current_ability, :update).include?(@requisito)\n respond_to do |format|\n if @requisito.update(requisito_params)\n\t format.html { redirect_to :action => 'new', :actividad_id => @requisito.actividad\n\t\t flash[:success] = 'Requisito fue actualizado satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @requisito }\n else\n format.html { render :edit }\n format.json { render json: @requisito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n authorize RoleCutoff\n end",
"def update\n\t\tauthorize! :update, DetalleRestriccion\n respond_to do |format|\n @concepto_gastos = ConceptoGasto.all\n if @detalle_restriccion.update(detalle_restriccion_params)\n format.html { redirect_to gestionar_restricciones_path, notice: 'Actualizado correctamente'}\n #format.html { redirect_to @detalle_restriccion, notice: 'Detalle restriccion fue actualizado satisfactoriamente.' }\n #format.json { render :show, status: :ok, location: @detalle_restriccion }\n else\n format.html { redirect_to gestionar_restricciones_path, alert: 'No pueden guardarse'}\n #format.html { render :edit }\n #format.json { render json: @detalle_restriccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def permissions\n permissions_menu_button\n wait_for_ajax(2)\n permissions_button\n wait_for_ajax(2)\n self.class.class_eval { include ContentPermissionsPopUp }\n end",
"def add_right_to_personalgroup(right)\n self.rights << right\n end",
"def authorize_resource\n authorize!(:disburse, @disbursement)\n @disbursement.experience_points_records.each do |record|\n authorize!(:create, record)\n end\n end",
"def principals\n modify\n end",
"def update\n set_params\n @restaurant = Restaurant.find(params[:id])\n authorize! :update, @restaurant\n if (params[:restaurant][:status] == \"Exclusive\" &&\n @restaurant.owned_by != current_user.id)\n params[:restaurant][:status] = \"Pending Approval\"\n send_request\n @restaurant.mark_pending(current_user.id)\n end\n MenuItem.destroy_all(:restaurant_id => params[:id])\n set_menu_items_and_file\n super\n end",
"def build_editable_fields(actions, guardian, args)\n end",
"def facility_admin\n facility_controller_check\n unless current_user.role == \"site_admin\" || (@facility_role_access.present? && current_user.role == \"facility_admin\")\n flash[:error] = 'You are not authorized. Please request access from your manager'\n redirect_to root_url\n end\n end",
"def api_form_actions(object_name, options = {})\n \" <li><div class=\\\"form_actions\\\">\\n \" +\n submit_button(object_name, options[:submit_text]) + \"\\n \" + cancel_link +\n \"\\n </div></li>\"\n end",
"def update\n @role = Role.find(params[:id])\n \n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to @role, notice: t(:role_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def html_actions_panel(node, output)\n return nil unless node.is_a?(ICollection)\n\n # We also know fairly certain that if an object is a non-extended\n # SimpleCollection, we won't need to show the panel either.\n return nil if node.class == Tilia::Dav::SimpleCollection\n\n output.value << <<FORM\n<form method=\"post\" action=\"\">\n <h3>Create new folder</h3>\n <input type=\"hidden\" name=\"sabreAction\" value=\"mkcol\" />\n <label>Name:</label> <input type=\"text\" name=\"name\" /><br />\n <input type=\"submit\" value=\"create\" />\n</form>\n<form method=\"post\" action=\"\" enctype=\"multipart/form-data\">\n <h3>Upload file</h3>\n <input type=\"hidden\" name=\"sabreAction\" value=\"put\" />\n <label>Name (optional):</label> <input type=\"text\" name=\"name\" /><br />\n <label>File:</label> <input type=\"file\" name=\"file\" /><br />\n <input type=\"submit\" value=\"upload\" />\n</form>\nFORM\n end",
"def create\n\n @franchisee = Franchisee.new(franchisee_params)\n \n @franchisee.parent = params[:parent] if params[:parent] \n respond_to do |format|\n if @franchisee.save\n \n UserRole.create(user_id: @franchisee.user.id, role_id: Role.find_by(:role_name=>\"Admin\").id)\n @franchisee.update(no_of_owners: FranchiseeOwner.where(franchisee_id: @franchisee.id).count, latest_renewal: @franchisee.franchisee_agreement.renewal_date)\n InstallmentDetail.advance_amount_entry(@franchisee)\n\n # To send onetime password creation mail\n PasswordResetMailer.password_reset_email(@franchisee.user_id, request.base_url, true).deliver_now! \n\n #FranchiseeRoyalty.franchisee_royalty(@franchisee)\n \n format.html { redirect_to franchisees_url, notice: 'Franchisee was successfully created.' }\n format.json { render :show, status: :created, location: @franchisee }\n else\n format.html { render :new }\n format.json { render json: @franchisee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit2\n @show_element=\"admin\"\n @action=\"update2\"\n @rolesgroup = RolesGroup.find(params[:id])\n @role = Role.find_by_role_name(@rolesgroup.role_name)\n end",
"def edit_right\n id = params[:id].presence || 0 \n @element = DirAccess.find(id)\n @dir = @element.dir_manager\n end",
"def edit\n @car = Car.find(params[:id])\n\n if current_user.admin == true\n authorize @car\n end\n\n\n authorize @car\n end",
"def single_item_action_remove_form_fields(form, document)\n single_item_action_form_fields(form, document, 'remove')\n end",
"def update_permissions\r\n if request.post? and @logged_in_user.is_admin?\r\n # update the create, read, update, delete right for this folder:\r\n update_group_permissions(folder_id, params[:create_check_box], 'create', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:read_check_box], 'read', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:update_check_box], 'update', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:delete_check_box], 'delete', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n end\r\n\r\n # Return to the folder\r\n redirect_to :action => 'list', :id => folder_id\r\n end",
"def update\n if @current_user_permissions.find_by(permission_name: \"Edit Contact\").value == false\n @not_authorized = true\n render( :edit)\n else\n respond_to do |format|\n if @contact.update(contact_params)\n if params[:contact][:referred_contact][:reference_contact_id] != ''\n @refer_contact = ReferredContact.new\n @refer_contact.contact_id = params[:contact][:referred_contact][:contact_id]\n @refer_contact.reference_contact_id = params[:contact][:referred_contact][:reference_contact_id]\n if @refer_contact.save\n format.html { redirect_to edit_contact_path, notice: 'Contact Referred was successfully added.' }\n format.json { render :show, status: :ok, location: @contact }\n end\n else\n format.html { redirect_to contacts_path, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n end\n else\n format.html { redirect_to edit_contact_path, notice: \"Resubmit the form\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end",
"def permissions_policy(&block); end",
"def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end",
"def deny\n self.granted = -1\n restaurant = Restaurant.find(self.restaurant_id)\n restaurant.mark_collaborative\n end",
"def index\n @rights_holders = RightsHolder.all\n end",
"def require_extraction_form_ownership\n \t\textraction_form_id = params[:extraction_form_id]\n \t\textraction_form = ExtractionForm.find(extraction_form_id, :select=>[\"creator_id\"])\n \t\tunless extraction_form.creator_id == current_user.id\n \t\t\tflash[:notice] = \"You do not have ownership of the extraction form, and therefore cannot make edits.\"\n \t\t\tredirect_to \"/extraction_forms/#{extraction_form_id.to_s}\"\n \t\t\treturn false\n \t\tend\n \tend",
"def authorize_planner\n\n can [:read], Organization do |organization|\n curr_account == organization.account\n end\n can [:adopt, :search], Employee\n can [:read], Employee do |employee|\n employee.organizations.include?(curr_organization)\n end\n can [:update, :create], Employee do |employee|\n (\n !employee.owner? || curr_employee == employee\n ) &&\n # organization_id is a virtual attribute of employee and is used to\n # create the membership for the current organization after create of the\n # employee. So the following line makes sure that memberships for orgs\n # of other account can not be created.\n (\n employee.organization_id.nil? ||\n employee.organization_id.to_i == curr_organization.id\n ) &&\n (\n employee.account.nil? ||\n curr_account == employee.account\n )\n end\n can :update_role, Employee do |employee|\n curr_employee != employee && # no one can update her/his own role\n curr_organization.employees.include?(employee)\n end\n can :manage, Plan do |plan|\n curr_organization == plan.organization\n end\n can :manage, Scheduling do |scheduling|\n curr_organization == scheduling.plan.organization &&\n ( !scheduling.represents_unavailability? || self_planning?(scheduling) )\n end\n can :manage, Shift do |shift|\n curr_organization == shift.plan_template.organization\n end\n can :manage, CopyWeek do |copy_week|\n curr_organization == copy_week.plan.organization\n end\n can :manage, ApplyPlanTemplate do |apply_plan_template|\n curr_organization == apply_plan_template.plan.organization\n end\n can :manage, Team do |team|\n curr_organization == team.organization\n end\n can :manage, Qualification do |qualification|\n curr_account == qualification.account\n end\n can :manage, PlanTemplate do |plan_template|\n curr_organization == plan_template.organization\n end\n can :manage, TeamMerge do |team_merge|\n (team_merge.team_id.blank? || curr_organization == team_merge.team.try(:organization)) &&\n (team_merge.other_team_id.blank? || curr_organization == team_merge.other_team.try(:organization)) &&\n (team_merge.new_team_id.blank? || curr_organization == team_merge.new_team.try(:organization))\n end\n can [:read, :create], Post do |post|\n curr_organization == post.blog.organization\n end\n can [:read, :create], Comment do |comment|\n commentable = comment.commentable\n if commentable.respond_to?(:blog) # comment on a post\n curr_organization == commentable.blog.organization\n elsif commentable.respond_to?(:plan) # comment on a scheduling\n curr_organization == commentable.plan.organization\n else\n false\n end\n end\n can :manage, Invitation do |invitation|\n curr_account == invitation.employee.account &&\n curr_organization == invitation.organization\n end\n can :manage, Milestone do |milestone|\n curr_organization == milestone.plan.organization\n end\n can :manage, Task do |task|\n curr_organization == task.milestone.plan.organization\n end\n\n can :show, Conflict do |conflict|\n curr_organization == conflict.provoker.plan.organization\n end\n\n # For reports we only check the base on which schedulings will be found. For\n # example we do not need to test if the plan_ids submitted belong to the\n # base.\n # Please see the report model for how records are fetched. The base is\n # always the account and one or more organizations within the account.\n # If the user would submit foreign plan_ids for example, this will not do\n # any harm as the result simply will be empty.\n can :create, Report do |report|\n # A planner is only able to see a report within an organization.\n # The filter for organizations will no be shown on the report page of the\n # organization. Therefore the organization_ids of the report should only\n # include the id of the current organization.\n org_ids = report.organization_ids\n org_ids.size == 1 &&\n org_ids.first.to_i == curr_organization.id\n end\n\n authorize_owner_and_planner\n authorize_employee\n end",
"def edit\n authorize! :update, @user\n end",
"def relation_condition_option_form\n # Nothing to do here\n end",
"def build_permissions(perms, other)\n perms.permits! :read\n\n if self == other\n perms.permits! :write\n elsif other.admin?\n perms.permits! :write\n end\n end",
"def update_contents_and_resort_opinions(form)\n PaperTrail.request(enabled: false) do\n form.opinions.each do |prop_form|\n opinion = Opinion.where(component: form.current_component).find(prop_form.id)\n opinion.set_list_position(prop_form.position) if opinion.position != prop_form.position\n opinion.title = prop_form.title\n opinion.body = prop_form.body if opinion.participatory_text_level == ParticipatoryTextSection::LEVELS[:article]\n\n add_failure(opinion) unless opinion.save\n end\n end\n raise ActiveRecord::Rollback if @failures.any?\n end",
"def rights\n uri = metadata[dataset_uri][dct.rights.to_s][0]\n rights = metadata[uri] rescue nil\n if rights.nil?\n rights = Rights.new(:uri => uri)\n else\n rights = Rights.new(:uri => uri, \n :dataLicense => rights[odrs.dataLicense.to_s][0], \n :contentLicense => rights[odrs.contentLicense.to_s][0], \n :copyrightNotice => rights[odrs.copyrightNotice.to_s][0], \n :attributionURL => rights[odrs.attributionURL.to_s][0],\n :attributionText => rights[odrs.attributionText.to_s][0]\n )\n end\n return rights\n rescue\n []\n end",
"def setup_view_edit_permissions(lot)\n allowableActions = []\n # This is in display order (bottom up)\n # The names after blah_ are the section names used in\n # the HTML/AngularJS code, so keep that in mind if you\n # find yourself editing those.\n #\n # View (unhide) ability\n allowableActions << \"view_charges\"\n allowableActions << \"view_pick-up\"\n allowableActions << \"view_info\"\n allowableActions << \"view_seller\"\n allowableActions << \"view_wait-to-clear-pickup\"\n allowableActions << \"view_wait-for-driver-dispatch\"\n allowableActions << \"view_wait-for-trip-confirmation\"\n allowableActions << \"view_wait-for-inventory\"\n allowableActions << \"view_wait-for-title\"\n allowableActions << \"view_ready-for-auction-section\"\n allowableActions << \"view_wait-for-sale-confirmation\"\n allowableActions << \"view_wait-for-buyer-charge\"\n allowableActions << \"view_ready-for-seller-billing-section\"\n allowableActions << \"view_wait-for-settlement-confirmation\"\n allowableActions << \"view_service-orders\"\n \n # Edit ability\n if !lot.closed? || (lot.closed? && can?(:edit_closed_lots, lot))\n allowableActions << \"edit_charges\" if can? :edit_charges_section, lot\n allowableActions << \"edit_pick-up\" if can? :edit_location_section, lot\n allowableActions << \"edit_info\" if can? :edit_lot_info_section, lot\n allowableActions << \"edit_seller\" if can? :edit_seller_info_section, lot\n allowableActions << \"edit_wait-to-clear-pickup\" if can? :edit_hold_info_section, lot\n allowableActions << \"edit_wait-for-driver-dispatch\" if can? :edit_tow_provider_section, lot\n allowableActions << \"edit_wait-for-trip-confirmation\" if can? :edit_charges_reconciliation_section, lot\n allowableActions << \"edit_wait-for-inventory\" if can? :edit_inventory_section, lot\n allowableActions << \"edit_wait-for-title\" if can? :edit_ownership_transfer_section, lot\n allowableActions << \"edit_ready-for-auction-section\" if can? :edit_auction_section, lot\n allowableActions << \"edit_wait-for-sale-confirmation\" if can? :edit_sale_confirmation_section, lot\n allowableActions << \"edit_wait-for-buyer-charge\" if can? :edit_member_billing_section, lot\n allowableActions << \"edit_ready-for-seller-billing-section\" if can? :edit_seller_billing_section, lot\n allowableActions << \"edit_wait-for-settlement-confirmation\" if can? :edit_settlement_confirmation_section, lot\n allowableActions << \"edit_service-orders\" if can? :edit_service_order_section, lot\n end\n \n gon.allowableActions = allowableActions\n end",
"def build_permissions(perms, other)\n perms.permits! :read\n perms.permits! :write if self == other\n end",
"def reauthorize\n @order.reauthorize\n end",
"def test_can_edit_org_item\n user = User.named(\"user\")\n org = Organization.named(\"org\")\n\n item = org.propose_item(\"Item\", 20, :fixed, nil, nil)\n assert(!user.can_edit?(item))\n\n user.work_on_behalf_of(org)\n assert(user.on_behalf_of.can_edit?(item))\n end",
"def action_to_cancancan\n action_name == 'nested_index' ? :index : action_name.to_sym\n end"
] | [
"0.5582562",
"0.55035233",
"0.5486686",
"0.53779143",
"0.5373652",
"0.53297323",
"0.53215307",
"0.5253843",
"0.52380574",
"0.5212609",
"0.5211989",
"0.509528",
"0.50839174",
"0.5064582",
"0.50536174",
"0.5030007",
"0.5000622",
"0.5000622",
"0.5000622",
"0.5000622",
"0.5000622",
"0.49938706",
"0.49928877",
"0.49848253",
"0.49527007",
"0.49507666",
"0.4940864",
"0.49320465",
"0.4931345",
"0.49172857",
"0.49075872",
"0.49075872",
"0.49055398",
"0.4905055",
"0.49031103",
"0.49001816",
"0.48503616",
"0.4848842",
"0.48485237",
"0.4843064",
"0.48262817",
"0.48217818",
"0.48217818",
"0.48215395",
"0.4813643",
"0.4811732",
"0.48055613",
"0.48026758",
"0.47973716",
"0.47929278",
"0.47860277",
"0.4783149",
"0.47806504",
"0.47798446",
"0.47770074",
"0.47754318",
"0.47753623",
"0.47728857",
"0.47718734",
"0.4767258",
"0.47596815",
"0.47592878",
"0.47527334",
"0.47494325",
"0.47455293",
"0.4742316",
"0.47332358",
"0.47315052",
"0.47312862",
"0.47307682",
"0.47290453",
"0.47289518",
"0.4727545",
"0.47226694",
"0.4720466",
"0.47192234",
"0.47175935",
"0.4706205",
"0.47054133",
"0.47024778",
"0.4702265",
"0.46990883",
"0.4698592",
"0.46979022",
"0.46955875",
"0.4691843",
"0.46903366",
"0.46883458",
"0.46883127",
"0.46882966",
"0.46833602",
"0.4681186",
"0.46809268",
"0.46802986",
"0.46779218",
"0.46775523",
"0.46741328",
"0.46691605",
"0.46642327",
"0.46633473"
] | 0.562831 | 0 |
Actions for status subform | def toggle_default_statuses
@organization = Organization.find(status_params[:organization_id])
if @organization.update_attributes(use_default_statuses: status_params[:checked])
flash[:success] = "Organization updated successfully."
else
flash[:alert] = "Error updating organization."
end
set_status_variables
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status_params\n end",
"def status_update(_event)\n @submitted = false\n @filed = false\n end",
"def statuses; end",
"def status\n end",
"def status\n end",
"def status\n end",
"def status\n end",
"def index\n restrict('allow only admins') or begin\n if params[:form_status].nil?\n redirect_to admin_forms_by_status_path(:form_status => 'submitted')\n elsif params[:form_status] == 'archived'\n render :action => 'archive_view'\n else\n @forms = FormInstance.find_all_by_status_number(params[:form_status].as_status.number)\n end\n end\n end",
"def setstatus \n @target_yacht = Yacht.find(params[:id])\n if @target_yacht.status == params[:status]\n @msg = \"Yacht has been already saved as \" + params[:status]\n render :update do |page|\n \t page[:loadingimage].hide\n \t page[:overlay].hide\n \t page.alert(@msg)\n \tend\n else\n @target_yacht.status = params[:status]\n if @target_yacht.save\n @msg = \"Yacht status has been saved as \" + params[:status]\n @yachts = Yacht.broker(session[:brokerid]).paginate :page => params[:page], :per_page => 15\n render :update do |page|\n \t #page.replace_html \"yachtstatus_\"+params[:id], :partial=>'changedstatus'\n \t #page.replace_html \"yachtstatuslist\",:partial=>'/yachts/inventorylist' \t \n \t page[:loadingimage].hide\n \t page[:overlay].hide\n \t page[:yachtstatuslist].replace_html :partial=>'/yachts/inventorylist'\n \t #page.alert(@msg) \t \n \t end\n \t \n \t \n else\n @msg = \"Please try again\"\n render :update do |page|\n page[:loadingimage].hide\n \t page[:overlay].hide\n page.alert(@msg)\n end\n end\n end\n end",
"def set_StatusUpdate(value)\n set_input(\"StatusUpdate\", value)\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 update\n Rails.logger.debug \"Status#update for #{params.inspect}\"\n @status = params[:status]\n render :partial => \"content\"\n end",
"def do_update status\n if status\n redirect_to edit_block_path(@block), notice: 'Layer updated'\n else\n render action: \"edit\"\n end\n end",
"def status\n super\n end",
"def updateStatus(event)\n parent = event.target.parentNode\n\n # update state from data attributes\n for i in 0...parent.attributes.length\n attr = parent.attributes[i]\n $data[attr.name[5..-1]] = attr.value if attr.name.start_with? 'data-'\n end\n\n # unindent action\n @status.gsub!(/\\n {14}/, \"\\n\")\n\n # set baseline to current value\n @baseline = @status\n\n # show dialog\n jQuery('#updateStatusForm').modal(:show)\n end",
"def render_status(criterion, f, project, is_disabled)\n render(partial: 'status_chooser',\n locals: { f: f, project: project, is_disabled: is_disabled,\n criterion: Criteria[criterion] })\n end",
"def update\n @status_buttons.each do |i|\n i.update\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 status\n # ensure status is boolean\n status = (params[:status] == 1 || params[:status] == true) ? true : false\n\n changed = Supervise.find_by(vm_id: params[:vm_id], techno_id: params[:techno_id]).change_status(status)\n if changed == 1\n SuperviseMailer.supervise_email(@user, Vm.find(params[:vm_id]), Techno.find(params[:techno_id]), status).deliver\n end\n\n render nothing: true\n end",
"def update\n if can? :update, @status\n respond_to do |format|\n\n if @status.update(status_params)\n\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\n end\n end\n end",
"def edit_status\n @candidate.status_change!(@event)\n redirect_to event_candidates_path(:event_id => @event.id, :type => 'confirmed')\n end",
"def status(*status)\n @states = status\n self\n end",
"def fbo_updated_form\n end",
"def correctly_update_status\n\t\terrors.add(:base, 'La transaccion no fue exitosa') if self.invalid_status\n\tend",
"def status\n # @box.status = box_params[:status]\n # @old_position = params[:box] ? params[:box][:old_position] : 0\n @update_params = params[:box] || {}\n\n # respond_with @box, location: dashboard_box_path(@dashboard, @box)\n respond_with [@dashboard, @box]\n end",
"def handle_status_change\n return nil unless self.new_status.present?\n self.status = self.new_status\n if self.new_status == 'active'\n # the user wants to make the ad active now so push out the inactive and deletion dates\n self.inactive_date = Time.now + 2.months\n self.delete_date = Time.now + 4.months\n elsif self.new_status == 'inactive'\n # the user wants to make the ad inactive now so make the inactive date to day and deletion in 2 months\n self.inactive_date = Time.now\n self.delete_date = Time.now + 2.months\n end\n end",
"def show_status_label_method\n \"#{self.status}\"\n end",
"def set_status\n type = params[:type]\n if type == \"In Progress\"\n @service_request.status = \"In Progress\"\n elsif type == \"Completed\"\n @service_request.status = \"Completed\"\n end\n\n if @service_request.save\n flash.now[:sucess] = \"Status updated successfully\"\n redirect_to user_service_request_path(@service_request.user_id, @service_request)\n else\n flash.now[:danger] = \"Status was not updated\"\n redirect_to user_service_request_path(@service_request.user_id, @service_request)\n end\n\n end",
"def status_params\n params.require(:status).permit(:nombre, :visible)\n end",
"def toggle_status\n respond_to do |format|\n status = @invoice.pending? ? Invoice.statuses[:paid] : Invoice.statuses[:pending]\n if @invoice.update(status: status)\n format.html { render partial: 'invoices/invoice_actions', layout: false }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @invoice.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 set_status\n @status = Status.find(params[:id])\n end",
"def status(*) 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 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 making_status_update\n order_detail = OrderDetail.find(params[:id])\n order_detail.update(order_detail_params)\n redirect_to admin_order_path(order_detail.order_id)\n end",
"def status_params\n params.require(:status).permit(:title, :status_group_id, :sorter)\n end",
"def change_job_status_from_details\n @project_job = @current_organization.project_jobs.find(params[:id])\n if params[:status].present?\n if @project_job.status.present? && @project_job.status != params[:status]\n @project_job.update_column(:status, params[:status])\n @project_job.check_or_upgrade_project_stage \n create_comment_activity(\"<b>\"+params[:status]+ \"</b> the Task\")\n create_in_app_notification(\"Update\", \"Job status changed to #{params[:status]}\")\n Activity.create(:organization_id => @project_job.organization_id, :activity_user_id => @current_user.id, :activity_type => @project_job.class.name, :activity_id => @project_job.id, :activity_status => \"StatusChanged\", :activity_desc => \"Job status changed to #{params[:status]}\", :activity_date => @project_job.updated_at, :is_public => true, :source_id => @project_job.project.id,:source_type => @project_job.project.class.name)\n end\n end\n render partial: \"project_job_status_bar\"\n end",
"def update_status\n\t\t@medical_record_request.update_attributes!(:status => params[:status])\n\t\tredirect_to new_medical_record_request_path\n\trescue ActiveRecord::RecordNotSaved, ActiveRecord::RecordInvalid \n\t\tflash.now[:error] = \"Medical Record Request Status Update failed\"\n\t\trender :action => 'edit'\n\tend",
"def update_status\n\t\t@blood_spot_request.update_attributes!(:status => params[:status])\n\t\tredirect_to new_blood_spot_request_path\n\trescue ActiveRecord::RecordNotSaved, ActiveRecord::RecordInvalid \n\t\tflash.now[:error] = \"Blood Spot Request Status Update failed\"\n\t\trender :action => 'edit'\n\tend",
"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 update_status\n\n command = params[:status].to_sym\n case command\n when :setup, :start, :abort, :terminate\n @project.send(\"#{command}_done!\")\n when :stop\n @project.stop_done!\n # save return result data\n raw_data = params[:data]\n results = JSON.parse(raw_data)\n results.each {|result| LoadTest.create!(result.merge(project_id: @project.id))}\n\n when :download, :export\n result_download_parms = {}\n result_download_parms[:status] = 1\n ProjectResultDownload.update(params[:request_id], result_download_parms)\n\n when :status\n status_data = params[:status_data]\n unless status_data.blank?\n if JSON.parse(status_data).empty?\n if @project.may_stop?\n submit_process(:stop)\n @project.stop! # TODO refactor as a :before callback to events\n end\n end\n end\n else\n raise \"Unknown command for status update: #{command}\"\n end\n\n flash[:success] = \"#{command} completed successfully!\"\n render nothing: true\n end",
"def set_flds\n self.status = 'active' if status.blank?\n self.status = 'scheduled' if has_appt? && !is_completed?\n self.status = 'completed' if is_completed?\n end",
"def update_status\n do_load_resource\n do_authorize_instance\n\n update_status_user_check\n end",
"def set_flds\n self.status = 'active' if self.status.blank?\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 status_params\n params.require(:status).permit(:name, :content, :user_id, :private, :category_id)\n end",
"def show\n# render :action => 'status'\n end",
"def update\n @status = Status.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:status])\n flash[:notice] = 'Status Type was successfully updated.'\n format.html { redirect_to(@status) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def change_status\n # Администратор может поменять статус заявки на любой. Клиент же только на \"отменена\"\n if current_user.owner_or_worker?(@organization) || (current_user == @appointment.user_by_phone && %w(cancel_client).include?(params[:state]))\n @appointment.status = params[:state]\n respond_to do |wants|\n if @appointment.save\n wants.html { redirect_to calendar_path(day: @appointment.start.to_i, worker_id: @appointment.worker_id), notice: 'Статус успешно изменен' }\n wants.js { render js: refresh_calendar }\n else\n wants.html { redirect_to calendar_path(day: @appointment.start.to_i, worker_id: @appointment.worker_id), notice: 'При сохранении произошла ошибка' }\n wants.js { render js: \"alert('при сохранении произошла ошибка'\" }\n end\n end\n else\n redirect_to :back, alert: 'У вас не достаточно прав'\n end\n end",
"def status\n params[\"Status\"]\n end",
"def update\n @field_status = FieldStatus.find(params[:id])\n if @field_status.systematic\n render :js => %(show_warning('非法操作', '无法编辑系统属性'))\n return\n end\n @field_status.name = @field_status.name.strip\n respond_to do |format|\n if @field_status.update_attributes(params[:field_status])\n format.html { redirect_to @field_status, notice: '更新场地状态成功' }\n format.js { redirect_to @field_status, :remote => true }\n else\n format.html { render action: 'edit' }\n format.js { render action: 'edit' }\n end\n end\n 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=(status); 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"
] | [
"0.6408864",
"0.63910174",
"0.61050975",
"0.60360134",
"0.60360134",
"0.60360134",
"0.60360134",
"0.5962925",
"0.58869207",
"0.5884131",
"0.58666223",
"0.58666223",
"0.58665544",
"0.58340216",
"0.5833556",
"0.5832985",
"0.5777124",
"0.57629204",
"0.5761881",
"0.5752113",
"0.57467175",
"0.5744555",
"0.5706075",
"0.57038903",
"0.5702156",
"0.56999564",
"0.5696588",
"0.569555",
"0.5694083",
"0.5693335",
"0.5676021",
"0.56760067",
"0.5671404",
"0.5671404",
"0.5671404",
"0.5671404",
"0.56600726",
"0.5658392",
"0.5658392",
"0.5637873",
"0.5619127",
"0.56167424",
"0.5614238",
"0.56016034",
"0.55987513",
"0.55963945",
"0.55963945",
"0.55963945",
"0.55963945",
"0.55963945",
"0.55963945",
"0.55963945",
"0.55963945",
"0.55963945",
"0.55963945",
"0.55963945",
"0.55963945",
"0.55963945",
"0.55963945",
"0.5594206",
"0.5589204",
"0.5586903",
"0.55829453",
"0.5579419",
"0.5574297",
"0.5574249",
"0.55716956",
"0.55698264",
"0.55663055",
"0.5547804",
"0.5544963",
"0.5544963",
"0.5544963",
"0.5544963",
"0.5544963",
"0.5544963",
"0.5544963",
"0.5544963",
"0.5544963",
"0.55416477",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606",
"0.5536606"
] | 0.0 | -1 |
Actions for the pricing subform | def increase_decrease_modal
@organization = Organization.find(params[:organization_id])
@can_edit_historical = current_user.can_edit_historical_data_for?(@organization)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price\n \n end",
"def pricing_params\n params.require(:pricing).permit(:price, :price_cents, :item_id, :menu_id)\n end",
"def price\n \n end",
"def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"def modify_price\n log_action \"Modifying price for actions\"\n redraw_all_order_items = self.modify_price_for_actions\n log_action \"Modifying price for gs1\"\n self.modify_price_for_gs1\n if self.is_buyback\n log_action \"modify_price_for_buyback\"\n self.modify_price_for_buyback \n end\n self.modify_price_for_parts\n if self.behavior == 'gift_card'\n log_action \"modify_price_for_giftcards\"\n self.modify_price_for_giftcards \n end\n self.save!\n return redraw_all_order_items\n end",
"def create\n \n\n if Pricing.varient_split_add params\n #audit(@pricing, current_user)\n render json: @pricing, status: :created\n else\n render json: @pricing.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @pricing.update(pricing_params)\n format.html { redirect_to @pricing, notice: 'Pricing was successfully updated.' }\n format.json { render :show, status: :ok, location: @pricing }\n else\n format.html { render :edit }\n format.json { render json: @pricing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def item_edit_price\n @brief = Brief.find(params[:brief_id])\n @brief_vendor = @brief.brief_vendors.find_by_org_id(@cur_user.org_id)\n invalid_op unless @brief_vendor\n @item = @brief_vendor.items.find_by_id(params[:item_id])\n invalid_op unless @item\n @action_to = vendor_item_update_price_path\n end",
"def product_pricing\n @product = Product.find(params[:id])\n @dependent_product = @product.product_dependents.find_all.map {|prd| [Product.find(prd.parent_id), 'Dependent Product'] }\n @product_dependency = @dependent_product.empty? ? [[@product, nil]] : @dependent_product + [[@product, nil]]\n render :partial => 'product_pricing', :locals => {:product_dependent => @product_dependency}\n end",
"def pricing\n request('pricing', :get)\n end",
"def set_pricing_section\n @pricing_section = PricingSection.find(params[:id])\n end",
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def subtotal\n self.product.price * self.quantity\n end",
"def edit\n @listing.price /= 100\n end",
"def price action\n method = \"#{action}_price\".to_sym\n @price ||= interface.send(method).to_f\n end",
"def update\n reference_set\n\n @product.subsection_ids = params[:product][:subsection_ids]\n puts @quantity = params[:quantity]\n \n no_price_fix\n @checkBoxs = @product.subsection_ids\n @intsallchecks = params[:install_ids]\n #exvatcalc = @price.to_i * 0.14\n #@exvat_pirce = @price.to_i - exvatcalc.to_f\n @count = 0\n\n clone_product_to_lineitem\n render :js => \" $('#testnow').modal('hide')\"\n\n\n end",
"def auto_price(multiplier)\n @cargo.auto_price(multiplier)\n setup_gui\n end",
"def update\n respond_to do |format|\n if @pricing.update(pricing_params)\n format.html { redirect_to @pricing.item, :flash => { success: 'Pricing was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pricing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_base_price\n @calendar = Calendar.find_by(date: params[:date][:date])\n @calendar.base_value = params[:cost][:cost]\n\n @calendar.save\n UpdatePrice.update_calendar_item(@calendar)\n\n redirect_to admin_path\n end",
"def update_prices(donor_product)\n super donor_product, PRICE_CSS_SELECTOR\n end",
"def update_prices(donor_product)\n super donor_product, PRICE_CSS_SELECTOR\n end",
"def purchase\n @priceplans = Admin::Priceplan.all \n end",
"def new\n @product = Product.new\n build_unitprices(@product)\n end",
"def selected_price_model\n \t@selected_price_model\n \tend",
"def pricing_params\n params.require(:pricing).permit(\n :non_taxable_amount,\n :taxable_amount,\n :tax_amount,\n :pricing_category_id,\n :description,\n uploads_attributes: [:upload_category_id, :description, {uploads: []}])\n end",
"def new\n @self_drive_price = SelfDrivePrice.new\n @self_drive_price.custom_prices.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n end\n end",
"def price(type)\n if type ==1\n cost = @product.price * @quantity\n elsif type == 2\n cost = @product.special_price * @quantity\n elsif type == 3\n cost = @product.member_price * @quantity\n end\n @product.cost = cost\n @product.save\n cost\n end",
"def create \n @pricing = Pricing.new(pricing_params)\n respond_to do |format|\n if @pricing.save\n format.html { redirect_to @pricing.item, :flash => { success: 'Pricing was successfully created.' } }\n format.json { render action: 'show', status: :created, location: @pricing }\n else\n format.html { render action: 'new' }\n format.json { render json: @pricing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pricing = Pricing.find(params[:id])\n\n if @pricing.update(pricing_params)\n #audit(@pricing, current_user)\n head :no_content\n else\n render json: @pricing.errors, status: :unprocessable_entity\n end\n end",
"def price\n raise 'Redefine this method in your billing model.'\n end",
"def price\n raise 'Redefine this method in your billing model.'\n end",
"def calculate_custom_price\n return nil if @selected_rule.nil? || @product.nil?\n\n public_send(@selected_rule[:pricing_method])\n end",
"def for_pricing(product)\n base_price(product).modify!(group.price_modifier)\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def calculate_price\n self.price = product.price\n self.total_price = price * quantity \n end",
"def create\n @breadcrumb = 'update'\n @product = $product\n @supplier = $supplier\n @purchase_price = PurchasePrice.new(params[:purchase_price])\n @purchase_price.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @purchase_price.save\n format.html { redirect_to @purchase_price, notice: crud_notice('created', @purchase_price) }\n format.json { render json: @purchase_price, status: :created, location: @purchase_price }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pricing_sections = PricingSection.all\n end",
"def update\n respond_to do |format|\n if @pricing_section.update(pricing_section_params)\n format.html { redirect_to @pricing_section, notice: \"Pricing section was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pricing_section }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pricing_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def before_submit_purchased!\n end",
"def subtotal\n subtotal = purse.price * quantity\n end",
"def set_price\n @price = Price.find(params[:id])\n @prices = Price.order('position Asc')\n #@price.strain_id = Strain.find(params[:id]).id\n #@price.region_id = Region.find(params[:id]).id\n end",
"def pricing_params\n params.require(:pricing).permit(:user_id)\n end",
"def set_price\n self.product = Product.find(orderable_id)\n self.unit_price = product.price\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def display_price=(price_value)\n case mode\n when 'boxed'\n self.boxed_price = price_value\n else\n self.price = price_value\n end\n end",
"def update\n @delivery_service_prices = DeliveryServicePrice.find_collection(session[:delivery_service_prices], params[:country_id])\n @field_target = params[:object_type] == 'cart' ? 'cart[estimate_delivery_id]' : 'order[delivery_id]'\n render partial: theme_presenter.page_template_path(\"carts/delivery_service_prices/fields\"), format: [:html], locals: { delivery_service_prices: @delivery_service_prices, delivery_id: current_cart.estimate_delivery_id, field_target: @field_target }\n end",
"def create\n @breadcrumb = 'update'\n @product = $product\n @company = $company\n @product_company_price = ProductCompanyPrice.new(params[:product_company_price])\n @product_company_price.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @product_company_price.save\n format.html { redirect_to @product_company_price, notice: crud_notice('created', @product_company_price) }\n format.json { render json: @product_company_price, status: :created, location: @product_company_price }\n else\n @suppliers = suppliers_dropdown\n format.html { render action: \"new\" }\n format.json { render json: @product_company_price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def admin_price_params\n params.require(:admin_price).permit(:cost, :discount, :new, :product_detail_id)\n end",
"def variant_params\n params.require(:supply_variant).permit(:price, :compare_at_price, :option1, :option2, :option3)\n end",
"def set_admin_price\n @admin_price = Price.find(params[:id])\n end",
"def product_details(choice)\n\t#fetch record from products for select user product\n\t\tstatement1=@connection.prepare(\"select * from products where p_id=?\")\n\t\tstatement1.execute(choice)\n\t\trecordset1=statement1.fetch\n\n\t\tloop do\n\t\t\tprint \"\\n\\n\\t\\tEnter quantity: \"\n\t#get quantity from user\n\t\t\t@quantity=gets.to_i\n\t#check quantity condition\n\t\tbreak if @quantity>0 and @quantity<recordset1[2]+1\n\t\t\tputs \"\\n\\n\\t\\tInvalid Quantity!!!...Enter Correct\"\n\t\tend\n\n\t\trows=[]\n\n\t\ttable=Terminal::Table.new\n\t\ttable.headings=[\"Name\",\"Price\",\"Available Stock\",\"Quantity\"]\n\n\t\trows<<[recordset1[1],recordset1[3],recordset1[2],@quantity]\n\n\t\ttable.rows=rows\n\n\t\tputs \"\\n#{table}\"\n\t#insert values into inline product that user selected product\n\t\tstatement3=@connection.prepare(\"insert into inline_products values(?,?,?)\")\n\t\tstatement3.execute(@card_no,choice,@quantity)\n\t\t@connection.commit\n\t#call purchase_more_item method\n\t\tpurchase_more_item\n\tend",
"def set_pricing\n\t\tself.current_price = self.starting_price if self.current_price.nil?\n\t\tself.product_is_sold = false if self.product_is_sold.nil?\n\t\tself.bids = 0 if self.bids.nil?\n\t\tself.auction_is_over = false if self.auction_is_over.nil?\n\tend",
"def price_params\n params.require(:price).permit :product_id, :size_id, :value\n end",
"def new\n @subproduct = Subproduct.new\n end",
"def price_params\n params.require(:cost).permit(:title, :description, :price1, :price2, :price_category_id)\n end",
"def check_price\n end",
"def price_params\n params.require(:price).permit(:rank_id, :menu_id, :price)\n end",
"def prepare_customer_form\n prepopulate_customer_info\n @membership_order = Membership.find(session[:current_premium_id]) if session[:current_premium_id]\n @referral = ReferralCategory.order(\"id ASC\")\n prepare_price\n end",
"def paypal_form\n \t\t{name: nombre, sku: :item, price: (precio / 100), currency:\"USD\", quantity:1}\n end",
"def edit\n @subproduct = Subproduct.find(params[:id])\n end",
"def activate\n OptionValue.class_eval do\n belongs_to :tariff\n end\n\n Variant.additional_fields = []\n\n Variant.class_eval do\n after_create :assign_tariff_option\n #before_validation :calc_price\n\n def tariff\n @tariff ||= option_values.first.try(:tariff)\n end\n\n def tariff=(tariff)\n @tariff = tariff\n end\n\n# def package_price\n# if price == -1\n# tariff.eval_package_price(product)\n# else\n# price\n# end\n# end\n\n def assign_tariff_option\n if @tariff\n tariff_option_value = OptionValue.find_by_tariff_id(@tariff.id)\n option_values << tariff_option_value \n end\n end\n\n\n def check_price\n price = if cost_price == -1\n tariff.eval_package_price(product)\n else\n cost_price\n end\n\n price = 0 if price < 0\n end\n\n end\n\n\n Product.class_eval do\n\n named_scope :tariffable, :conditions => { :is_tariffable => true }\n \n\n def init_tariff_packages\n option_types = [OptionType.find_by_name('tariff_package')]\n\n Tariff.all.each do |tariff|\n variant = variants.build(:cost_price => '-1')\n variant.tariff = tariff\n variant.save\n end\n end\n end\n\n\n# ProductsController.class_eval do\n# alias_method :orig_load_data, :load_data\n#\n# def load_data\n# orig_load_data\n#\n# filled_out_tariffs = []\n# @tariff_packages = []\n# @product.variants.each do |variant|\n# tariff = variant.option_values.first.try(:tariff)\n# continue if tariff.nil?\n# @tariff_packages << tariff.attributes.merge({ \n# 'operator_name' => tariff.operator.name,\n# 'package_price' => variant.price})\n#\n# filled_out_tariffs << tariff.id\n# end\n#\n# Tariff.published.each do |tariff|\n# unless filled_out_tariffs.include?(tariff.id)\n# @tariff_packages << tariff.attributes.merge({\n# 'operator_name' => tariff.operator.name,\n# 'package_price' => tariff.eval_package_price(@product)})\n# end\n# end\n# end\n# end\n\n # make your helper avaliable in all views\n # Spree::BaseController.class_eval do\n # helper YourHelper\n # end\n end",
"def changesub\n @plan = params[:sub][:plan]\n @planobject = Plan.find_by_my_plan_id(@plan)\n @events_number = @planobject.events_number \n @code = params[:sub][:code]\n\n # don't need to check the is_valid_free_sub, because customer is auto-created if that helper is successful in sub_coupon\n if is_valid_sub_coupon(@code) && !@planobject.nil?\n @coupon = Coupon.find_by_free_page_name(@code)\n @new_price = @planobject.monthly_cost_cents * (100 - @coupon.percent_off)/100\n flash.now[:success] = \"Your promo code has been applied!\"\n else #could not find that coupon\n @code = nil \n @coupon = nil \n @new_price = nil\n end\n render action: 'stripenewcustomer'\nend",
"def price\n @price\n end",
"def price\n @price\n end",
"def set_product\n \n end",
"def item_update_price\n @brief = Brief.find(params[:brief_id])\n @brief_vendor = @brief.brief_vendors.find_by_org_id(@cur_user.org_id)\n invalid_op unless @brief_vendor\n @item = @brief_vendor.items.find_by_id(params[:item_id])\n invalid_op unless @item\n \n @item.price = params[:item][:price]\n @item.save\n\n redirect_to vendor_show_brief_path(@brief)\n\n end",
"def of_update_description_prices_from_product\n product = params[:product]\n supplier = params[:supplier]\n description = \"\"\n qty = 0\n price = 0\n discount_p = 0\n discount = 0\n code = \"\"\n amount = 0\n tax_type_id = 0\n tax_type_tax = 0\n tax = 0\n if product != '0'\n @product = Product.find(product)\n @prices = @product.purchase_prices\n # Assignment\n description = @product.main_description[0,40]\n qty = params[:qty].to_f / 10000\n # Use purchase price, if any. Otherwise, the reference price\n price, discount_p, code = product_price_to_apply(@product, supplier)\n if discount_p > 0\n discount = price * (discount_p / 100)\n end\n amount = qty * (price - discount)\n tax_type_id = @product.tax_type.id\n tax_type_tax = @product.tax_type.tax\n tax = amount * (tax_type_tax / 100)\n end\n # Format numbers\n price = number_with_precision(price.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"description\" => description, \"price\" => price.to_s, \"amount\" => amount.to_s,\n \"tax\" => tax.to_s, \"type\" => tax_type_id,\n \"discountp\" => discount_p, \"discount\" => discount, \"code\" => code }\n render json: @json_data\n end",
"def subtotal\n self.cost_per_pound * self.order_quantity\n end",
"def products\n end",
"def update\n if @price.update!(price_params)\n render partial:'list', locals: {product:@price.product}, layout: nil\n else\n render partial:'form', locals: {price:@price}, layout: nil, status: :unprocessable_entity\n end\n end",
"def create_price \n Price.create_from_item(self)\n end",
"def build_subline_form(action,caption)\n\n\tline_config_codes = LineConfig.find_by_sql('select distinct line_config_code from line_configs').map{|g|[g.line_config_code]}\n\tline_config_codes.unshift(\"<empty>\")\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\t field_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'subline_code'}\n\n\t field_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'subline_description'}\n\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (line_config_id) on related table: line_configs\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[2] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'line_config_code',\n\t\t\t\t\t\t:settings => {:list => line_config_codes}}\n\n\tbuild_form(nil,field_configs,action,'subline',caption)\n\nend",
"def set_product_price\n @product_price = ProductPrice.find(params[:id])\n end",
"def set_product_price\n @product_price = ProductPrice.find(params[:id])\n end",
"def price\n @sibit.price\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_prices\n @price = Price.find(params[:id])\n end",
"def price_params\n params.require(:price).permit(:product_id, :value)\n end",
"def sub_total\n # quantity * unit_price\n unit_price\n end",
"def price\n total\n end",
"def test_price_increase\n upload_catalog('Catalog-v1.xml', false, @user, @options)\n\n create_basic_entitlement(1, 'MONTHLY', '2013-08-01', '2013-09-01', 1000.0)\n\n # Effective date of the second catalog is 2013-09-01\n upload_catalog('Catalog-v2.xml', false, @user, @options)\n\n # Original subscription is grandfathered\n add_days_and_check_invoice_item(31, 2, 'basic-monthly', '2013-09-01', '2013-10-01', 1000.0)\n\n # Create a new subscription and check the new price is effective\n create_basic_entitlement(3, 'MONTHLY', '2013-09-01', '2013-10-01', 1200.0)\n\n add_days_and_check_invoice_balance(30, 4, '2013-10-01', 2200.0)\n end",
"def calculate_model_price\n @group.calculate_model_price(model_params[:model_type_name], model_params[:base_price])\n end",
"def pricing_section_params\n params.require(:pricing_section).permit(:section_id, :description)\n end",
"def pricing_policy\n car.pricing_policy\n end",
"def calculate_price\n self.price = item.price * qty if item\n end",
"def set_Price(value)\n set_input(\"Price\", value)\n end",
"def create\n @admin_price = Price.new(admin_price_params)\n\n respond_to do |format|\n if @admin_price.save\n format.html { redirect_to @admin_price, notice: 'Price was successfully created.' }\n format.json { render :show, status: :created, location: @admin_price }\n else\n format.html { render :new }\n format.json { render json: @admin_price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_subtotal\n self.product_size.product.price * self.quantity\n end",
"def build_standard_size_count_form(standard_size_count,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:standard_size_count_form]= Hash.new\n\tstandard_count_values = StandardCount.find_by_sql('select distinct standard_count_value from standard_counts').map{|g|[g.standard_count_value]}\n\tstandard_count_values.unshift(\"<empty>\")\n\tcommodity_codes = Commodity.find_by_sql('select distinct commodity_code from commodities').map{|g|[g.commodity_code]}\n\tcommodity_codes.unshift(\"<empty>\")\n\tbasic_pack_codes = BasicPack.find_by_sql('select distinct basic_pack_code from basic_packs').map{|g|[g.basic_pack_code]}\n\tbasic_pack_codes.unshift(\"<empty>\")\n\told_pack_codes = OldPack.find_by_sql('select distinct old_pack_code from old_packs').map{|g|[g.old_pack_code]}\n\told_pack_codes.unshift(\"<empty>\")\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'standard_size_count_description'}\n\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (commodity_id) on related table: commodities\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[1] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'commodity_code',\n\t\t\t\t\t\t:settings => {:list => commodity_codes}}\n \n\tfield_configs[2] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'diameter_mm'}\n\n\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (old_pack_id) on related table: old_packs\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[3] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'old_pack_code',\n\t\t\t\t\t\t:settings => {:list => old_pack_codes}}\n \n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (standard_count_id) on related table: standard_counts\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[4] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'standard_size_count_value',\n\t\t\t\t\t\t:settings => {:list => standard_count_values}}\n \n\n\tfield_configs[5] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'actual_count'}\n\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (basic_pack_id) on related table: basic_packs\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[6] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'basic_pack_code',\n\t\t\t\t\t\t:settings => {:list => basic_pack_codes}}\n\t#NAE 2015-04-17 add new field average_weight_gm\n\tfield_configs[7] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'average_weight_gm'}\n \n\tbuild_form(standard_size_count,field_configs,action,'standard_size_count',caption,is_edit)\n\nend",
"def update\n @delivery_service_prices = DeliveryServicePrice.find_collection(current_cart, params[:country_id])\n render partial: \"orders/delivery_service_prices/fields\", :locals => { delivery_service_prices: @delivery_service_prices, delivery_id: current_cart.order.delivery_id }\n end",
"def buy_product\n products = @seller.show_product_info \n product_buy = @view.buy_product(products)\n @total_price = @seller.save_buy_a_product(product_buy)\n @view.buy_status(@total_price)\n input = @view.menu(\"2\")\n seller_actions(input) \n end"
] | [
"0.64287066",
"0.6364972",
"0.62145567",
"0.6124128",
"0.6124128",
"0.6124128",
"0.59390074",
"0.5935499",
"0.58450955",
"0.5844143",
"0.57943785",
"0.5794063",
"0.5791016",
"0.5770293",
"0.5770293",
"0.571319",
"0.57033384",
"0.57024044",
"0.5701781",
"0.5700988",
"0.56823415",
"0.5678595",
"0.56611544",
"0.56611544",
"0.5633802",
"0.56252337",
"0.56119674",
"0.56007385",
"0.55962515",
"0.557538",
"0.55617946",
"0.5550807",
"0.55379915",
"0.55379915",
"0.55308753",
"0.55274963",
"0.5514555",
"0.5493974",
"0.54872304",
"0.54856277",
"0.5477796",
"0.5465261",
"0.5457867",
"0.54407716",
"0.54348606",
"0.543346",
"0.54319245",
"0.54319245",
"0.54319245",
"0.54319245",
"0.54319245",
"0.54319245",
"0.54319245",
"0.54319245",
"0.5429614",
"0.5426962",
"0.5424199",
"0.5423664",
"0.54176813",
"0.54110533",
"0.5405919",
"0.5405834",
"0.5405515",
"0.5404639",
"0.54039395",
"0.538771",
"0.5382643",
"0.53796655",
"0.53775036",
"0.53710425",
"0.5367813",
"0.5367177",
"0.53643036",
"0.53643036",
"0.5361489",
"0.5352443",
"0.5346014",
"0.53377545",
"0.53305656",
"0.5329762",
"0.53202385",
"0.53182644",
"0.53109264",
"0.53109264",
"0.530821",
"0.53028315",
"0.52865607",
"0.52830446",
"0.5281235",
"0.52788454",
"0.5266877",
"0.52637964",
"0.52591956",
"0.5258221",
"0.52516246",
"0.5250927",
"0.52501976",
"0.5239062",
"0.52168757",
"0.52144957",
"0.5213737"
] | 0.0 | -1 |
Actions for Surveys subform | def add_associated_survey
@organization = Organization.find(params[:surveyable_id])
@associated_survey = @organization.associated_surveys.new :survey_id => params[:survey_id]
if @associated_survey.save
flash[:success] = "Survey added successfully."
else
@organization.reload
@associated_survey.errors.messages.each do |field, message|
flash[:alert] = "Error adding survey: #{message.first}."
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goto_surveys\n goto_controller('Assignment Survey')\n end",
"def sub_view\n page(NavTabBarPage).select_storytab(\"Action\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(NavTabBarPage).select_storytab(\"Action\")\n page(NavTabBarPage).sub_handler\n page(SubmissionPage).verify_page_elements\n page(SubmissionPage).select_action(\"Submissions\")\n page(SubmissionPage).select_action(\"Comments\")\n page(MorePage).backpage\n end",
"def add_student_voice_surveys\n ImportedForm.create!({\n \"educator_id\"=>shs_jodi.id,\n \"student_id\"=>shs_freshman_mari.id,\n 'form_timestamp' => time_now - 2.days,\n \"form_key\"=>\"shs_what_i_want_my_teacher_to_know_mid_year\",\n 'form_url' => 'https://example.com/mid_year_survey_form_url',\n 'form_json' => {\n \"What was the high point for you in school this year so far?\"=>\"A high point has been my grade in Biology since I had to work a lot for it\",\n \"I am proud that I...\"=>\"Have good grades in my classes\",\n \"My best qualities are...\"=>\"helping others when they don't know how to do homework assignments\",\n \"My activities and interests outside of school are...\"=>\"cheering\",\n \"I get nervous or stressed in school when...\"=>\"I get a low grade on an assignment that I thought I would do well on\",\n \"I learn best when my teachers...\"=>\"show me each step of what I have to do\"\n }\n })\n ImportedForm.create!({\n \"educator_id\"=>shs_jodi.id,\n \"student_id\"=>shs_freshman_mari.id,\n 'form_timestamp' => time_now - 2.days,\n \"form_key\"=>\"shs_q2_self_reflection\",\n 'form_url' => 'https://example.com/q2_self_reflection_form_url',\n 'form_json' => {\n \"What classes are you doing well in?\"=>\"Computer Science, French\",\n \"Why are you doing well in those classes?\"=>\"I make time in my afternoon each day for doing homework and stick to it\",\n \"What courses are you struggling in?\"=>\"Nothing really\",\n \"Why are you struggling in those courses?\"=>\"I have to work really hard \",\n \"In the classes that you are struggling in, how can your teachers support you so that your grades, experience, work load, etc, improve?\"=>\"Change the way homework works, it's too much\",\n \"When you are struggling, who do you go to for support, encouragement, advice, etc?\"=>\"Being able to stay after school and work with teachers when I need help\",\n \"At the end of the quarter 3, what would make you most proud of your accomplishments in your course?\"=>\"Keeping grades high in all classes since I'm worried about college\",\n \"What other information is important for your teachers to know so that we can support you and your learning? (For example, tutor, mentor, before school HW help, study group, etc)\"=>\"Help in the morning before school\"\n }\n })\n end",
"def survey_params\n params[:survey]\n end",
"def set_survey_form\n @survey_form = ::StecmsCoupon::SurveyForm.find(params[:id])\n authorize @survey_form\n end",
"def build_subline_form(action,caption)\n\n\tline_config_codes = LineConfig.find_by_sql('select distinct line_config_code from line_configs').map{|g|[g.line_config_code]}\n\tline_config_codes.unshift(\"<empty>\")\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\t field_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'subline_code'}\n\n\t field_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'subline_description'}\n\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (line_config_id) on related table: line_configs\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[2] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'line_config_code',\n\t\t\t\t\t\t:settings => {:list => line_config_codes}}\n\n\tbuild_form(nil,field_configs,action,'subline',caption)\n\nend",
"def survey_page\n self\n end",
"def goto_course_surveys\n goto_controller('Course Survey')\n end",
"def index\n @reform_surveys = ReformSurvey.all\n end",
"def survey_params\n params[:survey]\n end",
"def submits; end",
"def submit\n frm.button(:value=>\"Submit\").click\n @@file_number=0\n if frm.div(:class=>\"portletBody\").h3.text=~/Submission Confirmation/\n SubmissionConfirmation.new(@browser)\n elsif frm.button(:value=>\"Back to list\").exist?\n SubmissionConfirmation.new(@browser)\n else\n AssessmentsList.new(@browser)\n end\n end",
"def submit\n frm.button(:value=>\"Submit\").click\n @@file_number=0\n if frm.div(:class=>\"portletBody\").h3.text=~/Submission Confirmation/\n SubmissionConfirmation.new(@browser)\n elsif frm.button(:value=>\"Back to list\").exist?\n SubmissionConfirmation.new(@browser)\n else\n AssessmentsList.new(@browser)\n end\n end",
"def send_survey\n Message.send_survey_to(self)\n end",
"def set_survey_form\n @survey_form = SurveyForm.includes(:questions).find(params[:id])\n end",
"def index\n @survey_forms = SurveyForm.all\n end",
"def set_survey_form!\n @survey_form = SurveyForm.find(params[:survey_form_id])\n end",
"def new\n @survey = Survey.new\n end",
"def index\n @studsubanswers = Studsubanswer.all\n end",
"def create\n @survey = Survey.new(survey_params)\n @survey.save\n respond_with( [ :admin, @survey] )\n end",
"def take_survey\n @survey = Survey.find(params[:id])\n p \"this is survey taking method\"\n \n\n end",
"def set_reform_survey\n @reform_survey = params[:action] == 'new' ? ReformSurvey.new : params[:action] == 'create' ? @reform_survey = ReformSurvey.new(reform_survey_params) : ReformSurvey.find(params[:id])\n end",
"def update_survey\n @evaluation_template.update_survey(params)\n if @evaluation_template.save\n flash[:success] = \"Template updated.\"\n redirect_to @evaluation_template\n else\n flash.now[:error] = \"Template could not be updated.\"\n render 'show'\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n success = @survey.update_attributes(params[:survey])\n \n puts \"UPDATE: Survey:#{@survey.id} - #{@survey.name}\"\n # Load the JSON Survey form data.\n survey_questions = ActiveSupport::JSON.decode(@survey.survey_data)\n #y survey_questions\n \n update_questions(@survey, survey_questions)\n \n # Render a response.\n respond_to do |format|\n if success\n format.html { redirect_to(@survey, :notice => 'Survey was successfully updated.') }\n format.xml { head :ok }\n format.js { head :ok}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @survey.errors, :status => :unprocessable_entity }\n format.js { render :json => @survey.errors, :status => :error }\n end\n end\n end",
"def studsubanswer_params\n params.require(:studsubanswer).permit(:subanswer_id, :formanswer_id)\n end",
"def goto_global_survey\n goto_controller('Global Survey')\n end",
"def goto_surveys\n node_object = TreeFolder.find_by_name('Survey')\n session[:root] = FolderNode.find_by_node_object_id(node_object.id).id\n redirect_to controller: 'tree_display', action: 'list'\n end",
"def subject_save\n self.save_button.click\n end",
"def subscribed_surveys\n if self.has_access?(:survey_show_all)\n s = Survey.all(:order => :position)\n # s.delete_if {|s| s.title =~ /Test/}\n # s\n elsif self.has_access?(:survey_show_subscribed)\n self.center.subscribed_surveys\n elsif self.has_access?(:survey_show_login)\n surveys = []\n journal_entry = JournalEntry.find_by_user_id(self.id)\n surveys << journal_entry.survey if journal_entry.survey\n else\n surveys = []\n end\n end",
"def subscribed_surveys\n if self.has_access?(:survey_show_all)\n s = Survey.all(:order => :position)\n # s.delete_if {|s| s.title =~ /Test/}\n # s\n elsif self.has_access?(:survey_show_subscribed)\n self.center.subscribed_surveys\n elsif self.has_access?(:survey_show_login)\n surveys = []\n journal_entry = JournalEntry.find_by_user_id(self.id)\n surveys << journal_entry.survey if journal_entry.survey\n else\n surveys = []\n end\n end",
"def save\n frm.button(:name=>\"modifyPartForm:_id89\").click\n EditAssessment.new(@browser)\n end",
"def index\n redirect_to presentation_survey_path(params[:presentation_id], params[:survey_id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def index\n @admin_surveys = Admin::Survey.all\n end",
"def index\n @signupsurveys = Signupsurvey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def survey_params\n params.require(:survey).permit(:name,\n :intro,\n :thanks,\n :optout,\n :closed,\n :open,\n rapidfire_question_group_ids: [])\n end",
"def subscribed_surveys\n if self.has_access?(:survey_show_all)\n s = Survey.all.order(:position)\n # s.delete_if {|s| s.title =~ /Test/}\n # s\n elsif self.has_access?(:survey_show_subscribed)\n self.center.subscribed_surveys\n elsif self.has_access?(:survey_show_login)\n surveys = []\n journal_entry = JournalEntry.find_by_user_id(self.id)\n surveys << journal_entry.survey if journal_entry.survey\n else\n surveys = []\n end\n end",
"def survey\n expose Survey.create(@oauth_token, params[:challenge_id].strip, \n params[:data])\n end",
"def surveyWorkflow\n survey_status = session[:survey_status]\n \n case survey_status\n when \"survey created\"\n redirect_to :controller=>'questions',:action=>'new',:survey_id=> @survey.id\n when \"questions created\"\n redirect_to :controller=>'surveys',:action=>'show',:id=> @survey.id,:notice=>'Great! Your Survey is Created!'\n when \"survey updated\"\n \tredirect_to :controller=>'questions',:action=>'edit',:survey_id=> @survey.id\n\twhen \"questions updated\"\n\t\tredirect_to :controller=>'themes',:action=>'index', :id=> @survey.id\n\twhen \"theme chosen\"\n\t\tredirect_to :controller=>'surveys',:action=>'show',:id=> @survey.id\t, :survey => @survey\t\n end\n \n end",
"def forms; end",
"def submit; end",
"def begin_assessment\n frm.button(:value=>\"Begin Assessment\").click\n end",
"def form; end",
"def survey_params\n params.require(:survey).permit(:name,\n :intro,\n :thanks,\n :closed,\n :open,\n rapidfire_question_group_ids: [])\n end",
"def survey_params\n params.require(:survey).permit( :name, :form_type, :disabled, :form_section_id, :archive )\n end",
"def submit\n end",
"def create\n # @reform_survey = ReformSurvey.new(reform_survey_params)\n\n respond_to do |format|\n if @reform_survey.save\n format.html { redirect_to admin_quarter_reform_survey_path(quarter_id: @quarter.slug, id: @reform_survey.id), notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.reform_survey', count: 1)) }\n else\n format.html { render :new }\n end\n end\n end",
"def open_subject_id_form\n click_subject_buttons('Subject ID')\n end",
"def new\n @survey = Survey.new\n 3.times do\n question = @survey.questions.build\n 4.times { question.choices.build }\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end",
"def set_studsubanswer\n @studsubanswer = Studsubanswer.find(params[:id])\n end",
"def update\n @survey.update(survey_params)\n respond_with( [ :admin, @survey] )\n end",
"def display_survey(survey_layout)\n warning = false\n survey_file = get_survey_path(survey_layout[SURVEY][:datafile])\n if survey_layout.has_key?(ERRORS)\n display_alert(lead: 'Error: could not load survey layout!', body: \"#{survey_layout[ERRORS]} Contact the survey owner: #{survey_layout[SURVEY][CONTACT]}.\")\n elsif File.file?(survey_file)\n survey_data = {}\n begin\n survey_data = JSON.parse(File.read(survey_file), :symbolize_names => true)\n # Check if the user has already submitted this survey\n if survey_data.has_key?($USER.to_sym)\n display_alert(lead: 'Warning: User already submitted survey data!', body: \"#{__method__}(#{survey_file}) You appear to have **already submitted** this survey data; you may want to edit the survey.json in SVN, or contact the survey owner: #{survey_layout[SURVEY][CONTACT]}.\")\n warning = true\n end\n rescue StandardError => e\n display_alert(lead: 'Error: parsing survey datafile!', body: \"**#{__method__}(#{survey_file}) #{e.message}**\\n\\n #{e.backtrace[0]}\")\n warning = true\n end\n else\n display_alert(lead: 'Warning: could not find survey datafile!', body: \"**#{__method__}(#{survey_file})** the data file to store survey answers was not supplied or found; contact the survey owner: #{survey_layout[SURVEY][CONTACT]}.\")\n warning = true\n end\n\n # Emit the survey, or the default one which provides help on the survey tool\n _whimsy_panel(\"#{survey_layout[SURVEY][FORM][:title]} (user: #{$USER})\", style: 'panel-success') do\n _form.form_horizontal method: 'post' do\n survey_layout[SURVEY][FORM][:fields].each do |field|\n _whimsy_field_chooser(field)\n end\n _div.col_sm_offset_3.col_sm_9 do\n _span.help_block id: 'submit_help' do\n _span.text_info survey_layout[SURVEY][FORM][:buttonhelp]\n _span.text_danger 'Warning! Note potential errors above.' if warning\n end\n _input.btn.btn_default type: 'submit', id: 'submit', value: survey_layout[SURVEY][FORM][:buttontext], aria_describedby: 'submit_help'\n end\n end\n end\nend",
"def new\n @question = @subsection.questions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def survey\n parent ? parent.survey : self\n end",
"def create\n @s = []\n params.each do |name, value|\n if name =~ /vertical_(.+)$/\n if value =~ /radio(.+)$/\n @s << $1.to_i\n end\n end\n end\n @poll = Poll.find(Pollitem.find(@s[0].to_i).poll_id)\n for s in @s\n @survey = Survey.create(pollitem_id: s.to_i, user_id: current_user.id, poll_id: @poll.id)\n end\n\n\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render :show, status: :created, location: @survey }\n format.js\n else\n format.html { render :new }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_prescreen_common_assessment\n\t\tli_sub_section_id = 47#2 # working subsection\n\t\t@assessment_questions = AssessmentQuestion.get_questions_collection(li_sub_section_id) #\n\t\t@prescreen_household_id = params[:household_prescreening_id]\n\t\t@common_prescreen_assessment_answer_object = PrescreenAssessmentAnswer.new\n\tend",
"def set_signupsurvey\n @signupsurvey = Signupsurvey.find(params[:id])\n end",
"def show\n @section_id = params[:section].to_i || 0\n # raise @section_id.to_s\n @survey = @survey_instance.survey\n \n end",
"def set_survey\n @survey = Survey.find_by(id: params[:id])\n unless @survey\n flash[:notice] = 'The resource does not exist!'\n redirect_to surveys_path\n end\n end",
"def form\n end",
"def survey_params\n params.require(:survey).permit(:title, :description, :author_id,\n questions_attributes: [:id, :text, :description, :question_type_id, :_destroy])\n end",
"def click_submit\n end",
"def create\n @survey = Survey.new(survey_params)\n\n respond_to do |format|\n if @survey.save\n format.html { redirect_to admin_survey_path @survey, notice: 'Survey was successfully created.' }\n format.json { render :show, status: :created, location: @survey }\n else\n format.html { render :new }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submit_for_grading\n frm.button(:value=>\"Submit for Grading\").click\n SubmissionSummary.new(@browser)\n end",
"def create\n @question = Question.new(question_params)\n @survey = Survey.find(params[:id])\n @surveys = Survey.all\n @questions = Question.all\n if @question.save\n flash[:notice] = 'Question was successfully created.' \n redirect_to(:controller => 'surveys', :action => 'index', :survey_id => @survey.id)\n else\n \n render('new') \n end\n end",
"def setup(surveys)\n\t\t@surveys = surveys\n\tend",
"def survey_params\n params.require(:survey).permit(:name, :descr, :author)\n end",
"def set_survey_section\n @survey_section = SurveySection.find(params[:id])\n end",
"def sub_post\n page(NavTabBarPage).select_storytab(\"Reply\")\n page(SubmissionPage).create_post(\"reply post\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(SubmissionPage).touch_discard\n end",
"def submit_survey(formdata: {})\n filename = get_survey_path(formdata[:datafile])\n formdata.delete(:datafile) # Remove before generating output\n submission_data = JSON.pretty_generate(formdata) + \"\\n\"\n _div.well do\n _p.lead \"Submitting your survey data to: #{filename}\"\n _pre \"(#{$USER})\\n#{submission_data}\"\n end\n\n rc = 999 # Ensure it's a bogus value\n Dir.mktmpdir do |tmpdir|\n ASF::SVN.svn_('checkout',[get_survey_root(), tmpdir],_,{depth: 'files', user: $USER, password: $PASSWORD})\n\n survey_data = JSON.parse(File.read(filename), :symbolize_names => true)\n # Add user data (may overwrite existing entry!)\n survey_data[$USER] = formdata\n # Sort file (to keep diff clean) and write it back\n survey_data = Hash[survey_data.keys.sort.map {|k| [k, survey_data[k]]}]\n\n File.write(filename, JSON.pretty_generate(survey_data))\n Dir.chdir tmpdir do\n # rc = ASF::SVN.svn_('commit', filename, _, {msg: \"Survey submission (whimsy)\", user: $USER, password: $PASSWORD})\n end\n end\n if rc == 0\n return true\n else\n return false\n end\nend",
"def new\n @survey_question = SurveyQuestion.new\n 2.times { @survey_question.survey_options.build }\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @survey_question }\n end\n end",
"def update\n if not (granted_for?('root') || granted_for('survey'))\n access_denied\n else\n \n @survey = Survey.find(params[:id])\n \n @survey.add_question(params[:new_question],\n params[:new_question_values],\n params[:question_type]) unless params[:new_question].blank?\n \n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n flash[:notice] = 'Survey was successfully updated.'\n format.html { redirect_to( edit_survey_path(@survey)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @survey.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def save_and_publish\n frm.button(:value=>\"Save Settings and Publish\").click\n PublishAssessment.new(@browser)\n end",
"def update\n @survey = Survey.find_by_id( params[:survey_id] )\n @question = Question.find_by_id( params[:id] )\n\n if @question.update( question_params )\n if params[:commit] == \"Continue to the Next Step\"\n params[:option_num].to_i.times do\n @question.options.create # TODO: cleanup, could create empty options in db\n end\n\n redirect_to edit_survey_question_path(@survey, @question)\n else\n flash.now[:success] = \"Question Added!\"\n\n # Create new empty question for render\n @question = @survey.questions.build\n\n render :new\n end\n else\n flash.now[:error] = \"Sorry, we couldn't add that question due to errors.\"\n render :new\n end\n end",
"def connect_parent\n @level.submission = Submission.find(params[:submission_id])\n end",
"def connect_parent\n @level.submission = Submission.find(params[:submission_id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def edit_split\n if !params[:study_id]\n flash[\"error\"] = \"To add a new study, please choose a systematic review first.\"\n redirect_to projects_paths\n else\n @study = Study.find(params[:study_id])\n #puts \"---------------------\\n THE STUDY ID IS #{@study.id}\\n\\n\"\n @study_extforms = StudyExtractionForm.find(:all, :conditions=>[\"study_id=?\",@study.id],:select=>[\"id\",\"study_id\",\"extraction_form_id\"],:order=>\"extraction_form_id ASC\")\n @extraction_forms = Array.new\n\n # an array of hashes to keep track of key questions addressed by\n # each individual section\n @ef_kqs = Hash.new()\n unless @study_extforms.empty?\n @study_extforms.each do |ef|\n @ef_kqs[ef.extraction_form_id] = ExtractionForm.get_assigned_question_numbers(ef.extraction_form_id)\n end\n end\n session[:project_id] = @study.project_id\n @project = Project.find(@study.project_id)\n\n unless @study_extforms.empty?\n # get the study title, which is the same as the primary publication for the study\n @study_title = PrimaryPublication.where(:study_id => @study.id).first\n @study_title = @study_title.nil? ? \"\" : @study_title.title.to_s\n #@extraction_form_list_array = Study.get_extraction_form_list_array(session[:project_id])\n @extraction_forms = ExtractionForm.find(:all, :conditions=>[\"id in (?)\",@study_extforms.collect{|x| x.extraction_form_id}])\n @current_form_id = params[:extraction_form_id].nil? ? @extraction_forms.first.id : params[:extraction_form_id].to_i\n @included_sections = ExtractionForm.get_included_sections(@current_form_id)\n end\n # Set up the session variables\n makeStudyActive(@study)\n session[:extraction_form_id] = @current_form_id\n session[:completed_sections] = Study.get_completed_sections(@study.id, @current_form_id)\n end\n render :layout => \"application_split\"\n end",
"def show\n redirect_to root_path, notice: \"Survey submitted!\"\n end",
"def new\n @survey_question = Survey::Question.new\n @parent=params[:parent_type].constantize.find(params[:parent_id])\n @survey_question.parent=@parent\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def show\n redirect_to presentation_survey_path(params[:presentation_id], params[:survey_id])\n end",
"def radiobuttons; end",
"def create\n #raise params.inspect\n @survey = Survey.new(params[:survey])\n\n respond_to do |format|\n if @survey.save\n if is_admin?\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 { redirect_to new_survey_path, notice: 'Survey was successfully created.' }\n end\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 socio_economico_submit\n\n # responding for the first time\n if not session[:current_response_id]\n current_response = nil\n # preparing the object to store the surveys and requests data\n json_response = { 'surveys' => [], 'requests' => [] }\n else\n current_response = FormResponse.find(session[:current_response_id])\n json_response = JSON.parse current_response.json_response\n end\n\n # appending the new response to the array of surveys\n surveys_number = json_response['surveys'].size\n json_response['surveys'] = [] if surveys_number == 0\n json_response['surveys'].push(\n params.merge({\n :attempt => (surveys_number + 1),\n :sent_at => Time.zone.now\n })\n )\n\n if current_response\n current_response.update({\n json_response: json_response.to_json\n })\n else\n # the response must be created only in this form\n # and not in the request form!\n current_response = FormResponse.create({\n form_id: Form.where(reference_model: 'FormVagasRemanescentes').first.id,\n user: current_user.email,\n json_response: json_response.to_json\n })\n\n # storing the response id in session to access it\n # from the other form, the request form\n session[:current_response_id] = current_response.id\n end\n\n redirect_to action: 'pedido'\n end"
] | [
"0.63650465",
"0.6119467",
"0.5991499",
"0.59267044",
"0.59055215",
"0.58541095",
"0.58460486",
"0.5837655",
"0.5742948",
"0.5680584",
"0.5595867",
"0.5590169",
"0.5590169",
"0.5581101",
"0.55748653",
"0.5567919",
"0.5535796",
"0.5532905",
"0.5514446",
"0.5508905",
"0.55038947",
"0.5499737",
"0.54880124",
"0.5454516",
"0.54499054",
"0.5447642",
"0.5447009",
"0.54428375",
"0.543982",
"0.5439173",
"0.54198813",
"0.5418608",
"0.541499",
"0.54143476",
"0.5410185",
"0.5409284",
"0.5409284",
"0.5409284",
"0.5409284",
"0.5409284",
"0.5409284",
"0.54082334",
"0.53969485",
"0.5388315",
"0.53763133",
"0.5366089",
"0.5355524",
"0.5344157",
"0.5337874",
"0.5334719",
"0.5334039",
"0.53298354",
"0.53238297",
"0.53229034",
"0.5310769",
"0.5306322",
"0.53035474",
"0.52918464",
"0.5281681",
"0.52790076",
"0.5270325",
"0.52625406",
"0.52537537",
"0.5251376",
"0.52441585",
"0.5233079",
"0.5232814",
"0.5229189",
"0.52288467",
"0.52287716",
"0.52265394",
"0.5226251",
"0.5224006",
"0.52221185",
"0.52167046",
"0.5216052",
"0.5214383",
"0.52101237",
"0.5202654",
"0.5201654",
"0.51984584",
"0.51984584",
"0.5195074",
"0.5195074",
"0.5195074",
"0.5195074",
"0.5195074",
"0.5195074",
"0.5195074",
"0.5195074",
"0.5195074",
"0.5195074",
"0.5195074",
"0.5194976",
"0.51935613",
"0.519153",
"0.51868093",
"0.5179332",
"0.5176594",
"0.51751345"
] | 0.5500721 | 21 |
================ Imported from OrganizationUpdater ======================== | def update_organization
@attributes = organization_params[:organization]
@attributes.delete(:id)
#detects if incoming name/abbreviation is different from the old name/abbreviation
name_change = @attributes[:name] != @organization.name || @attributes[:abbreviation] != @organization.abbreviation
if @organization.update_attributes(@attributes)
@organization.update_ssr_org_name if (@organization.type != "Institution" && name_change)
update_services
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organization; end",
"def organization; end",
"def organization; end",
"def autonomous_system_organization; end",
"def autonomous_system_organization; end",
"def autonomous_system_organization; end",
"def requestor; organization; end",
"def after_update_org\n\n controller = PublicActivity.get_controller\n\n # Return if seeding or nothing changes\n return if !controller || self.changed.blank?\n\n current_user = PublicActivity.get_controller.current_user\n\n activity = self.create_activity :update, owner: current_user,trackable: self, params: {:detail => I18n.t('logs.update_org', org_name: self.name)}\n activity.organization_id = current_user.organization_id\n activity.save\n end",
"def core \n self.service.organization\n end",
"def run\n super\n\n entity_name = _get_entity_name\n\n o = Opencorporates::Api.new.search entity_name\n o[\"results\"][\"companies\"].each do |result|\n next unless result[\"company\"]\n\n _create_entity \"Organization\", {\n \"name\" => result[\"company\"][\"name\"],\n \"uri\" => result[\"company\"][\"opencorporates_url\"],\n \"opencorporates\" => result\n }\n \n end\n end",
"def run\n super\n\n # Attach to the corpwatch service & search\n x = Client::Corpwatch::CorpwatchService.new\n corps = x.search @entity.name\n\n corps.each do |corp|\n # Create a new organization entity & attach a record\n o = create_entity Entities::Organization, { \n :name => corp.name, \n :data => corp.to_s\n }\n \n create_entity(Entities::PhysicalLocation, {\n :name => corp.address,\n :address => corp.address, \n :state => corp.state,\n :country => corp.country }\n )\n end\nend",
"def organization\n capital_project.organization\n end",
"def org\n self.check.org\n end",
"def org\n self.check.org\n end",
"def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend",
"def organization\n self.data_response.organization\n end",
"def update_organization_units\n\n oldest_update = AdOrganizationUnit.order('created_at').last\n\n if bind && (oldest_update.nil? || oldest_update.created_at<1.day.ago)\n filter = Net::LDAP::Filter.eq(\"objectClass\", \"organizationalunit\")\n results = @connection.search(:base =>\"ou=Sync,\"+base_distinguished_name, :filter => filter)\n remote_organization_units = Hash.new\n local_organization_units = Hash.new\n\n # Build hash for local entries\n AdOrganizationUnit.find_each do |local_entry|\n local_organization_units[local_entry.distinguishedname] = local_entry.whenchanged\n end\n\n # Add new entries to local database\n results.each do |remote_entry|\n # Build hash for remote entries\n remote_organization_units[remote_entry.distinguishedname[0]] = remote_entry.whenchanged[0]\n if !local_organization_units.has_key?(remote_entry.distinguishedname[0])\n new_organization_unit = AdOrganizationUnit.new\n new_organization_unit.distinguishedname = remote_entry.distinguishedname[0]\n new_organization_unit.whenchanged = remote_entry.whenchanged[0]\n new_organization_unit.save!\n end\n end\n\n # Remove old entries from local database\n local_organization_units.each do |local_entry|\n if !remote_organization_units.has_key?(local_entry[0])\n AdOrganizationUnit.find_by_distinguishedname(local_entry[0]).destroy\n end\n end\n else\n return false\n end\n end",
"def ensure_organization\n if self.item.is_a?(Organization)\n self.organization = self.item\n else\n self.organization = self.item.organization unless self.item.try(:organization).nil?\n end\n #self.organization_id = self.organization.id unless self.organization.try(:id).nil?\n end",
"def organization\n self[:O]\n end",
"def org_name\n self.org.try(:name).to_s\n end",
"def organizations_in_vercinity\n\n\tend",
"def company; end",
"def company; end",
"def endorsement_update\n endorsement = Endorsement.take\n\n NotifierMailer.endorsement_update endorsement.organization.id, endorsement.id\n end",
"def org_name\n test_org.name\n end",
"def update_organization\n if organization_id_changed?\n unless organization_id_was.blank?\n old_organization = Organization.find( organization_id_was )\n old_organization.association(:current_registration).reset if current?\n old_organization.update_frameworks\n end\n end\n return true unless organization && current?\n organization.last_current_registration = self\n organization.update_attributes name.to_organization_name_attributes, as: :admin\n if organization.changed?\n organization.save!\n organization.association(:current_registration).reset if current?\n end\n if organization_id_changed? || registered_changed? || number_of_members_changed?\n organization.update_frameworks\n end\n true\n end",
"def repository; end",
"def new_org_handle\n new_org_dxid.sub(/^org-/, \"\")\n end",
"def build_embedded_organization\n build_organization if organization.blank?\n end",
"def set_organization\n # @org = Organization.find(params[:id])\n end",
"def update!(**args)\n @organization_mid = args[:organization_mid] if args.key?(:organization_mid)\n @organization_mid_label = args[:organization_mid_label] if args.key?(:organization_mid_label)\n @organization_name = args[:organization_name] if args.key?(:organization_name)\n @organization_url = args[:organization_url] if args.key?(:organization_url)\n @original_organization_name = args[:original_organization_name] if args.key?(:original_organization_name)\n end",
"def update\n respond_to do |format|\n if @organization.update_attributes( params[:organization],\n :as => ( permitted_to?( :admin, @organization ) ? :admin : :default ) )\n flash[:notice] = 'Organization was successfully updated.'\n format.html { redirect_to(@organization) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def it_update_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @stores = @organization.blank? ? stores_dropdown : @organization.stores.order(:name)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @stores = stores_dropdown\n @products = products_dropdown\n end\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"store\" => @stores, \"product\" => @products_dropdown }\n render json: @json_data\n end",
"def co_update_from_organization\n organization = params[:company]\n if organization != '0'\n @organization = Organization.find(organization)\n @users = @organization.blank? ? users_dropdown : users_dropdown\n #@users = @organization.blank? ? users_dropdown : @organization.users.order(:email)\n else\n @users = users_dropdown\n end\n @json_data = { \"users\" => @users }\n render json: @json_data\n end",
"def si_update_project_textfields_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @suppliers = @organization.blank? ? suppliers_dropdown : @organization.suppliers.order(:supplier_code)\n @projects = @organization.blank? ? projects_dropdown : @organization.projects.order(:project_code)\n @work_orders = @organization.blank? ? work_orders_dropdown : @organization.work_orders.order(:order_no)\n @charge_accounts = @organization.blank? ? charge_accounts_dropdown : @organization.charge_accounts.expenditures\n @stores = @organization.blank? ? stores_dropdown : @organization.stores.order(:name)\n @payment_methods = @organization.blank? ? payment_methods_dropdown : payment_payment_methods(@organization.id)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n @companies = @organization.blank? ? companies_dropdown : companies_dropdown_edit(@organization)\n else\n @suppliers = suppliers_dropdown\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @payment_methods = payment_methods_dropdown\n @products = products_dropdown\n @companies = companies_dropdown\n end\n # Work orders array\n @orders_dropdown = work_orders_array(@work_orders)\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"supplier\" => @suppliers, \"project\" => @projects, \"work_order\" => @orders_dropdown,\n \"charge_account\" => @charge_accounts, \"store\" => @stores,\n \"payment_method\" => @payment_methods, \"product\" => @products_dropdown,\n \"company\" => @companies }\n render json: @json_data\n end",
"def do_your_stuff! organization_name\n get_members_for_org organization_name\n get_repositories_for_all_members\n get_stats_for_repositories\n end",
"def org\n self.host.org\n end",
"def off_org_users\n \n end",
"def set_defaults\n super\n self.organization_type ||= OrganizationType.find_by_class_name(self.name).first\n self.license_holder = self.license_holder.nil? ? false : self.license_holder\n end",
"def set_defaults\n super\n self.organization_type ||= OrganizationType.find_by_class_name(self.name).first\n self.license_holder = self.license_holder.nil? ? true : self.license_holder\n end",
"def set_organization\n @organization = Organization.includes(:notes=>[:user]).friendly.find(params[:id])\n end",
"def of_update_project_textfields_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @suppliers = @organization.blank? ? suppliers_dropdown : @organization.suppliers.order(:supplier_code)\n @offer_requests = @organization.blank? ? offer_requests_dropdown : @organization.offer_requests.not_approved(@organization.id)\n @projects = @organization.blank? ? projects_dropdown : @organization.projects.order(:project_code)\n @work_orders = @organization.blank? ? work_orders_dropdown : @organization.work_orders.order(:order_no)\n @charge_accounts = @organization.blank? ? charge_accounts_dropdown : @organization.charge_accounts.expenditures\n @stores = @organization.blank? ? stores_dropdown : @organization.stores.order(:name)\n @payment_methods = @organization.blank? ? payment_methods_dropdown : payment_payment_methods(@organization.id)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @suppliers = suppliers_dropdown\n @offer_requests = offer_requests_dropdown\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = charge_accounts_dropdown\n @stores = stores_dropdown\n @payment_methods = payment_methods_dropdown\n @products = products_dropdown\n end\n # Work orders array\n @orders_dropdown = orders_array(@work_orders)\n # Offer requests array\n @requests_dropdown = offer_requests_array(@offer_requests)\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"supplier\" => @suppliers, \"offer_request\" => @requests_dropdown,\n \"project\" => @projects, \"work_order\" => @orders_dropdown,\n \"charge_account\" => @charge_accounts, \"store\" => @stores,\n \"payment_method\" => @payment_methods, \"product\" => @products_dropdown }\n render json: @json_data\n end",
"def setup_information\n Repo.from_omniauth(get_repos, self.id, self.collected_repo_keys)\n Organization.from_omniauth(get_organizations, self.id, self.collected_org_keys)\n self.set_skills(get_repos)\n end",
"def repo; end",
"def repo; end",
"def repo; end",
"def repo; end",
"def organization_update_params\n params.require(:organization).permit(:name, :abbreviation, :address, :remarks, :url, :owner_id).merge(:changed_by => current_user)\n end",
"def store_orgs_needed\n\n github = Octokit::Client.new access_token: current_user.oauth_token\n current_user_temp = current_user\n #if not exist an 'user organization' on db save it\n username = github.login\n if !Organization.where(name: username).any?\n org = Organization.new\n org.name = username\n org.save\n current_user_temp.organizations << org\n current_user_temp.save!\n end\n\n #Save missing organizations for the user logged in\n orgs = github.organizations #Get all organizations of the user\n\n #For each org..\n orgs.each do |org_t|\n name_org = org_t.login\n\n #Check if its already in the database\n #If it exists should we edited? (modify code to allow this)\n if !Organization.exists?(github_id: org_t.id)\n\n #Get detail info of specific org from GITHUB\n org_detail = github.org name_org\n\n #Create org\n temp_org = Organization.new\n temp_org.github_id = org_detail.id\n temp_org.url = org_detail.url\n temp_org.name = org_detail.login\n temp_org.company = org_detail.company\n temp_org.public_repos = org_detail.public_repos.to_i\n temp_org.private_repos = org_detail.total_private_repos.to_i\n temp_org.total_repos = org_detail.public_repos.to_i + org_detail.total_private_repos.to_i\n temp_org.collaborators = org_detail.collaborators.to_i\n\n #Save org\n temp_org.save!\n\n #Save organization into user relation\n current_user_temp.organizations << temp_org\n current_user_temp.save!\n\n elsif !current_user_temp.organizations.find_by_github_id(org_t.id) #Check if user already belongs to organization, if not add him to it\n\n current_user_temp.organizations << Organization.find_by_github_id(org_t.id) #Add to current user that org\n current_user_temp.save!\n end\n end\n\n end",
"def update\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n flash[:notice] = 'Organization was successfully updated.'\n #format.html { redirect_to(@organization) }\n format.html { redirect_to :controller => 'organizations', :action => 'show' , :organization=> @organization.site_name }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def private; end",
"def Organization()\r\n ret = _getproperty(1610743808, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def update\n @organization = Organization.find(params[:id])\n params[:organization][:admin_email_to_add] = params[:organization_admin_email_to_add] if params[:organization]\n return false unless user_can_edit? @organization\n if @organization.update_attributes_with_admin(params[:organization])\n redirect_to @organization, notice: 'Organization was successfully updated.'\n else\n render action: \"edit\"\n end\n end",
"def find_organizations\n Organization.all\n end",
"def update\n result = Organization::Editor.perform(organization: current_organization, options: update_organization_params.to_h)\n\n respond_to do |format|\n format.html do\n if result.success?\n flash[:success] = \"Successfully updated \\\"#{current_organization.title}\\\"!\"\n redirect_to current_organization\n else\n current_organization.reload\n render :edit\n end\n end\n format.js do\n set_filter_options\n set_filtered_organizations\n render \"organizations/archive.js.erb\", format: :js\n end\n end\n end",
"def after_create_org\n controller = PublicActivity.get_controller\n\n # Return if seeding or nothing changes\n return if !controller || self.changed.blank?\n\n current_user = PublicActivity.get_controller.current_user\n\n activity = self.create_activity :create, owner: current_user, trackable: self, params: {:detail => I18n.t('logs.create_org', org_name: self.name)}\n activity.organization_id = current_user.organization_id\n activity.save\n end",
"def set_org\n @org_id = request.headers[\"X-WWW-ORG-ID\"]\n end",
"def parse_org\n if raw_event.has_key?('repository') && raw_event['repository'].has_key?('organization')\n @org = { 'login' => raw_event['repository']['organization'] }\n else\n @org = parse_field('org', %w{id login gravatar_id avatar_url url})\n end\n end",
"def update\n @organization.remove_members(params[:organization][:user_ids])\n\n if @organization.update_attributes(check_owner(organization_params))\n\n update_owner(@organization, organization_params[:owner_id])\n @organization.notify_and_update_classes\n\n redirect_to @organization, notice: 'Organization was successfully updated.'\n else\n set_errors_render(@organization, :edit)\n end\n end",
"def upgrade_reviewer_to_real(organization, role)\n update_attributes :organization => organization, :role => role\n Annotation.update_all(\"organization_id = #{organization.id}\", \"account_id = #{id}\")\n end",
"def replace_update_me\n end",
"def adopt_organization\n if external_id? && organization.blank?\n self.organization = Organization.where { |o| o.id.in(\n Registration.unscoped.where( :external_id => external_id ).\n select { organization_id } ) }.first\n end\n true\n end",
"def update!(**args)\n @organization_id = args[:organization_id] if args.key?(:organization_id)\n @organization_name = args[:organization_name] if args.key?(:organization_name)\n end",
"def allowed_types\n [Organization]\nend",
"def create_organisation_items\n create_organisation\n end",
"def org\n object.user.org&.handle\n end",
"def update\n # this action is not provided for partyroles\n end",
"def organization_id\n self.organization.id if self.organization && self.organization.is_a?(Organization)\n end",
"def org\n client.org(org_id)\n end",
"def org\n client.org(org_id)\n end",
"def update\n @organization = Organization.find(params[:id])\n @organization.update_attributes(organization_params)\n \n respond_with(@organization, :location => admin_organizations_path)\n end",
"def organization_url\n \"#{organization_base_url}.#{request_format}\"\n end",
"def build_organization_metadata\n @organization ||= {\n '@type' => 'Organization',\n 'name' => I18n.translate('we_meditate'),\n 'logo' => {\n '@type' => 'ImageObject',\n 'url' => ApplicationController.helpers.image_url('metadata/logo.png'),\n 'width' => 132,\n 'height' => 60,\n },\n 'sameAs' => social_media_urls.values.reject(&:empty?),\n }.freeze\n end",
"def update\n @organization = Organization.find(params[:id])\n\n if current_user.has_role?('admin')\n @organization.is_pending = false\n end\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n flash[:notice] = 'Organization was successfully updated.'\n format.html { redirect_to(@organization) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def admin_organizations_with_protocols\n Organization.authorized_for_identity(@id).joins(:sub_service_requests)\n end",
"def set_organization\n @organization = Organization.custom_find(params[:id])\n end",
"def set_organization\n @organization = Organization.with_deleted.find(params[:id])\n end",
"def refresh_organization_status?\n show?\n end",
"def thorins_company; end",
"def get_organization\n return \"NSBE\" if affiliation == 1\n \"SHPE\"\n end",
"def set_org\n @org = Organization.find(params[:id])\n end",
"def set_doe_util_changes\n\n # there is no bldg_id column for sca projects\n buildings = self.school_buildings\n\n buildings_ids_array = buildings.map {|b| b['bldg_id']}.uniq\n\n doe_significant_utilization_changes = CeqrData::DoeSignificantUtilizationChanges.version(\n data_package.table_for(\"doe_significant_utilization_changes\")\n ).doe_util_changes_matching_with_building_ids(buildings_ids_array)\n\n self.doe_util_changes = doe_significant_utilization_changes.map do |d|\n {\n url: d[:url],\n title: d[:title],\n org_id: d[:org_id],\n bldg_id: d[:bldg_id],\n vote_date: d[:vote_date],\n at_scale_year: d[:at_scale_year],\n at_scale_enroll: d[:at_scale_enroll],\n bldg_id_additional: d[:bldg_id_additional]\n }\n end\nend",
"def generate_owned_organization\n return if self.owned_organizations.length > 0\n\n self.organization_name ||= self.name\n self.owned_organizations << Organization.new(name: self.organization_name)\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n if organization_params[:manual_fee_entry] == \"0\"\n @organization.update_attribute(:amount_owe, @organization.tournament.price*@organization.clubs.size)\n end\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n @tournaments = Tournament.active_tournaments\n @organization.clubs.build if @organization.clubs.empty?\n format.html { render action: 'edit' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @organization = Organization.find_by_permalink(params[:id])\n\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n # if permalink is re-generated, the permalink value gotten through the translation object is not refreshed\n # - have to get it by hand\n format.html { redirect_to organization_path(@organization.organization_translations.select{|x| x.locale == I18n.locale.to_s}.first.permalink), notice: t('app.msgs.success_updated', :obj => t('activerecord.models.user')) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def run\n super\n\n entity_name = _get_entity_name\n\n # Search users\n search_uri = \"https://api.github.com/search/users?q=#{entity_name}\"\n response = _get_response(search_uri)\n _parse_items(response[\"items\"],\"GithubUser\")\n\n # Search respositories\n search_uri = \"https://api.github.com/search/repositories?q=#{entity_name}\"\n response = _get_response(search_uri)\n _parse_items(response[\"items\"],\"GithubRepository\")\n\n #search_uri = \"https://api.github.com/search/issues?q=#{entity_name}\"\n #response = _search_github(search_uri,\"GithubIssue\")\n #_parse_items response[\"items\"]\n\n\n end",
"def org\n @org_resource ||= Org.new(@client)\n end",
"def update\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n format.html { redirect_to admin_organizations_path, notice: \"Organization #{@organization.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n standard_update(OrganizationType, params[:id], organization_type_params)\n end",
"def run\n repo_name = extract_full_repo_name(_get_entity_name)\n\n _set_entity_detail('owner', repo_name.split('/').first)\n _set_entity_detail('repository_name', repo_name.split('/')[1])\n _set_entity_detail('repository_uri', \"https://github.com/#{repo_name}\")\n _set_entity_detail('repository_public', repo_public?(repo_name))\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to organization_path(@organization), notice: 'Организация успешно обновлена.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @organization.update(organization_params)\n respond_with(@organization)\n end",
"def contact_update(args)\n super # placeholder so that I can add some doc\n end",
"def contact_update(args)\n super # placeholder so that I can add some doc\n end",
"def kind\n @kind || :organization\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to edit_admin_organization_path(@organization), notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n flash[:error] = \"#{@organization.errors.full_messages.first}\"\n format.html { redirect_to edit_admin_organization_path(@organization) }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @external_organization = ExternalOrganization.find(params[:id])\n\n respond_to do |format|\n if @external_organization.update_attributes(params[:external_organization])\n format.html { redirect_to @external_organization, notice: 'External organization was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @external_organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def run\n super\n\n # Attach to the corpwatch service & search\n x = Ear::Client::Corpwatch::CorpwatchService.new\n corps = x.search @object.name\n\n corps.each do |corp|\n # Create a new organization object & attach a record\n o = create_object Organization, { \n :name => corp.name, \n }\n o.physical_locations << create_object(PhysicalLocation, {\n :address => corps.first.address, \n :state => corps.first.state,\n :country => corps.first.country }\n )\n end\n \n #@task_run.save_raw_result corps.to_s\n\n # Queue a detailed search\n TaskManager.instance.queue_task_run(\"hoovers_company_detail\",o, {})\nend",
"def organization\n @organization ||= Github::Organization.new(client, @options[:owner])\n end",
"def update\n if @organization.update_attributes(organization_params)\n flash[:notice] = 'Organization updated!'\n # tells certain role (in common_actions) that an org (currently vendor)\n # is updated\n CommonActions.notification_process('Organization', @organization)\n end\n respond_with(@organization)\n end"
] | [
"0.69556916",
"0.69556916",
"0.69556916",
"0.6740694",
"0.6740694",
"0.6740694",
"0.63896847",
"0.63867813",
"0.6342161",
"0.62235695",
"0.612015",
"0.6067204",
"0.6037979",
"0.6037979",
"0.57789713",
"0.5770368",
"0.5762854",
"0.5703052",
"0.56691426",
"0.56605864",
"0.5638992",
"0.56237984",
"0.56237984",
"0.5616847",
"0.55940855",
"0.55916727",
"0.5591451",
"0.5588286",
"0.55757654",
"0.554573",
"0.5545581",
"0.55431473",
"0.5542752",
"0.5535885",
"0.5535205",
"0.5529272",
"0.5520324",
"0.55157125",
"0.55003357",
"0.5500236",
"0.54960084",
"0.5481536",
"0.5479452",
"0.5474775",
"0.5474775",
"0.5474775",
"0.5474775",
"0.547465",
"0.54734665",
"0.546385",
"0.54601616",
"0.545779",
"0.54467523",
"0.5442715",
"0.54405624",
"0.5438426",
"0.54372334",
"0.543539",
"0.5414948",
"0.5410036",
"0.54071045",
"0.54063314",
"0.54056495",
"0.54022396",
"0.54001313",
"0.53934795",
"0.5390435",
"0.5382335",
"0.5382001",
"0.5382001",
"0.5381199",
"0.537989",
"0.53778225",
"0.5374984",
"0.5370088",
"0.5366847",
"0.53600633",
"0.5355728",
"0.533533",
"0.53303766",
"0.531268",
"0.531242",
"0.5308177",
"0.5300968",
"0.5295178",
"0.52888125",
"0.52886283",
"0.5287569",
"0.5284322",
"0.5276274",
"0.5272786",
"0.52724516",
"0.5267606",
"0.5267606",
"0.52652484",
"0.5264961",
"0.52516127",
"0.52493453",
"0.52456707",
"0.52433413"
] | 0.5838612 | 14 |
end dog name setter | def name
@name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name=(dog_name)\n @name = dog_name\n end",
"def name= (name_of_dog)\n # @name = name_of_dog\n @name = name_of_dog\n end",
"def name=(str); dirty!; super; end",
"def name=(value); end",
"def name_setter\n @name\n end",
"def name=(name)\n end",
"def name_setter(new_name)\n @name = new_name\n end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def set_name=(name)\n @name=name\n end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(name)\n\t@name = name\nend",
"def name\n @named_dog\n end",
"def name=(name, breed = \"Mutt\")\n@name = name\n@breed = breed\nend",
"def dog_name\n end",
"def name=(o); end",
"def name=(n)\n @name = n\nend",
"def name= val # Setter - set a value\n @name = val \n end",
"def name=(new_name) \n @name = new_name\n end",
"def name=(n) #rubyist\n @name = n #@name = name\n end",
"def setName=(name)\n @name = name\n end",
"def name= new_name\n @name = new_name\n end",
"def name=(the_baby_name) \r\n @my_name = the_baby_name\r\n end",
"def setter_method\n :\"#{self[:name]}=\"\n end",
"def setter_method\n :\"#{self[:name]}=\"\n end",
"def name=(name) #don't forget it accepts an argument name = format\n @name = name\n end",
"def name=(new_name)\n\t\t@name = new_name\n\tend",
"def update_boat_name=(name)\n @name = name\n puts @name\n end",
"def name=(new_name)\n @name=new_name\n end",
"def name(name)\n @name = name\nend",
"def name\n @this_dog_name\n end",
"def name\n #IMPLEMENTING INSTANCE VARIABLES using @\n @this_dogs_name\n end",
"def name=(val)\n super(val.try(:strip))\n end",
"def name=(name)\n @name = name\n end",
"def name=(name)\n @name = name\n end",
"def name=(name)\n @name = name\n end",
"def name=(name)\n @name = name\n end",
"def name=(value) #attribute writer method for \"@name\"\n if value == \"\"\n raise \"Name can't be blank!\"\n end\n @name = value\n end",
"def name \n @this_dogs_name\n end",
"def set_name=(name)\n @name = name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(aname)\n\t\t@name=aname\n\tend",
"def name\n @this_dogs_name\n end",
"def name\n @this_dogs_name\n end",
"def name\n @this_dogs_name\n end",
"def name\n @this_dogs_name\n end",
"def name # this 'gets' a property\n @this_dogs_name\n end",
"def name=(value)\n super(value&.downcase)\n end",
"def set_name\n self.update(name: \"Large Washer ##{self.id}\") unless self.name\n end",
"def name=(name)\r\n @name = name\r\n end",
"def set_name=(name)\n # '@' represents the member variable\n @name = name\n end",
"def name #use and initlizer to set name as an instance variable\n @name\nend",
"def set_name\n self.update(name: \"Medium Washer ##{self.id}\") unless self.name\n end",
"def name\n @this_dogs_name\n end",
"def breed=(breed_name) \n @breed = breed_name\n end",
"def name=( str )\n self.sql = nil\n @name = str\n end",
"def name_the_boat(name)\n @name = name\n puts @name\n end",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setter\n @setter ||= \"#{name}=\"\n end",
"def name=(new_name) # setter\n if new_name.is_a?(Numeric)\n return puts \"The name cannot be a numeric value.\"\n end\n\n @name = new_name\n end",
"def setter\n @setter ||= :\"#{@name}=\"\n end",
"def name=(name)\n\t\tself.sname = name\n\tend",
"def name=(name)\n # String.empty? does the same as String == \"\"\n raise_missing_attribute_error(\"name\") if name.nil? or name.empty?\n\n name = capitalize(name)\n # set the instance variable @name to be able to access it over person.name\n @name = name\n end",
"def name=(name)\n @name = name\n end",
"def name=(name)\n\t\tself.sname = name\n\tend",
"def name=(name)\n write_attribute(:name, name.try(:strip))\n end",
"def change_name=(name)\n @name = name\n end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def name=(name)\n\t\t@new_name = name\n\tend",
"def name=(str) \n self[:name] = compact_string(str); \n end",
"def name=(str) \n self[:name] = compact_string(str); \n end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def name=(name)\n @name = name\n end",
"def name=(val)\n self[:name] = val\n end",
"def name=(p0) end",
"def name=(p0) end",
"def name=(value)\n @name = value\n end",
"def name=(value)\n @name = value\n end",
"def print_name\n\t\t@dog_name\n\tend",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name\n @this_dogs_name\n end",
"def name=(name)\r\n @name = name.capitalize\r\n end",
"def dog(name)\n return name\nend",
"def dog(name)\n return name\nend",
"def name= (new_name)\n @name = new_name\n end",
"def name=(name)\n\t\tif name == \"\"\n\t\t\traise \"Name can't be blank!\" # Report an error if the name is blank\n\t\tend\n\t\t@name = name # Store the name in an instance variable\n\tend",
"def set_name(name)\n @person[:name] = name\n end",
"def setter\r\n @setter ||= Field.setter(@name)\r\n end",
"def setName(name)\n @name = name\n end"
] | [
"0.814059",
"0.7974424",
"0.73772466",
"0.73696977",
"0.7326985",
"0.7315736",
"0.71199644",
"0.71181464",
"0.71181464",
"0.71181464",
"0.71181464",
"0.71181464",
"0.71181464",
"0.71181464",
"0.71181464",
"0.71181464",
"0.7104481",
"0.7093211",
"0.7081058",
"0.70381874",
"0.7026402",
"0.7012344",
"0.6995515",
"0.6981",
"0.6964616",
"0.69306314",
"0.69165593",
"0.6889972",
"0.68884224",
"0.68787694",
"0.6866711",
"0.6856226",
"0.6831904",
"0.6788455",
"0.67850304",
"0.6761046",
"0.6751931",
"0.6745238",
"0.6740836",
"0.6740836",
"0.6740836",
"0.6740836",
"0.67361516",
"0.67342407",
"0.6728919",
"0.6728832",
"0.6728832",
"0.6727456",
"0.6724629",
"0.6722061",
"0.6722061",
"0.6722061",
"0.6722061",
"0.67071855",
"0.67069376",
"0.6700547",
"0.6694127",
"0.6681288",
"0.66730845",
"0.66705424",
"0.66694623",
"0.6668357",
"0.66641635",
"0.6663785",
"0.6658738",
"0.6658738",
"0.6658738",
"0.6658738",
"0.6658738",
"0.66407377",
"0.6591923",
"0.65866673",
"0.65722346",
"0.6572157",
"0.6571636",
"0.6571158",
"0.6564258",
"0.6563667",
"0.65608674",
"0.6559034",
"0.6553056",
"0.6553056",
"0.65464956",
"0.6544962",
"0.65447545",
"0.65222335",
"0.65222335",
"0.6521943",
"0.6521943",
"0.6493803",
"0.64845973",
"0.64845973",
"0.6477277",
"0.64742446",
"0.6455476",
"0.6455476",
"0.64388835",
"0.64339346",
"0.6433357",
"0.64244246",
"0.6424131"
] | 0.0 | -1 |
end dog name getter | def bark
puts "woof!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n @named_dog\n end",
"def name # this 'gets' a property\n @this_dogs_name\n end",
"def name\n @this_dog_name\n end",
"def name\n @this_dogs_name\n end",
"def name\n @this_dogs_name\n end",
"def name\n @this_dogs_name\n end",
"def name\n @this_dogs_name\n end",
"def name\n @this_dogs_name\n end",
"def dog_name\n end",
"def name \n @this_dogs_name\n end",
"def name\n @this_dogs_name\n end",
"def name\n #IMPLEMENTING INSTANCE VARIABLES using @\n @this_dogs_name\n end",
"def name # getter method (or reader method)\n @name\n end",
"def dog(name)\n return name\nend",
"def dog(name)\n return name\nend",
"def print_name\n\t\t@dog_name\n\tend",
"def dog(dog_name)\n return dog_name\nend",
"def getName; @name; end",
"def name() return @name end",
"def name() return @name end",
"def name\n @this_dogs_name\n end",
"def get_name\n\t\t@name\n\tend",
"def name_reader\n @name\n end",
"def name() end",
"def name\n @this_dogs_name\n #here we defined a instance variable \n #instance variabler means is that the scope of the variable is to the instace itself\n #Instance variables live in, and are visible everywhere in the object’s scope\n end",
"def name \n @name\n end",
"def name \n @name\n end",
"def get_name\n @name\n end",
"def get_name\n @name\n end",
"def get_name\n @name\n end",
"def get_name\n @name\n end",
"def get_name\n\t\treturn @name\n\tend",
"def get_name\n\t\treturn @name\n\tend",
"def get_name\n\t\treturn @name\n\tend",
"def get_name\n return @name\n end",
"def name\n end",
"def name\n end",
"def name\n end",
"def name\n end",
"def name \n @name\n end",
"def name \n @name\n end",
"def name\n @name\nend",
"def name\n\n end",
"def name\n@name\nend",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def get(name); end",
"def name\n \n end",
"def name\n @name \n end",
"def name\n end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end"
] | [
"0.8342136",
"0.82844603",
"0.8168558",
"0.81575644",
"0.81575644",
"0.81575644",
"0.81575644",
"0.81468236",
"0.8138214",
"0.81082535",
"0.7914222",
"0.7863684",
"0.7740348",
"0.7728464",
"0.7728464",
"0.7635208",
"0.75268835",
"0.74387866",
"0.74323446",
"0.74323446",
"0.7424934",
"0.74032384",
"0.73486733",
"0.7330344",
"0.73013693",
"0.72751635",
"0.72751635",
"0.72548",
"0.72548",
"0.72548",
"0.72548",
"0.72516096",
"0.72516096",
"0.72516096",
"0.7214121",
"0.72064507",
"0.72064507",
"0.72064507",
"0.72064507",
"0.720405",
"0.720405",
"0.72032773",
"0.7202502",
"0.7201681",
"0.7191863",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71863335",
"0.71859264",
"0.71859264",
"0.7181497",
"0.71810794",
"0.71759844",
"0.71745604",
"0.71618503",
"0.71618503",
"0.71618503",
"0.71618503",
"0.71618503",
"0.71618503",
"0.71618503",
"0.71618503"
] | 0.0 | -1 |
positive number, return the negative of that number. If the number is 0 or negative, return the original number. | def negative(num)
if num > 0
p (-num)
else
p num
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def negative(number)\n if number > 0\n -number\n else\n return number\n end\nend",
"def negative(number)\n return number if number.negative? || number.zero?\n -number\nend",
"def negative(num)\n if num.positive?\n -num\n else\n num\n end\nend",
"def negative(num)\n return num if num.negative?\n -num\nend",
"def negative(num)\n\treturn -num unless num <= 0\n\tnum\nend",
"def negative(number)\n number > 0 ? -number : number\nend",
"def negative(number)\n number > 0 ? -number : number\nend",
"def negative(num)\n return -num if num > 0\n num\nend",
"def negative(num)\n num > 0 ? -num : num # or -num.abs\nend",
"def negative(num)\n num.positive? ? -num : num\nend",
"def negative(num)\n num <= 0 ? num : -num\nend",
"def negative(num)\n num <= 0 ? num : -num\nend",
"def negative(num)\n num > 0 ? -num : num\nend",
"def negative(num)\n num > 0 ? -num : num\nend",
"def negative(num)\n num > 0 ? -num : num\nend",
"def negative(num)\n num > 0 ? -num : num\nend",
"def negative(number)\n number <= 0 ? number : number * -1\nend",
"def negative(num)\n num < 0 ? num : -num\nend",
"def negative(num)\r\n num > 0 ? -num : num \r\nend",
"def negative(number)\n -(number.abs)\nend",
"def negative(number)\n number > 0 ? (number * -1) : number\nend",
"def negative(num)\n\n if num <=0\n num\n else \n num * -1\n end\nend",
"def negative(number)\n -number.abs\nend",
"def negative(number)\n -number.abs\nend",
"def negative(number)\n -number.abs\nend",
"def negative(number)\n -number.abs\nend",
"def makeNegative(num)\r\n if num >= 0\r\n return num * (-1)\r\n else\r\n return num * 1\r\n end\r\n end",
"def negative(num)\n num < 0 ? num : -1 * num\nend",
"def make_numbers_negative(number)\n number.positive? ? -(number) : number\nend",
"def negative(num)\n - num.abs\nend",
"def negative(num)\n num *= -1 if num > 0\n num\nend",
"def negative(num)\n # your code goes here\n if num < 0\n return num\n elsif num == 0\n return 0\n else\n return -num\n end\nend",
"def makeNegative(num)\n num < 0 ? num : -num\nend",
"def make_negative(num)\r\n num > 0 ? -num : num\r\nend",
"def negative(n)\n return n if n <= 0\n -n\nend",
"def negative(int)\n int <= 0 ? int : -int\nend",
"def negative(integer)\n integer > 0 ? -integer : integer\nend",
"def make_negative(number)\n if number > 0\n number - (-number * -2)\n else\n number\n end\nend",
"def negative(num)\n if num <= 0 \n return num\n else\n return num - (num * 2)\n end\nend",
"def negative2(number)\n -number.abs\nend",
"def make_negative(number)\n if number > 0\n number - (number.abs * 2)\n else \n number\n end\nend",
"def makeNegative(num)\n num > 0 ? num * -1 : num\nend",
"def make_positive(number)\n if number < 0\n -number\n else\n number\n end\nend",
"def make_numbers_negative(number)\n new_number = number if number < 0\n new_number = -number if number > 0\n new_number\nend",
"def make_numbers_negative(number)\n\tif number <= 0\n\t\treturn number\n\telse\n\t\tconvert = number\n\t\tconvert /= -1\n\tend\nend",
"def negative(integer)\n return integer if integer.negative? || integer == 0\n integer * -1\nend",
"def make_numbers_negative(number)\n -number.abs\nend",
"def make_negative(n)\n -(n.abs)\nend",
"def negative\n abs.flip_sign\n end",
"def negative(int)\n if int.negative? || int == 0\n return int\n else\n return int * -1\n end\nend",
"def negative(num)\r\n # your code goes here\r\n # abosulte value of any number is +ve\r\n\r\n num.abs*-1\r\nend",
"def negative(input)\n input.abs * -1\nend",
"def not_zero(number)\n if number == 0\n return \"-\"\n else\n return number\n end\n end",
"def absolute(number)\n if number < 0\n number = number * -1\n end\n return number\nend",
"def absolute(num)\n return -num if is_negative(num)\n return num\nend",
"def nozero(num)\n num > 0 ? -num : num \nend",
"def neg(num)\n val = Convert(num, :numeric)\n sub(Convert(0, val.type), val)\n end",
"def opposite(num)\n if num < 0\n return num.abs\n else num >= 0\n return num * -1 end\nend",
"def absolute(number)\n if number < 0\n return number * -1\n end\n return number\nend",
"def make_numbers_negative(number)\n number *= -1 if \"++-\"[number <=> 0] == \"+\"\n number\n\n # -number.abs\nend",
"def absolute(number)\n if number > 0\n output = number\n else\n output = number * -1\n end\n return output\nend",
"def negative(num)\n return num<0\nend",
"def is_negative(number)\n if number < 0 \n return true\n else return false\n end\nend",
"def is_negative(number)\n if number < 0\n output = true\n else\n output = false\n end\n return output\nend",
"def negative(num)\n # your code goes here\n puts -(num).abs\n# -1 becomes 1 then multiplied by negative sign equals negative number\n# -1 * (-) = 1; 1 * (-) = -1 \nend",
"def makeNegative(num)\n if(num.to_s.start_with?(\"-\"))\n return num\n else\n return -num\nend\nend",
"def abs(x)\n x < 0 ? 0-x : x\n end",
"def is_negative(number)\n output = false\n if number < 0\n output = true\n end\n return output\nend",
"def is_negative(number)\n if number < 0 \n return true\n end\n return false\nend",
"def negative(num)\n is_neg = false\n if num < 0\n is_neg = true\n end\n return is_neg\nend",
"def is_negative(num)\n if num < 0\n return true\n else\n return false\n end\nend",
"def opposite(number)\n return 0 - number\nend",
"def positive(value)\n result = to_integer(value) or return\n result if result.positive?\n end",
"def negative?\n value < 0\n end",
"def absolute(numb)\n if numb < 0\n return numb * -1\n end\n return numb\nend",
"def opposite(number)\r\n return number * (-1)\r\nend",
"def non_negative(value)\n result = to_integer(value) or return\n result unless result.negative?\n end",
"def is_negative(num)\n if num < 0\n return true\n end\n return false \nend",
"def opposite(number)\n number*-1\nend",
"def abs(x)\n if x < 0\n -x\n else\n x\n end\n end",
"def signum x\n return -1 if x < 0\n return 1 if x > 0\n return 0\n end",
"def abs (v) \n if(v < 0)\n -v\n else\n v\n end\nend",
"def sign(v) \n if(v > 0)\n +1\n elsif(v < 0)\n -1\n else\n 0\n end\nend",
"def reverse_sign(an_integer)\n return 0 - an_integer\nend",
"def reverse_sign(an_integer)\n return 0 - an_integer\nend",
"def negative?\n !@positive \n end",
"def is_absolute(number)\n output= false\n if number > 0\n output= number\n else\n output = number * -1\n end\n return output\nend",
"def neg?\n sign < 0\n end",
"def negative?\n self < 0\n end",
"def negative?\n self < 0\n end",
"def is_negative(num)\n return false if num >= 0\n return true if num < 0\nend",
"def opposite num\n -num\n end",
"def negative(value = (not_set = true))\n return @negative if not_set\n\n @negative = value\n end",
"def sign\n return -1 if self < 0\n return 1 if self > 0\n return 0\n end",
"def isnegative(siffra)\n output = false\n if siffra < 0\n output = true\n end\n\n return output\nend",
"def is_negative(tal)\n if tal < 0\n return true\n else\n return false\n end\nend",
"def abs2(x)\n if x < 0\n return -x\n else\n return x\n end\nend",
"def subtract(n1, n2)\n result = n1 - n2\n result = 0 if result < 0\nend",
"def negative?\n @negative\n end",
"def negative?\n @negative\n end"
] | [
"0.8684646",
"0.85498834",
"0.85438204",
"0.8435659",
"0.84351003",
"0.83852386",
"0.83852386",
"0.8368064",
"0.8339414",
"0.8294396",
"0.8290071",
"0.8290071",
"0.82831675",
"0.82831675",
"0.82831675",
"0.82831675",
"0.82612395",
"0.82522976",
"0.82400227",
"0.823075",
"0.82304454",
"0.8186976",
"0.81686527",
"0.81686527",
"0.81686527",
"0.81686527",
"0.81517696",
"0.8117073",
"0.8089643",
"0.80820066",
"0.80630827",
"0.80425185",
"0.80280226",
"0.8012444",
"0.8006029",
"0.79928124",
"0.79598135",
"0.7955491",
"0.79333633",
"0.7921782",
"0.7886992",
"0.78662044",
"0.7860041",
"0.78429776",
"0.784031",
"0.78398806",
"0.782946",
"0.78217196",
"0.776384",
"0.77175796",
"0.76781094",
"0.76618063",
"0.76572025",
"0.7606356",
"0.7589367",
"0.7561295",
"0.7558301",
"0.75454074",
"0.7510588",
"0.7497834",
"0.7416988",
"0.7393915",
"0.73555",
"0.7331032",
"0.72911084",
"0.72508126",
"0.7227674",
"0.7216872",
"0.72106004",
"0.71755266",
"0.7169947",
"0.7166269",
"0.7126461",
"0.7096393",
"0.70940894",
"0.7084043",
"0.7081568",
"0.70605093",
"0.70177585",
"0.70075715",
"0.69924945",
"0.69565713",
"0.6945813",
"0.693723",
"0.693723",
"0.69207865",
"0.69169736",
"0.68923384",
"0.68912035",
"0.6886787",
"0.68789196",
"0.6870969",
"0.6869089",
"0.6840981",
"0.6813762",
"0.6809725",
"0.68025047",
"0.67926913",
"0.6789585",
"0.6789585"
] | 0.7719785 | 49 |
Temporarily merges the migration files by copying them over and then deletes them. Sequel's migration class cannot work with migrations in different directories even if sequelrails can. This is the simplest solution that works until ::Sequel::Migrator supports merging of multiple migration directories. | def temporarily_merge_migration_files(explanation=nil)
copy_files = []
Rails.application.config.paths["db/migrate"].expanded.each do |specified_migration_dir|
if migrations_dir.to_s != specified_migration_dir
Dir[File.join(specified_migration_dir, '*')].each do |file_name|
copy_files.push([file_name, migrations_dir.join(File.basename(file_name)).to_s])
end
end
end
if explanation && copy_files.any?
puts "SequelRails: Detected migration files outside of the main db/migrate directory. Copying them to db/migrate temporarily to #{explanation}:"
copy_files.each { |o, _| puts " - #{o}"}
end
copy_files.each { |original, destination| FileUtils.cp(original, destination) }
yield
ensure
copy_files.each { |_, destination| FileUtils.rm_f(destination) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_migration_files\n migration_templates = Dir.children(File.join(TEMPLATES, 'migrations')).sort\n migration_templates.each do |template_file|\n destination_file = template_file.match(/^\\d*_(.*\\.rb)/)[1] # 01_create_good_jobs.rb.erb => create_good_jobs.rb\n migration_template \"migrations/#{template_file}\", File.join(db_migrate_path, destination_file), skip: true\n end\n end",
"def replace_migration(name, from)\n inside (\"db/migrate\") do\n run \"cat #{from}/#{name}.rb > temp.rb\"\n run \"find *_#{name}.rb | xargs mv temp.rb\"\n end\nend",
"def copy_migration_files\n # Copy migration files except when you pass --no-migrations.\n return if no_migrations?\n\n migration_template \"migration/core.rb\", \"db/migrate/sorcery_core.rb\"\n\n if submodules\n submodules.each do |submodule|\n unless submodule == \"http_basic_auth\" || submodule == \"session_timeout\" || submodule == \"core\"\n migration_template \"migration/#{submodule}.rb\", \"db/migrate/sorcery_#{submodule}.rb\"\n end\n end\n end \n end",
"def add_migrations\n \tmigrations = Dir.glob(SocialFramework::Engine.config.paths[\"db/migrate\"].first + \"/*\")\n\n if options[:migrations]\n options[:migrations].each do |migrate|\n file = \"social_framework_#{migrate.pluralize}.rb\"\n file = migrations.select { |m| m.include?(file) }.first\n unless file.nil? or file.empty?\n file_name = file.split(\"/\").last\n copy_file file, \"db/migrate/#{file_name}\"\n else\n puts \"Could not find migration: '#{migrate}'\"\n end\n end\n else\n migrations.each do |migrate|\n file = migrate.split(\"/\").last \n copy_file migrate, \"db/migrate/#{file}\"\n end\n end\n end",
"def copy_migrations\n [\n \"acts_as_follower_migration.rb\",\n \"add_social_to_users.rb\",\n \"add_ldap_attrs_to_user.rb\",\n \"add_avatars_to_users.rb\",\n \"add_groups_to_users.rb\",\n \"create_local_authorities.rb\",\n \"create_trophies.rb\",\n 'add_linkedin_to_users.rb',\n 'create_tinymce_assets.rb',\n 'create_content_blocks.rb',\n 'create_featured_works.rb',\n 'add_external_key_to_content_blocks.rb'\n ].each do |file|\n better_migration_template file\n end\n end",
"def copy_migrations\n # Can't get this any more DRY, because we need this order.\n %w{acts_as_follower_migration.rb\tadd_social_to_users.rb\t\tcreate_single_use_links.rb\tadd_ldap_attrs_to_user.rb\nadd_avatars_to_users.rb\t\tcreate_checksum_audit_logs.rb\tcreate_version_committers.rb\nadd_groups_to_users.rb\t\tcreate_local_authorities.rb\tcreate_trophies.rb}.each do |f|\n better_migration_template f\n end\n end",
"def fix_skel_migrations(skel_dir = File.dirname(__FILE__) + '/../skel')\n # expect, remove and modify need to be fixed, add doesn't\n for verb in %w(expect remove modify)\n skel_targets(skel_dir, verb, '/db/migrate') do |src_file, target_file|\n pattern = target_file.sub(/\\d{14}/, '*')\n matches = Dir.glob(pattern)\n raise FileNotFound, pattern if matches.empty?\n raise AmbiguousMigration, matches.inspect if matches.size > 1\n File.rename(matches.first, target_file)\n end\n end\n end",
"def copy_migrations\n # Can't get this any more DRY, because we need this order.\n better_migration_template \"create_searches.rb\"\n better_migration_template \"create_bookmarks.rb\"\n better_migration_template \"remove_editable_fields_from_bookmarks.rb\"\n better_migration_template \"add_user_types_to_bookmarks_searches.rb\"\n end",
"def copy_migrations\n [\n 'create_file_view_stats.rb',\n 'create_file_download_stats.rb'\n ].each do |file|\n better_migration_template file\n end\n end",
"def copy_migration_files \n Dir.glob(File.join(DoogleGenerator.source_root, 'db/migrate/*')).each do |source|\n destination = File.join(Rails.root, 'db/migrate', File.basename(source))\n puts \" \\e[1m\\e[34mcopying\\e[0m #{source} to #{destination}\"\n copy_file source, destination\n end\n end",
"def copy_migrations\n [\n 'change_audit_log_pid_to_generic_file_id.rb',\n 'change_proxy_deposit_request_pid_to_generic_file_id.rb'\n ].each do |file|\n better_migration_template file\n end\n end",
"def copy_templates\n migrations_to_be_applied do |m|\n migration_template \"#{m}.rb\", \"db/migrate/#{m}.rb\"\n end\n end",
"def remove_moved_files\n scan_for_merges.each do |file|\n if File.amp_lexist?(@repo.working_join(file))\n UI.debug(\"removing #{file}\")\n File.unlink(@repo.working_join(file))\n end\n end\n end",
"def schema_migrations_cleanup\n # Read all schema_migrations values from the dump.\n values = dump.scan(/^(\\(\\'\\d{14}\\'\\))[,;]\\n/).flatten.sort\n\n # Replace the schema_migrations values.\n dump.sub!(\n /(?<=INSERT INTO \"schema_migrations\" \\(version\\) VALUES).+;\\n*/m,\n \"\\n #{values.join(\"\\n,\")}\\n;\\n\\n\"\n )\n end",
"def schema_migrations_cleanup\n # Read all schema_migrations values from the dump.\n values = dump.scan(/^(\\(\\'\\d{14}\\'\\))[,;]\\n/).flatten.sort\n\n # Replace the schema_migrations values.\n dump.sub!(\n /(?<=INSERT INTO \"schema_migrations\" \\(version\\) VALUES).+;\\n*/m,\n \"\\n #{values.join(\"\\n,\")}\\n;\\n\\n\"\n )\n end",
"def copy_files\n return if options[\"skip-migration\"]\n migration_template \"migration.rb\", \"db/migrate/create_friendly_id_slugs.rb\"\n end",
"def copy_files\n return if options[\"skip-migration\"]\n\n migration_template \"migration.rb\", \"db/migrate/create_abraham_histories.rb\"\n end",
"def rollback(step = 1)\n files = File.migrated.reverse.first(step)\n Migrate::Down.new(files).perform\n end",
"def copy_migrations\n \n # get an array of the migrations in your engine's db/migrate/ \n # folder:\n \n migrations = Dir[Bulky::Engine.root.join(\"db/migrate/*.rb\")]\n migrations.each_with_index do |migration, i|\n \n # The migrations will be created with the same timestamp if you \n # create them all at once. So if you have more than one migration \n # in your engine, add one second to the second migration's file\n # timestamp and a third second to the third migration's timestamp \n # and so on:\n \n seconds = (DateTime.now.strftime(\"%S\").to_i + i).to_s\n seconds = seconds.to_s.length == 2 ? seconds : \"0#{seconds}\"\n timestamp = (DateTime.now.strftime \"%Y%m%d%H%M\") + seconds\n \n # get the filename from the engine migration minus the timestamp:\n name = migration.split(\"/\").last.split(\"_\")[1..-1].join(\"_\")\n # puts name\n \n # See if a the name of your engine migration is already in your\n # host app's db/migrate folder:\n \n if Rails.root.join(\"db/migrate/*#{name}\").exist?\n \n # do nothing:\n puts \"Migration #{name} has already been copied to your app\"\n else\n \n # copy your engine migration over to the host app with a new \n # timestamp:\n copy_file migration, \"db/migrate/#{timestamp}_#{name}\"\n end\n end\n end",
"def change_migration_content\n Dir.glob(\"#{plugin_path}/db/migrate/*.rb\").each do |f|\n content = \"\"\n file = File.open(f,\"r\")\n file.each do |line|\n content += \"#{line} \" \n end\n mig_array = [\"To\", \"From\", \"Create\" ,\"Remove\"]\n model_name = \"\"\n mig_array.each do |m_a|\n reg_exp = %r{#{m_a}(.+)\\s+<}\n model_name = reg_exp.match(content)[1] unless reg_exp.match(content).nil?\n if !model_name.blank?\n break\n end\n end\n migrate_connection =\"\"\n if !model_name.blank?\n migrate_connection = \"def self.connection\n #{model_name.singularize}.connection\n end\"\n end\n if !model_name.blank?\n content.sub!(/ActiveRecord::Migration\\s{1}/,\"ActiveRecord::Migration\\n #{migrate_connection} \\n\")\n end\n file = File.open(f,\"w\")\n file.write(content)\n file.close\n end\n \n end",
"def migrate!\n @logger.fine('Dropping schema...')\n\n migrate(0) # migrate to version 0.\n migrate # migrate to latest version.\n end",
"def generate_migration options = {}\n options.to_options!\n chroot do\n before = Dir.glob \"./db/migrate/*\"\n n = Dir.glob(\"./db/migrate/*_bj_*\").size\n classname = \"BjMigration#{ n }\"\n util.spawn \"#{ Bj.ruby } ./script/generate migration #{ classname }\", options rescue nil\n after = Dir.glob \"./db/migrate/*\"\n candidates = after - before\n case candidates.size\n when 0\n false\n when 1\n generated = candidates.first\n open(generated, \"w\"){|fd| fd.puts Bj.table.migration_code(classname)}\n Bj.logger.info{ \"generated <#{ generated }>\" }\n generated\n else\n raise \"ambiguous migration <#{ candidates.inspect }>\"\n end\n end\n end",
"def revert_database_config\n database_temp = @database + '.tmp'\n return unless File.exist?(database_temp)\n\n File.delete(@database) if File.exist?(@database)\n File.rename(database_temp, @database)\n end",
"def migrate(task, *step_files)\r\n step_files = begin\r\n Dir[File.join(File.dirname(__FILE__),\"../../migrate/*.rb\")]\r\n end if step_files.empty?\r\n establish! do\r\n step_files.each do |step_file|\r\n require step_file\r\n File.basename(step_file) =~ /(.*)\\.rb$/\r\n migration = $1.camelize.constantize\r\n step = migration.new\r\n case task.to_s\r\n when \"up\"\r\n step.up unless step.migrated?\r\n when \"reset\"\r\n step.reset if step.migrated?\r\n when \"down\"\r\n step.down if step.migrated?\r\n when \"backup\"\r\n step.backup(options) if step.migrated?\r\n else\r\n raise \"Unsupported sub command: #{task}\"\r\n end\r\n end\r\n end\r\n end",
"def create_migration_files\n source_dir = 'db/migrate/country_domain'\n destination_dir = 'db/migrate'\n\n migration_template(\n \"#{source_dir}/0001_create_countries.rb\",\n \"#{destination_dir}/create_countries.rb\"\n )\n\n migration_template(\n \"#{source_dir}/0002_create_administrative_level_types.rb\",\n \"#{destination_dir}/create_administrative_level_types.rb\"\n )\n\n migration_template(\n \"#{source_dir}/0003_create_administrative_divisions.rb\",\n \"#{destination_dir}/create_administrative_divisions.rb\"\n )\n\n migration_template(\n \"#{source_dir}/0004_create_postal_codes.rb\",\n \"#{destination_dir}/create_postal_codes.rb\"\n )\n\n migration_template(\n \"#{source_dir}/0005_create_administrative_street_names.rb\",\n \"#{destination_dir}/create_administrative_street_names.rb\"\n )\n\n migration_template(\n \"#{source_dir}/0006_create_administrative_street_numbers.rb\",\n \"#{destination_dir}/create_administrative_street_numbers.rb\"\n )\n end",
"def apply_diff_files_on_db(filenames, db_host, db_user, db_pwd, db_dest, dest_verbose_name, diff_dest_path)\n unless filenames.empty?\n puts \"\\r\\n\\r\\n\\t** #{dest_verbose_name} diffs: **\"\n filenames.each do |filename|\n if db_dest.instance_of?(Array) # Multi DB apply:\n db_dest.each do |config_name|\n db_name = Rails.configuration.database_configuration[config_name]['database']\n puts \"\\r\\nExecuting '#{filename}' on #{config_name} DB (#{db_name})...\"\n sh \"mysql --host=#{db_host} --user=#{db_user} --password=\\\"#{db_pwd}\\\" --database=#{db_name} --execute=\\\"\\\\. #{filename}\\\"\" do |ok, res|\n unless ok\n puts \"Error intercepted: exit status = #{res.exitstatus}\"\n exit\n end\n end\n end\n # Single DB apply:\n else\n db_name = Rails.configuration.database_configuration[db_dest]['database']\n puts \"\\r\\nExecuting '#{filename}' on #{db_dest} DB (#{db_name})...\"\n sh \"mysql --host=#{db_host} --user=#{db_user} --password=\\\"#{db_pwd}\\\" --database=#{db_name} --execute=\\\"\\\\. #{filename}\\\"\" do |ok, res|\n unless ok\n puts \"Error intercepted: exit status = #{res.exitstatus}\"\n exit\n end\n end\n end\n puts \"\\r\\nMoving '#{filename}' to '#{diff_dest_path}'.\"\n FileUtils.mv(filename, diff_dest_path)\n end\n end\n end",
"def find_migration_tuples # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity\n up_mts = []\n down_mts = []\n files.each do |path|\n f = File.basename(path)\n fi = f.downcase\n if target\n if migration_version_from_file(f) > target\n down_mts << [load_migration_file(path), f, :down] if applied_migrations.include?(fi)\n elsif !applied_migrations.include?(fi)\n up_mts << [load_migration_file(path), f, :up]\n end\n elsif !applied_migrations.include?(fi)\n up_mts << [load_migration_file(path), f, :up]\n end\n end\n up_mts + down_mts.reverse\n end",
"def migrate(version = nil)\n pending = ->(_) { File.pending.map(&:version).include?(_) }\n migrated = ->(_) { File.migrated.map(&:version).include?(_) }\n\n case version\n when nil\n files = File.pending\n Migrate::Up.new(files).perform\n\n when pending\n files = File.pending.select { |f| f.version <= version }\n Migrate::Up.new(files).perform\n\n when migrated\n files = File.migrated.select { |f| f.version > version }.reverse\n Migrate::Down.new(files).perform\n\n else\n out.puts(\"Invalid Version: #{version} does not exist.\")\n end\n end",
"def generate_migrations\n Dir[File.join(source_paths, 'db', 'migrate', '*.rb')].each do |file|\n migration_filepath = file.match(/\\A.+\\/(db\\/migrate\\/.+)\\Z/i)[1]\n raw_migration_filename = file.match(/\\d+\\_(.+)\\Z/i)[1] \n migration_template migration_filepath, \"db/migrate/#{raw_migration_filename}\" \n end\n end",
"def migrations\n @migrations ||= begin\n paths = Dir[\"#{migrations_path}/*.rb\"]\n migrations = paths.map { |path| MigrationProxy.new(path) }\n migrations.sort\n end\n end",
"def copy_migrations\n rake 'hyrax:install:migrations'\n end",
"def tidy_up\n Dir[\"*nin\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nhr\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nsq\"].each do |file|\n File.delete(file)\n end\n Dir[\"*blast\"].each do |file|\n File.delete(file)\n end\n end",
"def copy_files\n return if options['skip-migration']\n migration_template 'create_stripe_order_fields.rb', \"db/migrate/create_stripe_order_fields_for_#{table_name}.rb\"\n migration_template 'create_stripe_customer_fields.rb', \"db/migrate/create_stripe_customer_fields_for_#{user_table_name.downcase.pluralize}.rb\"\n end",
"def install_migrations\n puts \"Copying over Cadenero migrations...\"\n Dir.chdir(Rails.root) do\n `rake cadenero:install:migrations`\n end\n end",
"def apply(db, direction, filename)\n raise(ArgumentError, \"Invalid migration direction specified (#{direction.inspect})\") unless %i[up down].include?(direction)\n\n @script = ['BEGIN;']\n prok = public_send(direction)\n return unless prok\n\n instance_exec(&prok)\n @script << if direction == :up\n \"INSERT INTO menu_migrations (filename) VALUES('#{filename}');\"\n else\n \"DELETE FROM menu_migrations WHERE filename = '#{filename}';\"\n end\n @script << 'COMMIT;'\n\n puts \"- #{direction == :up ? 'Applying' : 'Reversing'}: #{filename}\" unless ENV['TEST_RUN']\n if @dry_run\n puts @script.join(\"\\n\") unless ENV['TEST_RUN']\n @script\n else\n db.execute(@script.join(\"\\n\"))\n end\n end",
"def run\n load_migrations\n @migrations.each do |mig_class, version|\n mig_class.up\n # Add it to the schema_migrations table as well\n # This will fail if auto-migrations is only and always used,\n # as the schema_migrations table will not exist.\n SchemaMigration.find_or_create_by_version(version) rescue nil\n end\n end",
"def reset_migrations!\n @migrations = nil\n @migrate_to = nil\n Neo4j::Transaction.run do\n Neo4j.ref_node[:_db_version] = nil\n end\n end",
"def rollback_to_core_data\n File.open(@database_config_path, \"w\") do |file|\n file.puts @original_database_config\n end\n# puts \"Cucumber finished, Resetting test database\"\n# run \"mysql -u #{@@test_database_username} --password=#{@@test_database_password} #{@@test_database_name} < #{@path_to_core_data}\"\nend",
"def run_local_migrations()\n setup_local_environment\n # Runs migrations against the local database.\n common = Common.new\n Dir.chdir('db') do\n common.run_inline %W{./run-migrations.sh main}\n end\n Dir.chdir('db-cdr/generate-cdr') do\n common.run_inline %W{./init-new-cdr-db.sh --cdr-db-name cdr}\n end\n common.run_inline %W{gradle :loadConfig -Pconfig_key=main -Pconfig_file=config/config_local.json}\n common.run_inline %W{gradle :loadConfig -Pconfig_key=cdrBigQuerySchema -Pconfig_file=config/cdm/cdm_5_2.json}\n common.run_inline %W{gradle :loadConfig -Pconfig_key=featuredWorkspaces -Pconfig_file=config/featured_workspaces_local.json}\n common.run_inline %W{gradle :updateCdrConfig -PappArgs=['config/cdr_config_local.json',false]}\nend",
"def copy_seed_files\n copy_file '../../../../db/seeds.rb', 'db/seeds.rb'\n directory '../../../../db/seeds', 'db/seeds'\n end",
"def migrate\n count = 0\n client.token = kv.read(root_key_prefix, shard: 'root') if client.token.nil?\n with_lock do\n Dir[\"#{path}/*.rb\"].each do |file|\n version, class_name = parse_migration(file)\n next if latest >= version\n puts \"Starting migration #{file}\"\n count += 1\n require file\n klass = Object.const_get(\"::#{class_name}\")\n klass.new(client, fig, kv).migrate\n\n # All of the client methods will properly raise exceptions, which will\n # halt this loop. We don't want to swallow that backtrace so we'll just\n # let the error pass along\n update_version(version)\n end\n end\n if count.positive?\n puts \"Ran #{count} migration#{'s' unless count == 1 }.\"\n else\n puts \"No migrations to run. Up to date\"\n end\n end",
"def assume_migrated_upto_version(version, migrations_paths)\n migrations_paths = Array(migrations_paths)\n version = version.to_i\n\n migrated = ActiveRecord::SchemaMigration.all_versions.map(&:to_i)\n versions = migration_context.migration_files.map do |file|\n migration_context.parse_migration_filename(file).first.to_i\n end\n\n unless migrated.include?(version)\n execute insert_versions_sql(version)\n end\n\n inserting = (versions - migrated).select { |v| v < version }\n if inserting.any?\n if (duplicate = inserting.detect { |v| inserting.count(v) > 1 })\n raise \"Duplicate migration #{duplicate}. Please renumber your migrations to resolve the conflict.\"\n end\n if supports_multi_insert?\n execute insert_versions_sql(inserting)\n else\n inserting.each do |v|\n execute insert_versions_sql(v)\n end\n end\n end\n end",
"def create_migration_file\n sleep 1\n migration_template 'migration.rb', 'db/migrate/create_social_accounts.rb'\n copy_file \"social_account.rb\", \"app/models/social_account.rb\"\n copy_file \"omniauth.rb\", \"config/initializers/omniauth.rb\"\n copy_file \"sessions_controller.rb\", \"app/controllers/sessions_controller.rb\"\n copy_file \"_social_login.html.erb\", \"app/views/sessions/_social_login.html.erb\"\n copy_file \"twitter_64.png\", \"app/assets/images/twitter_64.png\"\n copy_file \"facebook_64.png\", \"app/assets/images/facebook_64.png\"\n copy_file \"linkedin_64.png\", \"app/assets/images/linkedin_64.png\"\n copy_file \"twitter.yml\", \"config/twitter.yml\"\n copy_file \"facebook.yml\", \"config/facebook.yml\"\n copy_file \"linkedin.yml\", \"config/linkedin.yml\"\n end",
"def run_migration\n return unless allow_migrations && db_migration_schema != DefaultMigrationSchema\n\n puts \"Running migration from #{db_migration_dirname}\"\n Rails.logger.warn \"Running migration from #{db_migration_dirname}\"\n\n Timeout.timeout(60) do\n # Outside the current transaction\n Thread.new do\n ActiveRecord::Base.connection_pool.with_connection do\n self.class.migration_context(db_migration_dirname).migrate\n # Don't dump until a build, otherwise differences in individual development environments\n # force unnecessary and confusing commits\n # pid = spawn('bin/rake db:structure:dump')\n # Process.detach pid\n end\n end.join\n end\n\n self.class.tables_and_views_reset!\n\n true\n rescue StandardError => e\n FileUtils.mkdir_p db_migration_failed_dirname\n FileUtils.mv @do_migration, db_migration_failed_dirname\n raise FphsException, \"Failed migration for path '#{db_migration_dirname}': #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n rescue FphsException => e\n FileUtils.mkdir_p db_migration_failed_dirname\n FileUtils.mv @do_migration, db_migration_failed_dirname\n raise FphsException, \"Failed migration for path '#{db_migration_dirname}': #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end",
"def migration_template(source, destination=nil, config={})\n destination = File.expand_path(destination || source, self.destination_root)\n\n migration_dir = File.dirname(destination)\n @migration_number = self.class.next_migration_number(migration_dir)\n @migration_file_name = File.basename(destination).sub(/\\.rb$/, '')\n @migration_class_name = @migration_file_name.camelize\n\n destination = self.class.migration_exists?(migration_dir, @migration_file_name)\n\n if !(destination && options[:skip]) && behavior == :invoke\n if destination && options.force?\n remove_file(destination)\n elsif destination\n raise Error, \"Another migration is already named #{@migration_file_name}: #{destination}. Use --force to remove the old migration file and replace it.\"\n end\n destination = File.join(migration_dir, \"#{@migration_number}_#{@migration_file_name}.rb\")\n end\n\n template(source, destination, config)\n end",
"def reset_migrations!\n @migrations = nil\n @migrate_to = nil\n Neo4j::Transaction.run do\n migration_meta_node[:_db_version] = nil\n end\n end",
"def migrate\n assets = \"#{@migration_root}/#{@migration_dir}\"\n policies_dir = \"#{@migration_root}/policies\"\n statics_dir = \"#{policies_dir}/static\"\n\n if !Dir.exists?(@migration_root)\n Dir.mkdir(@migration_root)\n end\n if !Dir.exists?(assets)\n Dir.mkdir(assets)\n end\n if !Dir.exists?(policies_dir)\n Dir.mkdir(policies_dir)\n end\n if !Dir.exists?(statics_dir)\n Dir.mkdir(statics_dir)\n end\n\n # generate the configuration objects. This MUST be done separate from\n # writing to file, because the unifier will change the configuration objects\n # as it finds ways to unify configured attributes.\n policy_unifier = PolicyUnifier.new(statics_dir)\n configs = aws_resources.map do |resource|\n puts \"Processing #{@type} #{resource.name}...\"\n config = empty_config\n config.name = resource.name\n\n config.attached_policies = resource.attached_policies.map { |p| p.arn }\n\n resource.policies.each do |policy|\n statements = JSON.parse(URI.decode(policy.policy_document))[\"Statement\"]\n statements.each { |statement| statement.delete(\"Sid\") }\n policy_unifier.unify(config, statements, policy.name)\n end\n\n [config, resource]\n end\n\n migrate_additional(configs)\n configs = configs.map { |config, resource| config }\n\n # write the configuration to file\n puts \"Writing configuration to file...\"\n configs.each do |config|\n File.open(\"#{assets}/#{config.name}.json\", 'w') { |f| f.write(config.json) }\n end\n\n puts \"Done.\"\n end",
"def run_migrations(migrations)\n migrations.each do |direction, version_or_filenames|\n Array.wrap(version_or_filenames).each do |version_or_filename|\n /^(?<version>\\d{3,})/ =~ File.basename(version_or_filename)\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_path, version.to_i)\n end if version_or_filenames\n end\n if ActiveRecord::Base.schema_format == :ruby\n File.open(ENV['SCHEMA'] || \"#{Rails.root}/db/schema.rb\", 'w') do |file|\n ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)\n end\n end\n #TODO unload migraion classes\n end",
"def rollback_to_seed_data\n File.open(@database_config_path, \"w\") do |file|\n file.puts @original_database_config\n end\nend",
"def copy_migrations\n rake \"sipity:install:migrations\"\n end",
"def migrate_database\n RFlow.logger.debug 'Applying default migrations to config database'\n migrations_path = File.join(File.dirname(__FILE__), 'configuration', 'migrations')\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate migrations_path\n end",
"def load_migration_file(file) # rubocop:disable Metrics/AbcSize\n MUTEX.synchronize do\n n = Migrator.migrations.length\n load(file)\n raise Error, \"Migration file #{file.inspect} not containing a single migration detected\" unless n + 1 == Migrator.migrations.length\n\n c = Migrator.migrations.pop\n\n Object.send(:remove_const, c.name) if c.is_a?(Class) && !c.name.to_s.empty? && Object.const_defined?(c.name)\n c\n end\n end",
"def migrate( target_version = nil )\n base = File.join( LIB_DIR, '..', '..', 'db' )\n\n profiles = Hooker.apply( [ :iudex, :migration_profiles ], [] )\n\n ext = profiles.compact.map { |p| \"/#{p}\" }.join(',')\n base += \"{#{ext},}\" unless ext.empty?\n ActiveRecord::Migrator.migrate( base, target_version )\n end",
"def remove_superfluous_destination_files\n # join mirror_file and dest_file and delete everything from dest_file which isn't in mirror_file\n # because mirror_file should represent the current state of the source mogile files\n Log.instance.info('Joining destination and mirror tables to determine files that have been deleted from source repo.')\n DestFile.where('mirror_file.dkey IS NULL').joins('LEFT OUTER JOIN mirror_file ON mirror_file.dkey = file.dkey').find_in_batches(batch_size: 1000) do |batch|\n batch.each do |file|\n # Quit if program exit has been requested.\n break if SignalHandler.instance.should_quit\n\n # Delete all files from our destination domain which no longer exist in the source domain.\n begin\n Log.instance.debug(\"key [ #{file.dkey} ] should not exist. Deleting.\")\n @dest_mogile.delete(file.dkey)\n @removed += 1\n @freed_bytes += file.length\n rescue => e\n @failed += 1\n Log.instance.error(\"Error deleting [ #{file.dkey} ]: #{e.message}\\n#{e.backtrace}\")\n end\n end\n\n # Print a summary to the user.\n summarize\n\n # Quit if program exit has been requested.\n return true if SignalHandler.instance.should_quit\n end\n end",
"def migrate\n run_migrations pending_migrations, :up\n end",
"def mirror(incremental = false)\n # First, make sure the source file classes exist in the destination mogile\n mirror_class_entries\n\n begin\n # Clear out data from previous runs unless we are doing a full mirror\n ActiveRecord::Base.connection.execute(\"TRUNCATE TABLE #{MirrorFile.table_name}\") unless incremental\n\n # Scan all files greater than max_fid in the source mogile database and copy over any\n # which are missing from the dest mogile database.\n mirror_missing_destination_files unless SignalHandler.instance.should_quit\n\n # This is only run when incremental is not set because it requires the mirror_files db to express\n # exactly the same state as the remote mogile db. Otherwise this would effectively do nothing.\n remove_superfluous_destination_files unless SignalHandler.instance.should_quit\n\n ensure\n # Print the overall summary\n final_summary\n end\n end",
"def migrate(path, version = nil)\n # Establish a connection for migration.\n ActiveRecord::Base.establish_connection(@connection_config)\n ActiveRecord::Migration.verbose = false\n # Namespace definition for the current database.\n # This will ensure that each database is migrated independently.\n ActiveRecord::Base.table_name_prefix = base_model.table_name_prefix\n ActiveRecord::Migrator.migrate(path, version)\n # Clean-up once done.\n ActiveRecord.send(:remove_const, :SchemaMigration)\n load 'active_record/schema_migration.rb'\n ActiveRecord::Base.table_name_prefix = ''\n ActiveRecord::Base.connection.close\n end",
"def apply\n migration.up\n end",
"def migrate_database(app_name, instance_name)\n Dir.chdir RailsPwnerer::Config[app_name, instance_name][:app_path] do\n # now migrate the database\n if File.exist?('Gemfile')\n Kernel.system 'bundle exec rake db:migrate RAILS_ENV=production'\n else\n Kernel.system 'rake db:migrate RAILS_ENV=production'\n end\n end\n end",
"def zip_app_export_migrations\n temp_file = Tempfile.new([ZipTempFilePrefix, '.zip'])\n # This is the tricky part\n # Initialize the temp file as a zip file\n Zip::OutputStream.open(temp_file) { |zos| }\n\n # Add files to the zip file as usual\n Zip::File.open(temp_file.path, Zip::File::CREATE) do |zip|\n Dir.glob(\"#{app_export_dir}/*.rb\").each do |path|\n filename = path.split('/').last\n zip.add(filename, path)\n end\n end\n temp_file\n end",
"def migrate_ar_to_sequel( opts )\n\n columns = ( db.table_exists?( :schema_migrations ) &&\n db.schema( :schema_migrations ).map { |sr| sr[0] } )\n\n if columns == [ :version ] # Old format AR schema_migrations\n db.transaction do\n versions = db.from( :schema_migrations ).\n map { |r| r[ :version ].to_i }\n\n if ( versions & AR_REQUIRED ) != AR_REQUIRED\n missing = AR_REQUIRED - ( versions & AR_REQUIRED )\n raise( ARNotComplete,\n \"Missing AR migrations #{missing.inspect}; \" +\n \"Use 'iudex-migrate _1.2.1_' first\" )\n end\n\n migrations_map = AR_TO_SEQUEL_MIGRATIONS.\n merge( opts[ :ar_to_sequel_migrations ] || {} )\n\n db.drop_table( :schema_migrations )\n db.create_table( :schema_migrations ) do\n String :filename, :null => false\n primary_key [ :filename ]\n end\n\n sm = db[:schema_migrations]\n sm.insert( :filename => '20111012173757_base.rb' )\n\n migrations_map.each do | version, filename |\n sm.insert( :filename => filename ) if versions.include?( version )\n end\n end\n end\n end",
"def migration_dir\n return Roomer.shared_migrations_directory if shared?\n return Roomer.tenanted_migrations_directory\n end",
"def run_migrations(migrations)\n migrations.each do |direction, version_or_filenames|\n Array.wrap(version_or_filenames).each do |version_or_filename|\n version = File.basename(version_or_filename)[/\\d{3,}/]\n\n if defined? ActiveRecord::MigrationContext # >= 5.2\n ActiveRecord::Base.connection.migration_context.run(direction, version.to_i)\n else\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_paths, version.to_i)\n end\n end if version_or_filenames\n end\n if ActiveRecord::Base.schema_format == :ruby\n File.open(ENV['SCHEMA'] || \"#{Rails.root}/db/schema.rb\", 'w') do |file|\n ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)\n end\n end\n #TODO unload migraion classes\n end",
"def postSync(options = {})\n deleteLocalDataDir(options)\n end",
"def migrate(branch)\n zombie_check\n b = @repo.branch(self.class.branch_name(@name, branch: branch))\n base = @repo.merge_base(['HEAD', b])\n diff = @repo.diff(base, @repo.current_branch)\n files = diff.stats[:files].keys() \\\n .delete_if{ |f| File.split(f).any?{ |ff| ff != \".\" && ff.start_with?('.') } } \\\n .keep_if{ |f| contains?(f, branch: branch) }\n files.each do |file|\n puts \" Patching file #{file}\"\n on_worktree(branch) do |repo|\n repo.apply_diff(diff[file])\n repo.add(file)\n end\n end\n end",
"def migrate(version = nil)\n @logger.fine('Running test migrations...')\n super(File.join(Automation::FRAMEWORK_ROOT, Automation::FET_DIR, 'test/database/migrations'), version)\n end",
"def migrate(options = {})\n settings = options.select { |key| [:path, :logger].include? key }\n target = options.select { |key| key.equal? :version }\n\n Migrations::Migrator.new(session, settings).apply(target)\n end",
"def migrate\n # Create the directories\n vpc_dir = \"#{@migration_root}/vpc\"\n policies_dir = \"#{vpc_dir}/policies\"\n route_tables_dir = \"#{vpc_dir}/route-tables\"\n network_acls_dir = \"#{vpc_dir}/network-acls\"\n subnets_dir = \"#{vpc_dir}/subnets\"\n vpcs_dir = \"#{vpc_dir}/vpcs\"\n\n if !Dir.exists?(@migration_root)\n Dir.mkdir(@migration_root)\n end\n if !Dir.exists?(vpc_dir)\n Dir.mkdir(vpc_dir)\n end\n if !Dir.exists?(policies_dir)\n Dir.mkdir(policies_dir)\n end\n if !Dir.exists?(route_tables_dir)\n Dir.mkdir(route_tables_dir)\n end\n if !Dir.exists?(network_acls_dir)\n Dir.mkdir(network_acls_dir)\n end\n if !Dir.exists?(subnets_dir)\n Dir.mkdir(subnets_dir)\n end\n if !Dir.exists?(vpcs_dir)\n Dir.mkdir(vpcs_dir)\n end\n\n # Migrate the different assets\n migrate_policies(policies_dir)\n route_table_names = migrate_route_tables(route_tables_dir)\n network_acl_names = migrate_network_acls(network_acls_dir)\n subnet_names = migrate_subnets(subnets_dir, route_table_names, network_acl_names)\n migrate_vpcs(vpcs_dir, route_table_names, subnet_names, network_acl_names)\n end",
"def remove_database\n FileUtils.rm_rf(path) if File.exist? File.join(path, \"iamflint\")\n @database = nil\n @writable_database = nil\n end",
"def pull\n check_dependencies('mysqldump', 'mysql', '/bin/sh')\n target = parse_db_location(args.shift || 'development')\n\n display \"This will erase all data in the #{target['database'].inspect} database\" +\n (target['host'].empty? ? '' : \" on #{target['host']}\") + \"!\"\n exit unless dangerous_prompt\n\n copy_db_to_db(database_uri, target)\n end",
"def migrate\n migrations_path = File.join(File.dirname(__FILE__), \"#{backend_name}/migrations\")\n Sequel.extension :migration\n unless Sequel::Migrator.is_current?(@db, migrations_path)\n store = self; log = @log; @db.instance_eval { @log = log; @store = store }\n Sequel::Migrator.run(@db, migrations_path)\n unless (v = @db[:schema_info].first) && v[:magic] && v[:backend]\n @db[:schema_info].update(\n magic: Bitcoin.network[:magic_head].hth, backend: backend_name)\n end\n end\n end",
"def migrate\n migrations_path = File.join(File.dirname(__FILE__), \"#{backend_name}/migrations\")\n Sequel.extension :migration\n unless Sequel::Migrator.is_current?(@db, migrations_path)\n store = self; log = @log; @db.instance_eval { @log = log; @store = store }\n Sequel::Migrator.run(@db, migrations_path)\n unless (v = @db[:schema_info].first) && v[:magic] && v[:backend]\n @db[:schema_info].update(\n magic: Bitcoin.network[:magic_head].hth, backend: backend_name)\n end\n end\n end",
"def generate_files\n migration_template 'migration.rb', \"db/migrate/#{name}.rb\"\n end",
"def migrate\n ActiveRecord::Migrator.migrate(File.join(db_dir, \"migrate\"))\n end",
"def do_migrations\n migration_path = File.join(\"generators\", \"talia\", \"templates\", \"migrations\")\n ActiveRecord::Migrator.migrate(migration_path, ENV[\"VERSION\"] ? ENV[\"VERSION\"].to_i : nil )\n end",
"def destroy_removed_migrations\n # @todo Make these methods into a more DRY manner for grabbing each record type and diff'ing them.\n # \n # We create an array for each record type that includes all records that we are going to destroy. We do this by taking the previous records array, converting them to a standard array and keeping them if any previous records occur in the migrated records array.\n versions_to_remove = GuidesGenerator::Migrator::previous_versions.to_a.keep_if do |version|\n !GuidesGenerator::Migrator::migrated_versions.include?(version)\n end\n\n sections_to_remove = GuidesGenerator::Migrator::previous_sections.to_a.keep_if do |sections|\n !GuidesGenerator::Migrator::migrated_sections.include?(sections)\n end\n\n documents_to_remove = GuidesGenerator::Migrator::previous_documents.to_a.keep_if do |document|\n !GuidesGenerator::Migrator::migrated_documents.include?(document)\n end\n\n # After we have all the arrays of records to remove iterate over each array and destroy the records.\n [versions_to_remove, sections_to_remove, documents_to_remove].each {|records| records.each {|record| record.destroy}}\n end",
"def create_migration_file\n #~ migration_template 'users.rb', 'db/migrate/create_users_table.rb',\n\t\t#~ migration_template 'profiles.rb', 'db/migrate/create_contact_details_table.rb',\n\t\t#~ migration_template 'subjects.rb', 'db/migrate/create_profiles_table.rb',\n\t\t#~ migration_template 'attachments.rb', 'db/migrate/create_attachments_table.rb'\n end",
"def migrate!\n connect! unless connected?\n Sequel.extension :migration\n Sequel::Migrator.run(db, File.join(__dir__, \"../../db/migrations\"), table: schema_table)\n end",
"def create_migration_file\n f = File.open File.join(File.dirname(__FILE__), 'templates', 'schema.rb')\n schema = f.read; f.close\n \n schema.gsub!(/ActiveRecord::Schema.*\\n/, '')\n schema.gsub!(/^end\\n*$/, '')\n\n f = File.open File.join(File.dirname(__FILE__), 'templates', 'migration.rb')\n migration = f.read; f.close\n migration.gsub!(/SCHEMA_AUTO_INSERTED_HERE/, schema)\n \n tmp = File.open \"tmp/~migration_ready.rb\", \"w\"\n tmp.write migration\n tmp.close\n\n migration_template '../../../tmp/~migration_ready.rb',\n 'db/migrate/create_framey_tables.rb'\n remove_file 'tmp/~migration_ready.rb'\n end",
"def pre_migrate_database\n old_schema_version = get_schema_version\n new_schema_version = File.read(File.join(source_directory,'db','schema_version')).to_i\n \n return unless old_schema_version > 0\n \n # Are we downgrading?\n if old_schema_version > new_schema_version\n message \"Downgrading schema from #{old_schema_version} to #{new_schema_version}\"\n \n in_directory install_directory do\n unless system(\"rake -s migrate VERSION=#{new_schema_version}\")\n raise InstallFailed, \"Downgrade migrating from #{old_schema_version} to #{new_schema_version} failed.\"\n end\n end\n end\n end",
"def flush_db\n [ 'active_sources', 'data_records', 'semantic_properties', 'semantic_relations', 'workflows'].reverse.each { |f| ActiveRecord::Base.connection.execute \"DELETE FROM #{f}\" }\n # Also remove the \"unsaved cache\" for the wrappers (may be important during testing)\n TaliaCore::SemanticCollectionWrapper.instance_variable_set(:'@unsaved_source_cache', {})\n end",
"def migrate_files_to_external_storage!\n return if stored_externally? || !use_external_diff? || merge_request_diff_files.count == 0\n\n rows = build_merge_request_diff_files(merge_request_diff_files)\n\n transaction do\n MergeRequestDiffFile.where(merge_request_diff_id: id).delete_all\n create_merge_request_diff_files(rows)\n save!\n end\n\n merge_request_diff_files.reset\n end",
"def run(*migration_classes)\n opts = migration_classes.extract_options!\n dir = opts[:direction] || :up\n dir = (dir == :down ? :up : :down) if opts[:revert]\n if reverting?\n # If in revert and going :up, say, we want to execute :down without reverting, so\n revert { run(*migration_classes, direction: dir, revert: true) }\n else\n migration_classes.each do |migration_class|\n migration_class.new.exec_migration(@connection, dir)\n end\n end\n end",
"def generate_migration(tables)\n return if tables.empty? && @db_tables.empty?\n result.clear\n\n add_line \"Sequel.migration do\"\n indent do\n generate_migration_body(tables)\n end\n add_line \"end\\n\"\n\n result.join(\"\\n\")\n end",
"def assume_migrated_upto_version(version, migrations_paths = nil)\n unless migrations_paths.nil?\n ActiveSupport::Deprecation.warn(<<~MSG.squish)\n Passing migrations_paths to #assume_migrated_upto_version is deprecated and will be removed in Rails 6.1.\n MSG\n end\n\n version = version.to_i\n sm_table = quote_table_name(schema_migration.table_name)\n\n migrated = migration_context.get_all_versions\n versions = migration_context.migrations.map(&:version)\n\n unless migrated.include?(version)\n execute insert_versions_sql(version.to_s)\n end\n\n inserting = (versions - migrated).select { |v| v < version }\n if inserting.any?\n if (duplicate = inserting.detect { |v| inserting.count(v) > 1 })\n raise \"Duplicate migration #{duplicate}. Please renumber your migrations to resolve the conflict.\"\n end\n\n execute insert_versions_sql(inserting.map(&:to_s))\n end\n end",
"def migrate_version!\n current_version = @options[:language_version]\n current_version_index = SassSpec::LANGUAGE_VERSIONS.index(current_version)\n if current_version_index == 0\n puts \"Cannot migrate test. There's no version earlier than #{current_version}.\"\n return\n end\n\n start_version_index = SassSpec::LANGUAGE_VERSIONS.index(\n @test_case.metadata.start_version.to_s)\n\n if start_version_index >= current_version_index\n puts \"Cannot migrate test. Test does not apply to an earlier version.\"\n return\n end\n\n previous_version = SassSpec::LANGUAGE_VERSIONS[current_version_index - 1]\n\n new_folder = @test_case.folder + \"-#{current_version}\"\n\n if File.exist?(new_folder)\n choice = interact(:migrate_over_existing, :abort) do |i|\n i.prompt(\"Target folder '#{new_folder}' already exists.\")\n\n i.choice('x', \"Don't migrate the test.\") do\n return\n end\n\n i.choice('O', \"Remove it.\") do\n unless delete_dir!(new_folder)\n i.restart!\n end\n end\n end\n\n if choice == :abort\n puts \"Cannot migrate test. #{new_folder} already exists.\"\n return\n end\n end\n\n FileUtils.cp_r @test_case.folder, new_folder\n\n new_test_case = SassSpec::TestCase.new(new_folder, @options)\n change_options(end_version: previous_version)\n change_options(new_test_case.options_path, start_version: current_version)\n\n overwrite_test!(new_test_case)\n end",
"def run_migration_file partial_filename, direction=:up\n id = get_migration_id partial_filename\n \"rake db:migrate:#{direction.to_s} VERSION=#{id}\"\n end",
"def generate_in(directory)\n migration_path = File.expand_path(\"#{directory}/#{@filename}\")\n File.open(migration_path, 'w') { |f| f.write(render 'geode/templates/model_destroy_migration_template.erb') }\n relative_migration_path = Pathname.new(migration_path).relative_path_from(Pathname.pwd).to_s\n puts \"+ Generated migration #{@migration_name} at #{relative_migration_path}\"\n end",
"def remove_duplicate_imports\n files.each(&:remove_duplicate_imports)\n end",
"def export_migrations\n clean_export_dir\n migration_generator = Admin::MigrationGenerator.new(default_schema_name)\n migration_generator.app_type_name = name\n migration_generator.add_schema AppExportDirSuffix\n\n associated_dynamic_models.each do |dynamic_def|\n export_migration dynamic_def\n end\n\n associated_external_identifiers.each do |dynamic_def|\n export_migration dynamic_def\n end\n\n valid_associated_activity_logs.each do |dynamic_def|\n export_migration dynamic_def\n end\n end",
"def remove_unwanted_files!\n system(\"cd ../#{self.underscored_name} && rm public/index.html public/images/rails.png\")\n system(\"cd ../#{self.underscored_name} && mv config/database.yml config/database.yml.example\")\n end",
"def install_migrations\n migrations = [\n \"create_blogelator_posts.rb\",\n \"create_blogelator_authors.rb\",\n \"create_blogelator_tags.rb\",\n \"create_blogelator_posts_tags.rb\",\n \"create_blogelator_posts_posts.rb\"\n ]\n migration_path = \"db/migrate\"\n migrations.each do |file|\n migration_template \"#{migration_path}/#{file}\", \"#{migration_path}/#{file}\"\n end\n end",
"def restore_files_to(to_db, jobs)\n [\n restore_pg_dump_file(to_db, %w(pre-data data), jobs),\n *restore_table_copy_files(to_db),\n restore_pg_dump_file(to_db, %w(post-data), jobs)\n ]\n end",
"def cleanup\n if ::File.exist?(chef_backup_dir) # rubocop:disable Style/GuardClause\n converge_by(\"removing #{chef_backup_dir}\") do\n FileUtils.rm_rf chef_backup_dir\n end\n end\nend",
"def set_previous_migrations\n GuidesGenerator::Migrator::previous_versions = version_class.all\n GuidesGenerator::Migrator::previous_sections = section_class.all\n GuidesGenerator::Migrator::previous_documents = document_class.all\n end",
"def cleanupTestFiles\n ('A' .. 'F').each { |del| FileUtils.rm(\"#{folder}HR3-Room#{del}.csv\", force: true) } \n end",
"def clear!\n \n # Removes old files in the test directory\n ['to', 'from'].each do |folder|\n Dir.glob(File.expand_path(File.dirname(__FILE__) + \"/data/#{folder}/*\")).each do |file|\n FileUtils.rm(file)\n end\n end\n \n {'some_zip_files.zip' => 'zip_real', 'test_package.rar' => 'rar_real'}.each_pair do |first, last|\n\n # Removes old files in the test directory\n Dir.glob(File.expand_path(File.dirname(__FILE__) + \"/data/#{last}/*\")).each do |file|\n FileUtils.rm(file) if Mimer.identify(file).text?\n end\n\n src = File.expand_path(File.dirname(__FILE__) + \"/data/o_files/#{first}\")\n dest = File.expand_path(File.dirname(__FILE__) + \"/data/#{last}/#{first}\")\n FileUtils.copy_file(src, dest)\n end\n\n # Removes old files in the test directory\n Dir.glob(File.expand_path(File.dirname(__FILE__) + \"/data/movie_to/*\")).each do |file|\n FileUtils.rm(file) if Mimer.identify(file).text?\n end\n \n {'test_package.rar' => 'to', 'some_zip_files.zip' => 'to'}.each do |first,last|\n src = File.expand_path(File.dirname(__FILE__) + \"/data/o_files/#{first}\")\n dest = File.expand_path(File.dirname(__FILE__) + \"/data/from/#{first}\")\n FileUtils.copy_file(src, dest)\n end\nend",
"def destroy_database_directory\n FileUtils.remove_dir(database_directory)\n end",
"def update_db\n ## Sequel\n drop_table\n create_table\n db.transaction do\n table.delete_sql\n install_manual\n install_updates\n end\n ## AR\n # self.transaction do\n # self.delete_all\n # self.install_manual\n # self.install_updates\n # end\n end",
"def run_migration(name, statements)\n\n begin\n statements.each do |statement|\n conn.exec(statement).clear\n end\n rescue Exception => e\n # we make a special allowance for one exception; it just means this migration\n # has already occurred, and we should just treat it like a continue\n if e.message.index('pg_migrate: code=migration_exists').nil?\n conn.exec(\"ROLLBACK\")\n raise e\n else\n conn.exec(\"ROLLBACK\")\n @log.info \"migration #{name} already run\"\n end\n end\n end"
] | [
"0.64950824",
"0.6446832",
"0.6330297",
"0.61446697",
"0.61125183",
"0.6087638",
"0.60875565",
"0.6055927",
"0.5956392",
"0.58962667",
"0.58298993",
"0.5826711",
"0.579875",
"0.566398",
"0.566398",
"0.5635069",
"0.56145006",
"0.5608341",
"0.5579934",
"0.55681324",
"0.55277866",
"0.550399",
"0.55029064",
"0.5447959",
"0.5434104",
"0.54137236",
"0.54073805",
"0.5386376",
"0.5382131",
"0.5361798",
"0.53556955",
"0.5341278",
"0.5337805",
"0.53050375",
"0.5301866",
"0.52990264",
"0.52960247",
"0.52767074",
"0.5275996",
"0.5261758",
"0.5259633",
"0.5257511",
"0.5253947",
"0.5251921",
"0.5251015",
"0.52447057",
"0.52411056",
"0.5232202",
"0.5220918",
"0.52154195",
"0.5209988",
"0.5190525",
"0.51846623",
"0.51812273",
"0.51796985",
"0.5170231",
"0.51591223",
"0.5136672",
"0.51345253",
"0.51303977",
"0.50921285",
"0.50852144",
"0.50845116",
"0.50816715",
"0.5079939",
"0.5076393",
"0.5074312",
"0.50670725",
"0.5057723",
"0.5057115",
"0.5041821",
"0.5041821",
"0.5029204",
"0.5013547",
"0.50044316",
"0.50037026",
"0.5003246",
"0.50027883",
"0.49849743",
"0.49831623",
"0.4980059",
"0.4977687",
"0.49769348",
"0.4973754",
"0.49712986",
"0.49691057",
"0.49558583",
"0.49253285",
"0.49208283",
"0.491541",
"0.4914487",
"0.4899055",
"0.48985273",
"0.4858954",
"0.48577684",
"0.48275697",
"0.48263988",
"0.4825469",
"0.48211762",
"0.4814555"
] | 0.72574717 | 0 |
adds the string to the front of the array | def using_unshift(array, string)
array.unshift(string)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def using_unshift(array, str)\n array.unshift(str)\nend",
"def using_unshift (array, string)\n return array.unshift(string)\nend",
"def using_unshift(array, string)\n array.unshift(string)\nend",
"def using_unshift(array,string)\n array.unshift(string)\nend",
"def using_unshift(array, string)\n array = array.unshift(string)\n \nend",
"def \n \n using_unshift(array, string)\n \n \n array.unshift(string)\n \nend",
"def using_unshift(arr, str)\n newArr = arr.unshift(str)\nend",
"def using_unshift(array, string)\n new_neighborhood = string\n array.unshift(new_neighborhood)\n \nend",
"def add_element_to_beginning_of_array(array,element)\n array.unshift(element)\nend",
"def add_element_to_start_of_array(array, element)\n array.unshift(element) \nend",
"def add_element_to_beginning_of_array(array, element)\n array.unshift(element)\nend",
"def add_element_to_beginning_of_array(array, element)\n array.unshift(element)\nend",
"def add_element_to_start_of_array(array, element)\n array.unshift(element)\nend",
"def add_element_to_start_of_array( array, element)\n return array.unshift(element)\nend",
"def add_element_to_beginning_of_array(array, element)\n array.insert(0, element)\nend",
"def begin_arr_add(arr, element)\n # Add `element` to the beginning of the Array \n # variable `arr` and return `arr`\n arr.unshift(element)\n end",
"def begin_arr_add(arr, element)\n # Add `element` to the beginning of the Array variable `arr` and return `arr`\n return arr.unshift(element)\nend",
"def add_s(array)\n newarray = []\n array.each_with_index do |element, index|\n if index != 1\n newarray << (element.concat(\"s\"))\n end\n end\nend",
"def add_s(arry)\n arry.map! do |item|\n item = item + \"s\"\n# arry[1] >> arry[1].slice(0..-2)\n\n end\n arry[1]=arry[1].slice(0..-2)\n arry\nend",
"def add_element_to_beginning_of_array(array, element)\n\tn = [2, 3, 4, 5]\n\tn.unshift(1)\nend",
"def add_ay(array)\n array.push(\"ay\")\nend",
"def add_s(array)\n\tindex = 0\n\tarray.each_with_index.collect do |element, index|\n\t\tif index == 1\n\t\t\telement\n\t\telse\n\t\t\telement << \"s\"\n\t\tend\n\tend\nend",
"def add_s(array)\n\t\tarray.each_with_index.collect do |word, i|\n\t\t\tif i == 1 then\n\t\t\t\tword = word\n\t\t\telse\n\t\t\t\tword << \"s\"\n\t\tend\n\tend\nend",
"def add_s(array)\n array.map.with_index {|item, index| index != 1 ? item << \"s\" : item}\nend",
"def prepend(value)\n @array.unshift(Node.new(value,@array[0]))\n end",
"def prepend(arr, num)\n return arr.unshift(num)\nend",
"def using_push(array, string)\n array = array.push(string)\n \nend",
"def prepend(input, string); end",
"def using_push (array, string)\n return array.push(string)\nend",
"def append(arr, char)\n output_arr = arr + [char]\n return output_arr\nend",
"def using_push(array, str)\n array.push(str)\nend",
"def using_push(array, str)\n array.push(str)\nend",
"def prepend(array, num)\noutput = []\noutput << num\noutput += array\nreturn output\nend",
"def add_rutabaga_to_string_and_array(str, ary)\n str << \"rutabaga\"\n ary << \"rutabaga\"\nend",
"def add_s(array)\n array.map.with_index do |element, index|\n if index != 1\n element + \"s\"\n else\n element\n end\n end\nend",
"def add_s(array)\n s_array = []\n second_element = array.delete_at(1)\n\n array.each do |element|\n element_array = element.split(\"\")\n element_array[element_array.length] = \"s\"\n result = element_array.join\n s_array << result\n end\n s_array.insert(1, second_element)\n s_array\nend",
"def add_s(array)\n array.collect.with_index do |word,index|\n if index != 1\n word << \"s\"\n else\n word\n end\n end\nend",
"def add_s(array)\n\tarray.each_with_index.collect{|e, i| if i == 1 e : e+\"s\"}\nend",
"def using_push(array, string)\n return array.push(string)\nend",
"def prepend(number, array)\n return array.insert(0, number)\nend",
"def using_push(arr, string)\n arr.push(string)\nend",
"def prepend(arr, num)\n output = []\n output << num\n return output + arr\nend",
"def using_push(array, string)\n array.push(string)\nend",
"def using_push(array, string)\n array.push(string)\nend",
"def using_push(array, string)\n array.push(string)\nend",
"def using_push(array, string)\n array.push(string)\nend",
"def add_bang(array)\n\tarray.map {|string| string + \"!\"}\nend",
"def add_s(array)\n array.each_with_index.collect do |word, index|\n if index != 1\n word << \"s\"\n end\n end\n array\nend",
"def prepend(arr, num)\n new_arr = arr.insert(0, num)\n return new_arr\nend",
"def log str\n $logger_array.unshift str\nend",
"def prepend(arr, num)\n return arr.insert(0, num)\nend",
"def prepend(arr,num)\n return [num] + arr\nend",
"def add_s(array)\n array.each_with_index.collect {|word, index| index != 1 ? word << \"s\" : word}\nend",
"def prepend(aName,aDataArray,aValue,reply)\n i = searchKey(aName,aDataArray[1])\n if i != '' then\n beforeValue = serv_data[i].values[0].values[0][0]\n nowValue = aValue.chop + beforeValue\n updateKey(aName,aDataArray,nowValue,i)\n returnStorage(reply,true)\n else\n returnStorage(reply,false)\n end\n end",
"def frontToEnd (word)\n word.push(word[0])\n word.slice!(0)\n return word\nend",
"def add_s(array)\n array.each_with_index.collect do |word, index|\n index != 1 ? \"#{word}s\" : word\n end\nend",
"def add_s(array)\n array.collect.with_index {|x, index| index != 1 ? x + \"s\" : x}\nend",
"def add_s(array)\n array.each_with_index.collect do |word, index|\n if index == 1\n word\n else\n word << \"s\"\n end\n end\nend",
"def unshift(val)\n @arr.unshift(val)\n end",
"def add_s(array)\n array.each_with_index.collect do |word, index|\n if index != 1\n word << \"s\"\n else\n word\n end\n end\nend",
"def add_s(array)\n array.each_with_index.collect { |element, index|\n if index != 1\n element << \"s\"\n else\n element\n end\n}\nend",
"def add_s(array)\n array.each_with_index.collect do |word, index|\n index == 1 ? word : word+\"s\"\n end\nend",
"def add_s(array)\n array.each_with_index.collect do |word, index|\n if index != 1\n word << \"s\"\n elsif index = 1\n word\n end\n end\nend",
"def add_s(array)\n array.each_with_index.collect do |element, index|\n if index == 1\n element\n else\n element += \"s\"\n end\n end\nend",
"def add_s(array)\n array.collect { |word| word != array[1] ? word + \"s\" : word }\nend",
"def add_s(array)\n array.each_with_index.collect do |word, index|\n if index != 1\n word << \"s\"\n else\n word\n end\n end\nend",
"def add_bang(array)\n array.map {|string| string+\"!\"}\nend",
"def add_to_array(arr, str) # define a method with an array and a string\n new_array = arr << str # create a new array with the array and add the string\n \n p new_array\n \nend",
"def add_to_array(arr,str)\n if arr == nil\n return [str.to_s]\n end\n if arr == ''\n return [str.to_s]\n end\n if arr.is_a? Array\n return arr + [str.to_s]\n end\n return arr.to_s + ',' + str.to_s\n end",
"def add_bang(array)\n # TODO: Take an array of strings and return a new array with \"!\" appended to each string.\n # You should use Enumerable#map\n array.map do |element|\n element+\"!\"\n end\nend",
"def add_broccoli(array)\n array << \"broccoli\"\n puts array\nend",
"def add_stop_to_start(stops_array, new_stop)\n result = stops_array.unshift(new_stop)\n return result\nend",
"def add_s(array)\n array.each_with_index.collect do |item, index|\n index == 1 ? item : item + \"s\"\n end\nend",
"def prepend(array, number)\n i = 0\n output = [number]\n while i < array.length\n output << array[i]\n i += 1\n end\n p output\n return output\nend",
"def add_s(array)\n array.map.each_with_index do |word, index|\n if index != 1\n word + \"s\" \n else\n word \n end\n end\nend",
"def add_s(array)\n array.collect do |element|\n if array.index(element) != 1\n element + \"s\"\n else\n element\n end\n end\nend",
"def prepend(str)\n @buffer.insert(0, str)\n @range.first -= str.bytesize\n str.bytesize\n end",
"def add_s(array)\n array.each_with_index.collect do |word,index|\n if index != 1 \n word + \"s\"\n else\n word\n end\n end\nend",
"def add_s(array)\n new_array=[]\n array.each_with_index.collect {|widget, index| index != 1 ? widget += \"s\" : widget }\nend",
"def fix_start(string)\n char_array = string.split(\"\")\n first_char = string[0]\n new_array = Array.new\n\n char_array.each do |i|\n if i == \"b\"\n new_array.push(\"*\")\n else\n new_array.push(i)\n end\n end\n\n new_array[0] = first_char\n puts new_array\nend",
"def add_s(array)\n second = array[1]\n add_s = array.map{|elem| elem + \"s\"}\n add_s[1] = second\n add_s\nend",
"def add_s(array)\n array.each_with_index.collect do |word, index|\n if (index == 1)\n word = word\n else\n word = word + 's'\n end # if statement\n end # collect method\nend",
"def add_s(array)\n array.each_with_index.map {|element, index| index == 1? element : element + \"s\"}\nend",
"def add_s(array)\n array.each_with_index.collect{|word, i| i == 1 ? word : word + \"s\"}\nend",
"def add_s(array)\n array.map do |word|\n if word == word\n word \n else \n word + \"s\"\n end\n end \nend",
"def add_s(array)\n array.collect do |word|\n if array[1] == word\n word\n else\n word + \"s\"\n end\n end\nend",
"def add_s(array)\n array.collect do |word|\n if array[1] == word\n word\n else\n word + \"s\"\n end\n end\nend",
"def prepend!(buffer)\n @str = buffer.to_s + @str\n self\n end",
"def prepend!(buffer)\n @str = buffer.to_s + @str\n self\n end",
"def add_to_back(item)\n @array << item\n end",
"def add_to_array!(array, item)\n array << item\nend",
"def add_s(arr)\n arr.collect do |word|\n if arr[1] == word\n word\n else\n word + 's'\n end\n end\nend",
"def add_rutabaga_to_array(an_array_param)\n an_array_param << \"rutabaga\"\nend"
] | [
"0.78610003",
"0.77769566",
"0.7769001",
"0.77567065",
"0.77551603",
"0.77423966",
"0.77090186",
"0.744187",
"0.7167576",
"0.7150526",
"0.7146718",
"0.71345437",
"0.71130425",
"0.7058408",
"0.6957623",
"0.6903203",
"0.67701745",
"0.6651832",
"0.6614276",
"0.6561021",
"0.655595",
"0.6526747",
"0.65114075",
"0.6485085",
"0.64740974",
"0.6378289",
"0.6362753",
"0.6355396",
"0.6352449",
"0.63487476",
"0.6328836",
"0.6328836",
"0.6327764",
"0.63275963",
"0.63266486",
"0.63257724",
"0.6320033",
"0.6315983",
"0.6313305",
"0.630423",
"0.6301903",
"0.62806827",
"0.627755",
"0.627755",
"0.627755",
"0.627755",
"0.6273626",
"0.62590444",
"0.62582755",
"0.62502337",
"0.6248079",
"0.624669",
"0.6228163",
"0.62216735",
"0.6193898",
"0.6189688",
"0.61823434",
"0.61769754",
"0.6176431",
"0.6160524",
"0.6159322",
"0.61425793",
"0.61127734",
"0.6109144",
"0.6095614",
"0.6092512",
"0.60913014",
"0.6078132",
"0.606521",
"0.6042481",
"0.59853345",
"0.5979458",
"0.59678847",
"0.5951466",
"0.5947267",
"0.59459794",
"0.59401727",
"0.59291965",
"0.59152097",
"0.59127754",
"0.5887639",
"0.588236",
"0.5873905",
"0.5866748",
"0.58599764",
"0.5843027",
"0.5843027",
"0.58412445",
"0.58412445",
"0.58328134",
"0.5820756",
"0.58115065",
"0.5793252"
] | 0.77790976 | 8 |
removes the last element from the array and return that element | def using_pop(array)
array.pop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_retrieve_last\n # @array.pop\n @array.slice!(0)\n end",
"def remove_element_from_end_of_array(array)\n return array.pop\nend",
"def remove_element_from_end_of_array(array)\n array.pop\nend",
"def remove_element_from_end_of_array(array)\n array.pop\nend",
"def exclude_last(arr)\n arr.slice!(arr.length-1,1)\n return arr\n end",
"def retrieve_last_element_from_array(array)\n return array[-1]\nend",
"def get_last_item(arr)\n\treturn arr[-1]\nend",
"def no_mutate(array)\n\tarray.last\nend",
"def remove_from_end(arr)\n arr.pop\nend",
"def retrieve_last_element_from_array(array)\n array.last\nend",
"def retrieve_last_element_from_array(array)\n array[array.length-1]\nend",
"def last_of(arr)\n output = arr[-1]\n return output\nend",
"def no_mutate(array)\n array.last #returns array with last item removed, no mutation of array\nend",
"def exclude_last(arr)\n arr[0..-2]\n end",
"def last_element(array)\n array[-1]\nend",
"def lastElement(arr)\n return arr[arr.length - 1]\nend",
"def last(array)\n array[-1]\nend",
"def end_arr_delete(arr)\n # delete the element from the end of the array and return the deleted element\n return arr.pop\nend",
"def using_last(array)\n last_element=array.last\nend",
"def my_but_last(array)\n\tarray.size - 1\nend",
"def non_mutate(array)\n array.last\nend",
"def exclude_last (array)\n array[0..-2]\nend",
"def last_of(arr)\n index = arr.length\n return arr[index -1]\nend",
"def pop()\n v, _ = @array.pop\n v\n end",
"def last_of(array)\n return array[-1]\nend",
"def end_arr_delete(arr)\n # delete the element from the end of the array and return the deleted element\n arr.pop\nend",
"def no_mutate(array)\n array.last\nend",
"def no_mutate(array)\n array.last\nend",
"def no_mutate(array)\n array.last\nend",
"def no_mutate(array)\n array.last\nend",
"def no_mutate(array)\n array.last\nend",
"def using_last(array)\narray.last\nend",
"def lastof(arr)\n return arr[arr.length - 1]\nend",
"def no_mutate(array)\n array.last #returns the last element of the array but does not actually permanently modify the array in any way\nend",
"def remove_element_from_start_of_array(array)\n return array.shift\nend",
"def last_of(arr)\n return arr[-1]\nend",
"def last_item(elective_array)\n return elective_array[-1]\nend",
"def last_of(array)\n return array[array.length - 1]\nend",
"def last_of(array)\n return array[array.length - 1]\nend",
"def remove_last\n raise 'No such element' if @size == 0\n elt = @tail.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @tail = @tail.previous\n @tail.next.previous = nil\n @tail.next = nil\n end\n @size -= 1\n return elt\n end",
"def using_last(array)\n array.last\n# returns last item in array \nend",
"def using_last(array)\n array.last\nend",
"def using_last(array)\n array.last\nend",
"def using_pop(array)\n array = array.pop(1)\n array.pop\n\n\nend",
"def last_of(arr)\n return arr[arr.length-1]\nend",
"def eliminar_ult_elem_arr(arreglo)\n arreglo.pop\n arreglo\nend",
"def pop\r\n @arr.shift\r\n end",
"def last\n @rarray.reverse.first \n end",
"def remove_element_from_start_of_array(array)\n array.shift\nend",
"def remove_element_from_start_of_array(array)\n array.shift\nend",
"def using_pop(array)\n element = array.pop\n element\nend",
"def pop\n raise 'No such element' if @elements.length == 0\n @elements.slice!(-1)\n end",
"def pop\r\n # What does array.pop do? It takes the last \r\n # item of a list. We want this method to return\r\n # the last item. So maybe we can do something like:\r\n # return @data.last\r\n end",
"def delete_max\n return -1 if @count == 0\n data = @array[0]\n @array[0] = @array.pop\n @count = @array.size\n percolate_down(0)\n data\n end",
"def last_element(array)\n taylor_swift = [\"Welcome to New York\", \"Blank Space\", \"Style\", \"Out of The Woods\"]\n taylor_swift[-1]\n end",
"def butlast\n if self.empty?\n []\n else\n self[0..-2]\n end\n end",
"def using_pop (array)\n return array.pop\nend",
"def pop\n return nil if self.curr == 0\n val = self.arr[self.curr - 1]\n self.curr -= 1\n val\n end",
"def using_pop(array)\n array.pop()\nend",
"def exclude_first (array)\n array[1..-1]\nend",
"def last\n all[all.size - 1]\n end",
"def start_arr_delete(arr)\n # delete the element at the beginning of the array and return the deleted element\n return arr.shift\nend",
"def remove()\n return if @store.empty?\n if @store.size == 1\n return @store.pop\n end\n # swap the first and the last element in the underlying array\n @store[-1], @store[0] = @store[0], @store[-1]\n removed = @store.pop\n heap_down(0)\n return removed.value\n end",
"def pop\n raise IndexError.new if @data.size == 0\n ret = @data[0]\n @data[0] = @data[@data.size - 1]\n @data = @data.take(@data.size - 1)\n percolate_down\n return ret\n end",
"def remove_last_child\n @elements.pop\n end",
"def tail\n \t@array[-1]\n end",
"def last\n self.slice(self.size - 1)\n end",
"def pop\n return nil if @count == 0\n\n # get the index of the las titem\n @store.store.reverse.each_with_index do |ele, i|\n if ele != nil \n @last_ele = capacity() - (i+1) \n break\n end\n end\n #val = @store.store.delete_at(@last_ele)\n val = @store.store[@last_ele]\n @store.store[@last_ele] = nil\n @count -= 1\n return val\n end",
"def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n \n if size < 2\n return remove_first\n else\n each_cons(2) do |node, next_node|\n if next_node.next_node == nil\n @tail = node\n @tail.next_node = nil\n break\n end\n end\n end\n\n @size -= 1\n\n return data\n end",
"def exclude_first(arr)\n arr[1..-1]\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def pop\n delete_at(0)\n end",
"def remove_item(elective_array)\n elective_array.pop\n puts elective_array\nend",
"def pop\n\t\tremove(@length - 1)\n\tend",
"def pop\n @data.delete_at @data.length - 1 if @data.length > 0\n end",
"def remove_first(array)\n array.delete_at(0)\n array\nend",
"def exclude_last(arrstring)\n arrstring[0..-2]\nend",
"def last_two(array)\n array.last(2)\nend",
"def \n \n using_pop(array)\n \n\n array.pop()\n \nend",
"def remove() # removes the element at the first position (root) of the array\n return nil if @store.empty?\n last_index = @store.length - 1\n # First, swap the last leaf & the root node\n swap(0, last_index)\n\n # Delete the last leaf (last item in the array)\n result = @store.pop\n\n # Then heap-down the new root, to reestablish the heap property\n # start heap_down with the root (index 0)\n heap_down(0) \n return result.value\n end",
"def last\n to_a.last\n end",
"def using_pop(arr)\n arr.pop\nend",
"def remove_last()\n\t\ttemp = @kb.pop\n\t\treturn !temp.nil?\n\tend",
"def last\n self[*Array.new(self.dim, -1)]\n end",
"def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n @tail = @tail.prev_node\n @size -= 1\n\n # removes the same element from @head, if it was final element/node\n if empty?\n @head = nil\n else\n # send to garbage collector\n @tail.next_node = nil\n end\n\n return data\n end",
"def remove\n return @exact.shift unless @exact.empty?\n @list.shift\n end",
"def pop_last\n @driver_instance.pop_list_last(@key)\n end",
"def last(list)\n list[-1]\nend",
"def exclude_last potato\n potato[0..-2]\nend",
"def exclude_last list\n list[0..-2]\nend",
"def last_element_with_array_methods(array)\n array.last\nend"
] | [
"0.8562115",
"0.8191691",
"0.80318755",
"0.80318755",
"0.79777193",
"0.7865328",
"0.78050315",
"0.7760841",
"0.77211654",
"0.77048576",
"0.7652601",
"0.76393324",
"0.7639147",
"0.7621482",
"0.761272",
"0.7592618",
"0.75801075",
"0.7578333",
"0.75608534",
"0.75558513",
"0.75556415",
"0.7542171",
"0.75397605",
"0.7534366",
"0.75183344",
"0.7515387",
"0.75029826",
"0.75029826",
"0.75029826",
"0.75029826",
"0.75029826",
"0.74976623",
"0.7491555",
"0.7475268",
"0.74272764",
"0.74004143",
"0.73983884",
"0.7380602",
"0.7380602",
"0.73636985",
"0.7336121",
"0.73276025",
"0.73276025",
"0.7325105",
"0.7316653",
"0.7300772",
"0.7276072",
"0.7266315",
"0.72626644",
"0.72626644",
"0.72513336",
"0.7243383",
"0.72158176",
"0.7168873",
"0.71261626",
"0.7106288",
"0.7078181",
"0.7075387",
"0.7074681",
"0.7060562",
"0.7059373",
"0.70117027",
"0.70065206",
"0.6970313",
"0.6960233",
"0.6959231",
"0.69544727",
"0.6951513",
"0.6945987",
"0.6941335",
"0.69326234",
"0.6901839",
"0.689736",
"0.6875733",
"0.6874782",
"0.68572176",
"0.6846617",
"0.6839919",
"0.68288",
"0.68157595",
"0.6787877",
"0.67634624",
"0.6739996",
"0.6735746",
"0.67157257",
"0.6715272",
"0.6672854",
"0.6663667",
"0.6657872",
"0.66526735",
"0.66455394",
"0.66451204"
] | 0.68624735 | 80 |
removes the last two array items and return them | def pop_with_args(array)
array.pop(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exclude_last (array)\n array[0..-2]\nend",
"def exclude_last(arr)\n arr[0..-2]\n end",
"def exclude_last(arr)\n arr.slice!(arr.length-1,1)\n return arr\n end",
"def remove_retrieve_last\n # @array.pop\n @array.slice!(0)\n end",
"def exclude_last list\n list[0..-2]\nend",
"def exclude_last potato\n potato[0..-2]\nend",
"def butlast\n if self.empty?\n []\n else\n self[0..-2]\n end\n end",
"def exclude_ends (array)\n array[1..-2]\nend",
"def exclude_last(sequence)\n sequence[0..-2]\nend",
"def all_elements_except_first_3 array\n\tarray = [1,2,3,4,5,6,7].last(4)\nend",
"def exclude_last(arrstring)\n arrstring[0..-2]\nend",
"def exclude_ends(arr)\n arr[1..-2]\nend",
"def using_pop(array)\n array = array.pop(1)\n array.pop\n\n\nend",
"def remove_from_end(arr)\n arr.pop\nend",
"def remove_element_from_end_of_array(array)\n return array.pop\nend",
"def pop_with_args(array)\n array = array.pop(2)\n array.pop(2)\n \nend",
"def remove_element_from_end_of_array(array)\n array.pop\nend",
"def remove_element_from_end_of_array(array)\n array.pop\nend",
"def pop_with_args(array)\narray = array.pop(2)\narray.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\n end",
"def drop_unused_tail things\n while things.last.unused?\n things = things[0...-1]\n end\n things\n end",
"def rm_index\n\tarray = [0, 2, 4, 6, 8]\n\twhile array.length > 2\n\t\tputs array.pop\n\tend\nend",
"def pop_with_args (array)\n return array.pop(2)\nend",
"def delete_finals(arr)\n arr[0..4]\nend",
"def all_elements_except_first_3 array\n\tarray.drop(3)\n\nend",
"def no_mutate(array)\n array.last #returns array with last item removed, no mutation of array\nend",
"def remove_cards\n\t\t@cards.slice!(0,2)\n\tend",
"def remove_every_other(arr)\n (1..arr.length).step(1) {|x| arr.slice!(x)}\n arr\nend",
"def last_two(array)\n array.last(2)\nend",
"def exclude_first (array)\n array[1..-1]\nend",
"def exclude_last(arg)\n arg[0..-2] ## or arg[0...-1]\nend",
"def remove_item(elective_array)\n elective_array.pop\n puts elective_array\nend",
"def pop_with_args(array)\n array.pop(2);\nend",
"def no_mutate(array)\n\tarray.last\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def exclude_first list\n list[1..-1]\nend",
"def my_but_last(array)\n\tarray.size - 1\nend",
"def exclude_ends list\n list[1..-2]\nend",
"def eliminar_ult_elem_arr(arreglo)\n arreglo.pop\n arreglo\nend",
"def exclude_first potato\n potato[1..-1]\nend",
"def remove_item(array, num_items)\n while array.length > num_items\n array.pop\n end\n array\nend",
"def all_elements_except_first_3 a\n a.shift\n a.shift\n a.shift\n return a\nend",
"def pop_with_args(arr)\n arr.pop(2)\nend",
"def remove\n return @exact.shift unless @exact.empty?\n @list.shift\n end",
"def all_elements_except_first_3(array)\n array.drop(3)\nend",
"def all_elements_except_first_3(array)\n array.drop(3)\nend",
"def all_elements_except_first_3 list\n list[3, list.length - 3]\nend",
"def using_pop (array)\n return array.pop\nend",
"def remove_fish_river()\n @fish.slice(index,1)\nend",
"def exclude_first(arr)\n arr[1..-1]\nend",
"def exclude_ends(arrstring)\n arrstring[1..-2]\nend",
"def pop_with_args(array,numb = 2)\n array.pop(2)\nend",
"def second_last\n return nil if (size-2) < 0\n self[size-2]\n end",
"def remove_element_from_start_of_array(array)\n return array.shift\nend",
"def no_mutate(array)\n array.last\nend",
"def no_mutate(array)\n array.last\nend",
"def no_mutate(array)\n array.last\nend",
"def no_mutate(array)\n array.last\nend",
"def no_mutate(array)\n array.last\nend",
"def end_arr_delete(arr)\n # delete the element from the end of the array and return the deleted element\n return arr.pop\nend",
"def pop\n\t\tif @length==1\n\t\t\t@last = nil\n\t\t\t@first = nil\n\t\telse \n\t\t\t@last = @last.back\n\t\t\t@last.front = nil\n\t\t\t@first = @last if @length==2\n\t\tend\n\t\t@length-=1\n\tend",
"def non_mutate(array)\n array.last\nend",
"def \n \n using_pop(array)\n \n\n array.pop()\n \nend",
"def strip_note!(data_array)\n data_array.pop\n end",
"def two_oldest_ages(arr)\n oldest_ages = []\n oldest_ages << arr.max\n arr.delete_at(arr.index(oldest_ages[0]))\n oldest_ages.unshift(arr.max)\n oldest_ages\nend",
"def all_elements_except_first_3(array)\n array[3..-1]\nend",
"def using_pop(array)\n array.pop()\nend",
"def drop_while(array)\n array.each_with_object([]).with_index do |(item, result), idx| \n return array[idx..-1] if !yield(item)\n end\nend",
"def butfirst\n if self.empty?\n []\n else\n self[1..-1]\n end\n end",
"def using_pop(array)\n array.pop\nend",
"def exclude_last input\n\n if input.class == Array\n input.pop\n input\n elsif input.class == String\n input.chop!\n end\n\nend",
"def get_last_item(arr)\n\treturn arr[-1]\nend",
"def all_elements_except_first_3(array)\n array[3..-1]\nend",
"def last_item(elective_array)\n return elective_array[-1]\nend",
"def exclude_ends input\n\n input[1..-2]\n\n end",
"def remove_every_other(arr)\n result = []\n arr.each_with_index do |obj, index_|\n result << obj if index_.even?\n end\n result\nend",
"def using_pop(array)\n array.pop\nend",
"def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n \n if size < 2\n return remove_first\n else\n each_cons(2) do |node, next_node|\n if next_node.next_node == nil\n @tail = node\n @tail.next_node = nil\n break\n end\n end\n end\n\n @size -= 1\n\n return data\n end",
"def remove_element_from_start_of_array(array)\n array.shift\nend",
"def remove_element_from_start_of_array(array)\n array.shift\nend",
"def skips(x)\n (0..x.length-1).map do |i|\n (y = x.dup).delete_at(i);y\n end\nend",
"def all_elements_except_first_3 array\n 3.times do |x|\n array.delete(array[0])\n end\n array\nend",
"def test_last_three\n array = [1,2,3,4,5]\n array = array.last(3)\n assert_equal [3,4,5], array\n end",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def delete_max\n return -1 if @count == 0\n data = @array[0]\n @array[0] = @array.pop\n @count = @array.size\n percolate_down(0)\n data\n end"
] | [
"0.782528",
"0.78186804",
"0.7776563",
"0.7538111",
"0.7505128",
"0.72887135",
"0.72868603",
"0.71094716",
"0.7030802",
"0.70049906",
"0.69502646",
"0.6929446",
"0.6928151",
"0.68812907",
"0.68551385",
"0.6817437",
"0.6754313",
"0.6754313",
"0.674815",
"0.66994137",
"0.6682345",
"0.66736776",
"0.6654886",
"0.66145486",
"0.661119",
"0.66076607",
"0.6599322",
"0.65921974",
"0.6591189",
"0.6587324",
"0.656638",
"0.6515905",
"0.6490736",
"0.64859515",
"0.6484952",
"0.6484952",
"0.6484952",
"0.6484952",
"0.6484952",
"0.6484952",
"0.6484952",
"0.6470842",
"0.6453873",
"0.6414719",
"0.64034885",
"0.63982993",
"0.6389036",
"0.63812584",
"0.63804096",
"0.63766086",
"0.6369794",
"0.6369794",
"0.63608795",
"0.6360661",
"0.6360257",
"0.63350546",
"0.6327877",
"0.63049674",
"0.6301387",
"0.62996864",
"0.6277475",
"0.6277475",
"0.6277475",
"0.6277475",
"0.6277475",
"0.6245507",
"0.62452006",
"0.62320966",
"0.62318426",
"0.62304336",
"0.6226767",
"0.62251276",
"0.6222498",
"0.6219569",
"0.6215538",
"0.62093353",
"0.61961085",
"0.619142",
"0.6187748",
"0.61833507",
"0.6169794",
"0.6163606",
"0.61588806",
"0.61584294",
"0.61520857",
"0.61520857",
"0.6144338",
"0.6144129",
"0.6143441",
"0.6142768",
"0.6142768",
"0.6142768",
"0.6142768",
"0.6142768",
"0.6142768",
"0.6142768",
"0.6142768",
"0.6142768",
"0.6139784"
] | 0.6503454 | 33 |
removes the first item and return it | def using_shift(array)
array.shift
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_first(item)\n return self.dup.tap { |s| s.remove_first!(item) }\n end",
"def remove\n return @exact.shift unless @exact.empty?\n @list.shift\n end",
"def delete_first(items)\n items = [items] unless items.respond_to?(:each)\n items.each do |item|\n delete_at(index(item))\n end\n self\n end",
"def deleteFirst\n @songs.shift\n self\n end",
"def pop_first\n @driver_instance.pop_list_first(@key)\n end",
"def pop\n delete_at(0)\n end",
"def remove(index)\n @size -= 1\n if index == 0\n @first_item = @first_item.next_list_item\n else\n previous_item = get_item( index -1)\n next_list_item = previous_item.next_list_item.next_list_item\n previous_item.next_list_item = next_list_item\n #get_item( index - 1).next_list_item = nil\n # return @first_item = @first_item.next_list_item if index == 0\n # item = @first_item\n # (index - 1).times do\n # item = item.next_list_item\n # # puts \"(((((((()))))))))))))((((((((((((((@item))))))))))))))\"\n # # puts @first_item.payload\n # # puts\"((((((((((((((item.next_list_Item)))))))))))))\"\n # # puts item.payload\n # end\n # raise IndexError if item.nil?\n # item.next_list_item = item.next_list_item.next_list_item\n end\nend",
"def remove_item(item,first_list)\n\n first_list.delete(item)\n\nend",
"def remove_first\n raise 'No such element' if @size == 0\n elt = @head.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @head = @head.next\n @head.previous.next = nil\n @head.previous = nil\n end\n @size -= 1\n return elt\n end",
"def remover_item\n # Remove um item do final do buffer\n BUFFER.pop\n end",
"def first\n items.compact.first\n end",
"def remove_item(electives)\n electives.pop #removes last item\n puts electives\nend",
"def remove()\n removed = @store[0].value\n swap(0, @store.length - 1)\n @store.pop\n heap_down(0)\n return removed\n end",
"def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n end\n\n return data\n end",
"def remove_card\n cards.shift\n return cards\n end",
"def first\n @items.first\n end",
"def remove\n @store.shift\n end",
"def remove_front\n value = self.head # save the first element\n self.head = value.next # the second element becomes the new first element\n value.next = nil # no longer in the list, so no next\n return value\n end",
"def remove_front\n placeholder = @head\n @head = placeholder.next\n return placeholder\n end",
"def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n else\n # send to garbage collector\n @head.prev_node = nil\n end\n\n return data\n end",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def remove_item(item)\n index = @list.index(item)\n remove_item_at(index)\n end",
"def pop\n item = @first.val\n @first = @first.next\n @last = nil if(@first == nil)\n @size -= 1\n item\n end",
"def pop\n return nil if @count == 0\n\n # get the index of the las titem\n @store.store.reverse.each_with_index do |ele, i|\n if ele != nil \n @last_ele = capacity() - (i+1) \n break\n end\n end\n #val = @store.store.delete_at(@last_ele)\n val = @store.store[@last_ele]\n @store.store[@last_ele] = nil\n @count -= 1\n return val\n end",
"def remove_retrieve_last\n # @array.pop\n @array.slice!(0)\n end",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def pop\n raise 'No such element' if @elements.length == 0\n @elements.slice!(-1)\n end",
"def remove_first(array)\n array.delete_at(0)\n array\nend",
"def remove_item_at(index)\n @list.slice!(index)\n end",
"def remove_item(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def first!(list)\n list.last\n end",
"def remove_by_index(index)\n @items.delete_at(index-1)\n end",
"def remove()\n return if @store.empty?\n if @store.size == 1\n return @store.pop\n end\n # swap the first and the last element in the underlying array\n @store[-1], @store[0] = @store[0], @store[-1]\n removed = @store.pop\n heap_down(0)\n return removed.value\n end",
"def remove_item!(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item_name)\r\n list.delete(item_name)\r\n list\r\nend",
"def remove_item(olist, item)\n olist.delete(item) \n olist\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item_name)\n list.delete(item_name)\n list\nend",
"def pop\n list.pop\n end",
"def remove_item(list,item)\r\n\r\n list.delete(item)\r\n list\r\nend",
"def first_item\n items.first\n end",
"def remove_front\n temp = self.head\n self.head = self.head.next\n return temp\n end",
"def remove_item (item, list)\n list.delete(item)\n return list\nend",
"def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end",
"def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end",
"def dequeue\n @items.delete_at(0)\n end",
"def remove_item (list, item)\n list.delete(item)\nend",
"def pop\r\n removed_item = @data\r\n @data = @data.next_node\r\n removed_item.next_node = nil\r\n removed_item\r\n end",
"def remove_card\n @cards.shift\n end",
"def remove_item(list, item_name)\r\n\tif list.has_key?(item_name)\r\n\t\tlist.delete(item_name)\r\n\tend\r\n\tlist\r\nend",
"def remove_card\n @cards.shift\n\n end",
"def remove_item(list, item_name)\r\n # list.delete_if { |item, amount| item == item_name }\r\n list.delete(item_name)\r\nend",
"def remove_item(grocery_list, item)\n grocery_list.delete(item)\n grocery_list # Now this is the last object evaluated\nend",
"def remove_item(item_list, item)\r\n item_list.delete(item)\r\n item_list\r\nend",
"def pop()\n # if the stack is empty, return nil\n # (it would also be reasonable to throw an exception)\n if @items.empty?\n return nil\n end\n return @items.pop()\n end",
"def remove_item\n\n end",
"def delete_one(obj=nil, &block)\n if obj\n return self.slice!(self.index(obj))\n elsif block\n self.each_with_index do |e,i|\n return self.slice!(i) if yield e\n end\n end\n nil\n end",
"def remove_last_item_from_items_collected_at_desk\n $items_collected.delete($items_collected.last)\n# returns user to previous task of choosing item from desk\n desk_options\nend",
"def remove_item(item, list)\n list.delete(item)\n return list\nend",
"def pop\n # assume head of @store is top of stack\n return @store.remove_first()\n end",
"def deq\n\t\tremove(0)\n\tend",
"def removed(node)\n\t\t\t@size -= 1\n\t\t\treturn node\n\t\tend",
"def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end",
"def pop\n\t\tif (!@head) then return nil end\n\t\ttemp = @head\n\t\t@head = @head.get_next()\n\t\tif (@head) then @head.set_prev(nil)\n\t\telse @tail = nil\n\t\tend\n\t\t@size -= 1\n\t\treturn temp.get_item()\n\tend",
"def pop()\n # if the stack is empty, return nil\n # (it would also be reasonable to throw an exception)\n if @items.empty?\n return nil\n end\n return @items.pop()\n end",
"def remove()\n return if @store.empty?\n\n swap(0, @store.length - 1)\n banished = @store.pop\n heap_down(0)\n\n return banished.value\n end",
"def pull(item)\n @items.delete(item) if include?(item)\n end",
"def get_first_point\n @points.each do |pt|\n @points.delete(pt)\n return pt\n end\n end",
"def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end",
"def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end",
"def remove_item(grocery_list, item)\n grocery_list.delete(item)\n return grocery_list\nend",
"def remove()\n \n swap(0, @store.length - 1)\n removed = @store.pop()\n \n heap_down(0) unless @store.empty?\n \n return removed.value\n end",
"def pop\n thing = @things.shift\n update_gist\n return thing\n end",
"def drop_one!(label)\n i = self.labels.index(label)\n return nil unless i\n self.items.each do |item|\n item.delete_at(i)\n end\n self.labels.delete_at(i)\n self\n end",
"def remove(item)\n # TODO\n # - removes first occurence of `item` in list.\n # - uses '==', so beware if expecting eql? or equals? logic instead\n # - shifts element in array to fill in spot\n\n (0...@array.size).each do |i|\n if @array[i] == item\n @array[i] = nil\n\n # TODO\n # - consider resizing array if load is under some threshold (maybe 0.25?)\n\n shift_elements\n break\n end\n end\n\n end",
"def delete_at(index)\t\n\t\tif index==1\n\t\t\t@first = tmp.front\n\t\t\t@first.back = nil\n\t\telsif @length==index\n\t\t\tpop;\n\t\telse\n\t\t\ttmp = get(index)\n\t\t\ttmp.back.front = tmp.front \n\t\t\ttmp.front.back = tmp.back\n\t\tend\n\t\t@length-=1\n\tend",
"def peek()\n return nil if @items.empty?\n return @items[-1]\n end",
"def last\n items.compact.last\n end",
"def pop\n if @queue.empty?\n nil\n else\n tempArr = []\n while @queue.size > 1\n tempArr.push(@queue.remove)\n end\n tempItem = @queue.remove\n while !tempArr.empty?\n @queue.insert(tempArr.pop)\n end\n tempItem\n end\n end",
"def pop\n @data.delete_at @data.length - 1 if @data.length > 0\n end",
"def remove_item(list, item)\r\n\tlist.delete(item)\r\n\treturn list\r\nend",
"def remove()\n return nil if !@store\n\n swap(0, @store.length - 1)\n nope = @store.pop\n\n heap_down(0)\n return nope.value\n end",
"def pop\n raise IndexError.new if @data.size == 0\n ret = @data[0]\n @data[0] = @data[@data.size - 1]\n @data = @data.take(@data.size - 1)\n percolate_down\n return ret\n end",
"def remove(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_item (list, item)\n list.delete(item)\nend",
"def deselect_item\n @selected = nil\n\n items\n end",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item_name)\n if list.has_key?(item_name)\n list.delete(item_name)\n end\n list\nend",
"def remove_item(list, item_to_remove)\n list.reject! { |item, quantity| item == item_to_remove }\n return list\nend",
"def remove_item(grocery_list, item)\r\n\tgrocery_list.delete(item)\r\n\tgrocery_list\r\nend",
"def remove_item (item,list)\nlist.delete(item)\nlist\nend",
"def delete_item(list,item)\n list.delete(item)\n return list\nend",
"def remove_item(list, item_to_be_removed)\n # if list.has_key? item_to_be_removed\n # list.delete(item_to_be_removed)\n # end\n list.delete(item_to_be_removed) if list.has_key? item_to_be_removed\n list\nend",
"def remove_item(list, item)\n # list.delete_if do |grocery_item, qty|\n # grocery_item == item\n # end\n list.delete(item)\n\n list\nend",
"def remove_item(list, item)\n list.delete(item)\nend"
] | [
"0.7904336",
"0.73692536",
"0.7068829",
"0.7046681",
"0.70312953",
"0.69558793",
"0.6931585",
"0.6927071",
"0.69099426",
"0.68258584",
"0.68151677",
"0.6684873",
"0.6618262",
"0.6612974",
"0.66108006",
"0.6552066",
"0.65513194",
"0.65508413",
"0.65314543",
"0.65307456",
"0.6525194",
"0.65229344",
"0.6517544",
"0.6513587",
"0.6510439",
"0.6507761",
"0.6505503",
"0.6497384",
"0.6494889",
"0.6487865",
"0.64822733",
"0.64669704",
"0.64646924",
"0.6458965",
"0.64578176",
"0.64534223",
"0.64534223",
"0.64496166",
"0.6441733",
"0.6431932",
"0.6431932",
"0.6431932",
"0.6431932",
"0.64214396",
"0.6417315",
"0.6416608",
"0.6391198",
"0.6384796",
"0.63845605",
"0.63793683",
"0.63793683",
"0.6378829",
"0.6378046",
"0.63642085",
"0.63587487",
"0.63544536",
"0.63491505",
"0.6331349",
"0.63295656",
"0.63244295",
"0.63192004",
"0.63172495",
"0.6316973",
"0.6298994",
"0.62968194",
"0.62854517",
"0.6283367",
"0.6271012",
"0.6270024",
"0.6268232",
"0.6265652",
"0.62578714",
"0.6248918",
"0.62437195",
"0.623833",
"0.623833",
"0.6233474",
"0.6229759",
"0.62271124",
"0.6217953",
"0.6217682",
"0.62163067",
"0.62108237",
"0.61992055",
"0.6198863",
"0.6195176",
"0.6194196",
"0.61912835",
"0.61870384",
"0.61845255",
"0.61708724",
"0.6168835",
"0.6166635",
"0.61621845",
"0.6155418",
"0.6154241",
"0.61472267",
"0.61420476",
"0.6135838",
"0.61351347",
"0.61317706"
] | 0.0 | -1 |
removes and return the first 2 items | def shift_with_args(array)
array.shift(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_cards\n\t\t@cards.slice!(0,2)\n\tend",
"def remove\n return @exact.shift unless @exact.empty?\n @list.shift\n end",
"def drop!(n)\n dropped_elements = @list.values.first(n)\n @list = Hash[@list.drop(n)]\n return dropped_elements\n end",
"def remove_fish_river()\n @fish.slice(index,1)\nend",
"def remove_item(item,first_list)\n\n first_list.delete(item)\n\nend",
"def remove_item(n)\n\tzombie_apocalypse_supplies = [\"hatchet\", \"rations\", \"water jug\", \"binoculars\",\n \"shotgun\", \"compass\", \"CB radio\", \"batteries\"]\n\n\tzombie_apocalypse_supplies = zombie_apocalypse_supplies[0..n]\n\t\n\treturn zombie_apocalypse_supplies\nend",
"def remove_card\n cards.shift\n return cards\n end",
"def exclude_first potato\n potato[1..-1]\nend",
"def all_elements_except_first_3 list\n list[3, list.length - 3]\nend",
"def remove(index)\n @size -= 1\n if index == 0\n @first_item = @first_item.next_list_item\n else\n previous_item = get_item( index -1)\n next_list_item = previous_item.next_list_item.next_list_item\n previous_item.next_list_item = next_list_item\n #get_item( index - 1).next_list_item = nil\n # return @first_item = @first_item.next_list_item if index == 0\n # item = @first_item\n # (index - 1).times do\n # item = item.next_list_item\n # # puts \"(((((((()))))))))))))((((((((((((((@item))))))))))))))\"\n # # puts @first_item.payload\n # # puts\"((((((((((((((item.next_list_Item)))))))))))))\"\n # # puts item.payload\n # end\n # raise IndexError if item.nil?\n # item.next_list_item = item.next_list_item.next_list_item\n end\nend",
"def exclude_first list\n list[1..-1]\nend",
"def remove_first(item)\n return self.dup.tap { |s| s.remove_first!(item) }\n end",
"def exclude_last list\n list[0..-2]\nend",
"def remove_item_at(index)\n @list.slice!(index)\n end",
"def remove_item(electives)\n electives.pop #removes last item\n puts electives\nend",
"def remove_item(list, item_name)\r\n # list.delete_if { |item, amount| item == item_name }\r\n list.delete(item_name)\r\nend",
"def all_elements_except_first_3\nend",
"def all_elements_except_first_3\nend",
"def all_elements_except_first_3\nend",
"def all_elements_except_first_3 a\n a.shift\n a.shift\n a.shift\n return a\nend",
"def exclude_last potato\n potato[0..-2]\nend",
"def remove_item(list, item_to_remove)\n list.reject! { |item, quantity| item == item_to_remove }\n return list\nend",
"def all_elements_except_first_3 array\n\tarray.drop(3)\n\nend",
"def remove_by_index(index)\n @items.delete_at(index-1)\n end",
"def all_elements_except_first_3 a\n\treturn a[3, 5] \nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def all_elements_except_first_3 array\n 3.times do |x|\n array.delete(array[0])\n end\n array\nend",
"def remove_item(list, item)\n # list.delete_if do |grocery_item, qty|\n # grocery_item == item\n # end\n list.delete(item)\n\n list\nend",
"def pop_with_args(array)\n array = array.pop(2)\n array.pop(2)\n \nend",
"def remove_items(supplies)\n counter = 0\n \n while counter < supplies.length\n if supplies.length > 5\n supplies.delete_at(counter)\n end\n counter += 1\n end\n supplies\nend",
"def remove_retrieve_last\n # @array.pop\n @array.slice!(0)\n end",
"def remove_item(item_list, item)\r\n item_list.delete(item)\r\n item_list\r\nend",
"def all_elements_except_first_3(array)\n array.drop(3)\nend",
"def all_elements_except_first_3(array)\n array.drop(3)\nend",
"def remove_item (item, list)\n list.delete(item)\n return list\nend",
"def remove_list(older_list, item)\r\n older_list.delete(item)\r\n return older_list\r\nend",
"def remove_item(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_item!(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def take (arr, index = 1)\n arr.drop(index)\n end",
"def remove_item(list,item)\r\n\r\n list.delete(item)\r\n list\r\nend",
"def using_pop(array)\n array = array.pop(1)\n array.pop\n\n\nend",
"def delete_first(items)\n items = [items] unless items.respond_to?(:each)\n items.each do |item|\n delete_at(index(item))\n end\n self\n end",
"def remove_item(item, list)\n list.delete(item)\n return list\nend",
"def remove_item(grocery_list, item)\n grocery_list.delete(item)\n return grocery_list\nend",
"def remove_item(array, num_items)\n while array.length > num_items\n array.pop\n end\n array\nend",
"def remove_item (item,list)\nlist.delete(item)\nlist\nend",
"def pop_with_args(array)\narray = array.pop(2)\narray.pop(2)\nend",
"def remove_item(list, item_name)\r\n list.delete(item_name)\r\n list\r\nend",
"def rm_index\n\tarray = [0, 2, 4, 6, 8]\n\twhile array.length > 2\n\t\tputs array.pop\n\tend\nend",
"def remove_item(list, item_name)\n list.delete(item_name)\n list\nend",
"def butlast\n if self.empty?\n []\n else\n self[0..-2]\n end\n end",
"def deleteFirst\n @songs.shift\n self\n end",
"def remove_card\n @cards.shift\n\n end",
"def remover_item\n # Remove um item do final do buffer\n BUFFER.pop\n end",
"def remove_card\n @cards.shift\n end",
"def remove_item(olist, item)\n olist.delete(item) \n olist\nend",
"def pop_with_args(array)\n array.pop(2)\n end",
"def butfirst\n if self.empty?\n []\n else\n self[1..-1]\n end\n end",
"def remove_item (list, item)\n list.delete(item)\nend",
"def remove_weakest_individual\n sort_routes\n @routes = @routes[0..-2]\n end",
"def delete_at n\n self.slice! n\n end",
"def pop_with_args (array)\n return array.pop(2)\nend",
"def take(array, index=1)\n p array.drop(index)\nend",
"def sample_and_remove(n)\n samples = sample(n)\n @content -= samples\n samples\n end",
"def remove(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_items(arr)\n counter = arr.length\n new_array = []\n arr.each do |item|\n if new_array.length < 5\n new_array << item\n counter -= 1\n end\n end\n new_array\nend",
"def remove_item(new_list, item)\n \n new_list.delete(item)\n \n new_list\nend",
"def delete_nth(order,max_e)\n #z\n # each перебирает каждый элемент массива order. добавить его в новый массив res\n # за исключением когда счётчик этого элемента будет равен числу за скобками\n res = []\n order.each { |num| res << num unless res.count(num) == max_e }\n p res\n\n # другой вариант записи\n # p order.select.with_index { |x, index| order[0..index].count(x) <= max_e }\n\n\n# то же самое через хеш\n# result = []\n# hash = Hash.new(0)\n# order.each do |a|\n# hash[a] += 1\n# result << a if hash[a] <= max_e\n# end\n# result\n\n\n\n\n# лучшее решение по kate\n# hash = Hash.new(0)\n# order.reject { |a| (hash[a] += 1) > max_e }\n\n\n# p order.delete_if {|i| order.count(i) > max_e} # порядок не сохраняется\nend",
"def remove_item_from_list(grocery_list, item) \n grocery_list.delete(item) \n grocery_list \nend",
"def remove_item(item, grocery_list)\n grocery_list.delete(item)\n return grocery_list\nend",
"def remove_item(item, grocery_list)\n grocery_list.delete(item)\n return grocery_list\nend",
"def delete_over_nth(list,n)\n x = list[0]\n list.each do |item|\n if item == x\n return true\n else\n return false\n end\n p x\n end\n \nend",
"def remove_item(list, item_removed)\n list.delete(item_removed)\nend",
"def pop_with_args(array,numb = 2)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def all_elements_except_first_3 array\n\tarray = [1,2,3,4,5,6,7].last(4)\nend",
"def remove_item(grocery_list, item)\r\n\tgrocery_list.delete(item)\r\n\tgrocery_list\r\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def remove_last_item_from_items_collected_at_desk\n $items_collected.delete($items_collected.last)\n# returns user to previous task of choosing item from desk\n desk_options\nend",
"def remove_item(grocery_list, item_name)\r\n\tgrocery_list.delete(item_name)\r\n\treturn grocery_list\r\nend",
"def remove_item(list, item_remove)\n list.delete(item_remove)\nend",
"def remove_item(new_list, item_name)\r\n new_list.delete(item_name)\r\nend",
"def exclude_last (array)\n array[0..-2]\nend",
"def pop_with_args(arr)\n arr.pop(2)\nend",
"def remove(list,item)\r\n\tlist.delete(item)\r\n\tlist\r\nend",
"def remove_item(list, item)\r\n\tlist.delete(item)\r\n\treturn list\r\nend"
] | [
"0.70008415",
"0.6667068",
"0.65538055",
"0.6525892",
"0.6421527",
"0.6408714",
"0.63991064",
"0.63599104",
"0.6309316",
"0.6301006",
"0.6238068",
"0.6222119",
"0.6216789",
"0.61941886",
"0.61658305",
"0.60964936",
"0.6084031",
"0.6084031",
"0.6084031",
"0.60806143",
"0.60686547",
"0.60116446",
"0.601098",
"0.59830225",
"0.59167683",
"0.59007263",
"0.5900117",
"0.5892782",
"0.58912545",
"0.58809",
"0.5880565",
"0.5879957",
"0.5877745",
"0.5877745",
"0.58689696",
"0.58675843",
"0.58664274",
"0.58659303",
"0.5845188",
"0.58385676",
"0.58385676",
"0.58385676",
"0.58385676",
"0.5838523",
"0.5838523",
"0.58368546",
"0.58276737",
"0.5816538",
"0.5816226",
"0.58104646",
"0.5803553",
"0.57992685",
"0.5781175",
"0.5776831",
"0.57709384",
"0.5765474",
"0.5762912",
"0.57547325",
"0.5734715",
"0.5732943",
"0.5729256",
"0.5723836",
"0.57039493",
"0.57005864",
"0.56960106",
"0.5677941",
"0.56716776",
"0.56642365",
"0.56608444",
"0.56558996",
"0.5650507",
"0.5636265",
"0.56336623",
"0.56317914",
"0.56313896",
"0.56225634",
"0.5621965",
"0.561623",
"0.561623",
"0.5609801",
"0.5608963",
"0.5604789",
"0.5603119",
"0.5603119",
"0.5603119",
"0.5603119",
"0.5603119",
"0.5603119",
"0.5603119",
"0.55957335",
"0.55948514",
"0.55924755",
"0.55924755",
"0.5592401",
"0.55905724",
"0.55843735",
"0.55785537",
"0.5577256",
"0.5576849",
"0.5569983",
"0.5569599"
] | 0.0 | -1 |
adds the contents of the 2nd array to the first | def using_concat(array, array2)
array.concat(array2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concat(array,array2)\n array << array2\n return array\nend",
"def array_concat(array_1, array_2)\n\tarray_1 += array_2\nend",
"def using_concat(array1, array2)\n array1 = array1.push(*array2)\n\nend",
"def array_concat(array_1, array_2)\n array_2.each do |x|\n array_1[array_1.length] = x\n end\n return array_1\nend",
"def concat_array(array1, array2)\n\t\tarray1.concat (array2)\n\tend",
"def add_to_array(x, y)\n combined_array = x\n combined_array.push(y)\nend",
"def array_concat(array_1, array_2)\n cnct_array = array_1\n for i in 0...array_2.length\n cnct_array[cnct_array.length+i] = array_2[i]\n end\n return cnct_array\nend",
"def concat(array, array2)\n return array + array2\nend",
"def array_concat(array_1, array_2)\n\n array_2.each do |a2_element|\n array_1.push(a2_element)\n end\n\n return array_1\n\nend",
"def array_concat(array_1, array_2)\n # Your code here\n array_2.each do |val|\n \tarray_1 << val\n end\n array_1\nend",
"def array_concat(array_1, array_2)\n array_1.push(*array_2) \nend",
"def array_concat(array_1, array_2)\n # Your code here\n array_2.each do |element|\n array_1 << element\n end\n array_1\nend",
"def array_concat(array_1, array_2)\n\tnew_arr = array_1 + array_2\nend",
"def array_concat(array_1, array_2)\n\tour_array = array_1\n\tarray_2.each do |newguy|\n\t\tour_array.push(newguy)\n\tend\n return our_array\nend",
"def array_concat(array_1, array_2)\n # Your code here\n #Iterate over the length of array\n array_2.each do |section|\n #add each section of the array to the other\n array_1.push(section)\n end\n # Output the combination of both the array\n return array_1\nend",
"def array_concat(array1, array2)\n\tarray1 + array2\nend",
"def array_concat(array_1, array_2)\n\treturn (array_1 << array_2).flatten\nend",
"def array_concat(array_1, array_2)\n array_2.each do |x|\n \tarray_1 << x\n \t\n end\n p array_1\nend",
"def array_concat(array_1, array_2)\n\n\tarray_1.concat(array_2)\nend",
"def array_concat(array_1, array_2)\n array_2.each do |x|\n array_1.push x\n end\n return array_1\nend",
"def using_concat(array1, array2)\n array1 = array1.concat(array2)\nend",
"def array_concat(array_1, array_2)\n array_2.each { |x| array_1.push(x) }\n return array_1\nend",
"def using_concat(array1,array2)\n array1.concat(array2)\n end",
"def array_concat(array_1, array_2)\n # create new holder of correct length\n ret = []\n # iterate over first array\n array_1.each do |entry|\n #copy contents into holder\n \tret << entry\n end\n # iterate over second array, append to end\n array_2.each do |entry|\n \tret << entry\n end\n return ret\nend",
"def array_concat(array_1, array_2)\n array_2.each {|x| array_1.push(x).to_a}\n return array_1\n \nend",
"def array_concat(array_1, array_2)\n array_2.each do |x|\n array_1.push(x)\n end\n return array_1\nend",
"def array_concat(array_1, array_2)\n # Your code here\n for element in array_2\n \tarray_1.push(element)\n end\n return array_1\nend",
"def array_concat(array_1, array_2)\n newarray = Array.new\n for i in 0..(array_1.length-1)\n newarray[i] = array_1[i]\n end\n for j in 0..(array_2.length-1)\n newarray[array_1.length+j] = array_2[j]\n end\n return newarray\nend",
"def array_concat(array_1, array_2)\n\tif array_1.length == 0 && array_2.length == 0\n\t\treturn []\n\tend\n\ti = 0\n\twhile i < array_2.length\n\t\tarray_1.push(array_2[i])\n\t\ti+=1\n\tend\n return array_1\nend",
"def array_concat(array_1, array_2)\n\tarray_1.concat(array_2)\nend",
"def array_concat(array_1, array_2)\n\tarray_1.concat(array_2)\nend",
"def concat(arr, arr2)\n return arr + arr2\nend",
"def array_concat(array_1, array_2)\n\tnew_array = []\n\ti = 0\n\twhile i < array_1.length\n\t\tnew_array[i] = array_1[i]\n\t\ti += 1\n\tend\n\tj = 0\n\twhile j < array_2.length\n\t\tnew_array[i+j] = array_2[j]\n\t\tj += 1\n\tend\n\treturn new_array\nend",
"def double_array(array)\n array + array\nend",
"def double_array(array)\n array.concat(array)\nend",
"def array_concat(array_1, array_2)\n z = array_1 + array_2\nend",
"def custConcat(arr1, arr2)\n # return arr1 with all of the elements from arr2 \n # added to the end of it\n arr1.concat(arr2)\nend",
"def array_concat(array_1, array_2)\n \tawesome_array = array_1 + array_2\n \tawesome_array\nend",
"def using_concat(array, arr2)\n array.concat(arr2)\nend",
"def array_concat(my_array1, my_array2)\n my_array1 + my_array2\nend",
"def array_concat(array_1, array_2)\n if array_1.empty? && array_2.empty?\n \tfinal_array = []\n else\n \tcount = 0\n \twhile count < array_2.length\n \t\tfinal_array = array_1.push array_2[count]\n \t\tcount += 1\n \tend\n end\n return final_array\nend",
"def array_concat(array_1, array_2)\n # return array_1 + array_2 would work\n array = array_1\n array_2.each do |item|\n array.push item\n end\n return array\nend",
"def array_concat(array_1, array_2)\n\n\n newArray = Array.new\n counter = 0\n\n (array_1.length).times do |x|\n newArray[counter] = array_1[x]\n counter = counter + 1\n end\n\n (array_2.length).times do |y|\n newArray[counter] = array_2[y]\n counter = counter + 1\n end\n\n newArray\nend",
"def array_concat(array_1, array_2)\n concat = array_1\n i=0\n while array_2.length > i\n array_1.push(array_2[i])\n i+=1\n end\n return concat\nend",
"def concat(array1, array2)\n return array1 + array2\nend",
"def using_concat(array1, array2)\n \n array1.concat(array2)\n\nend",
"def array_concat(array_1, array_2)\n\tcombined_array=Array.new\n\tcombined_array.push(array_1, array_2)\n\treturn combined_array.flatten\nend",
"def array_concat(array_1, array_2)\n\treturn [] if both_empty?(array_1, array_2)\n\treturn array_1 if two_empty?(array_1, array_2)\n\treturn array_2 if one_empty?(array_1, array_2)\n\tfor x in array_2[0..-1]\n\t\tarray_1 << x\n\tend\n\treturn array_1\nend",
"def array_concat(array_1, array_2)\n new_array = []\n new_index = 0\n index = 0\n\n while index < array_1.length\n \tnew_array[new_index] = array_1[index]\n \tindex += 1\n \tnew_index += 1\n end\n\n index = 0\n\n while index < array_2.length\n \tnew_array[new_index] = array_2[index]\n \tindex += 1\n \tnew_index += 1\n end\n return new_array\nend",
"def using_concat(array1,array2)\n array1.concat(array2)\nend",
"def using_concat(array1,array2)\n array1.concat(array2)\nend",
"def concat(array,array2)\n while array2.length > 0\n array << array2.delete_at(0)\n end\n return array\nend",
"def array_concat(array_1, array_2)\n array_1 + array_2\nend",
"def array_concat(array_1, array_2)\n combined_array = array_1 + array_2\n return combined_array\nend",
"def using_concat(array0, array1)\n array0.concat(array1)\nend",
"def array_concat(array_1, array_2)\n if array_1.length == 0 && array_2.length == 0\n return []\n else\n x = 1\n while x <= array_2.length\n array_2.each do |new_item|\n array_1.push(new_item)\n x += 1\n end\n end\n return array_1 \n end\nend",
"def array_concat(array_1, array_2)\n array_1 + array_2\nend",
"def concat(array1, array2)\n i = 0\n output = array1\n while i < array2.length\n output << array2[i]\n i += 1\n end\n return output\nend",
"def array_concat(array_1, array_2)\n array_1+array_2\nend",
"def using_concat(array_1,array_2)\n array_1.concat(array_2)\nend",
"def array_concat(array_1, array_2)\n\n combined_array = array_1 + array_2\n return combined_array\n\nend",
"def using_concat(array1, array2)\n array1.concat(array2)\nend",
"def using_concat (first_arr, second_arr)\n return first_arr.concat(second_arr)\nend",
"def using_concat(array1, array2)\n array1.concat(array2)\nend",
"def array_concat(array_1, array_2)\n new_array = []\n array_1.each do |item|\n \tnew_array.push(item)\n end\n array_2.each do |item|\n \tnew_array.push(item)\n end\n new_array\nend",
"def array_concat(array_1, array_2)\n return array_1 + array_2\nend",
"def array_concat(array_1, array_2)\n return array_1 + array_2\nend",
"def add_arrays(arr1,arr2)\n\tcount = 0\n\twhile count < arr1.length\n\t\tputs \"#{arr1[count]} + #{arr2[count]} = #{arr1[count] + arr2[count]}\"\n\t\tcount += 1\n\tend\nend",
"def merge_arrays(first, second)\n merged = []\n longest = first.length > second.length ? first : second\n\n longest.each_with_index do |_line, index|\n merged[index] = if first[index] || second[index]\n (first[index].to_i + second[index].to_i)\n end\n end\n\n merged\n end",
"def array_concat(array_1, array_2)\n # Your code here\n new_array = array_1.concat(array_2)\n return new_array\nend",
"def concat(arr1, arr2)\n output = arr1\n i = 0\n while i < arr2.length\n output << arr2[i]\n i += 1\n end\n return output\nend",
"def join_arrays array_one, array_two\n\t\tarray_one.shift\n\t\tarray_two.pop\n\t\tarray_one & array_two\n\tend",
"def join_arrays(arr1,arr2)\n arr1.concat(arr2)\nend",
"def array_concat(array_1, array_2) \nreturn array_1.concat array_2\nend",
"def array_concat1(array_1, array_2)\n # Your code here\n array_3 = []\n array_1.each do |number|\n \tarray_3 << number\n\tend\n\tarray_2.each do |new_number|\n\t\tarray_3 << new_number\n\tend\n\tputs array_3\nend",
"def array_concat(array_1, array_2)\n # Your code here\n # Initial solution\n=begin\n array_3 = []\n array_1.each do |n| \n array_3.push n\n end\n array_2.each do |m|\n array_3.push m\n end\n return array_3\nend\n=end\n # Refactored solution\n return array_1.concat array_2\nend",
"def array_concat(array_1, array_2)\n new_array = []\n array_1.each {|val| new_array.push (val)}\n array_2.each {|val| new_array.push (val)}\n new_array\nend",
"def sum_array(a1,a2)\n\t\ta3_0 = a1[0] + a2[0]\n\t\ta3_1 = a1[1] + a2[1]\n\t\treturn [a3_0, a3_1]\n end",
"def array_concat(array_1, array_2)\n # Your code here\n if ((array_1 == []) && (array_2 == []))\n \treturn []\n else\n \tarray_2.each do |element_2|\n \t\tarray_1.push(element_2)\n \tend\n end\n return array_1\nend",
"def custom_concat(arr1,arr2)\narr1 + arr2\nend",
"def array_concat(array_1, array_2)\n\tmethod = 4\n\tcase method\n\twhen 1\n\t\tarray_1 + array_2 # The easiest way\n\twhen 2\n\t\tarray_1.concat(array_2) # Another easy way\n\twhen 3 # a long way\n\t\tarray_new = []\n \t\tarray_1.each {|element| array_new[array_new.size] = element}\n \t\tarray_2.each {|element| array_new[array_new.size] = element}\n \t\treturn array_new\n \twhen 4 # Showing an array as a range in a for loop\n \t\tindex = 0\n \t\tarray_new = []\n \t\tfor element in array_1\n \t\t\tarray_new[index] = element\n \t\t\tindex += 1\n \t\tend\n \t\tfor element in array_2\n \t\t\tarray_new[index] = element\n \t\t\tindex += 1\n \t\tend\n \t\treturn array_new\n \tend\nend",
"def using_concat(arr_1, arr_2)\n arr_1.concat(arr_2)\nend",
"def concat(other_ary)\n other_ary = _ensure_array_is_valid other_ary\n super\n end",
"def array_1(array1)\n array1.shift\n array1.push(6)\n return array1\nend",
"def array_concat(array_1, array_2)\n # Your code here\n array_3=[]\n array_1.each{|element| array_3<<element}\n array_2.each{|element| array_3<<element}\n return array_3\nend",
"def merge(arr1, arr2)\n new_arr = arr1.merge(arr2)\nend",
"def array_concat(array_1, array_2)\n array_concat = array_1 + array_2\n puts array_concat\nend",
"def q4\n array1 = [\"dog\", \"cat\", \"fish\"]\n array2 = [\"bird\", \"bat\", \"tiger\"]\n\n p array1 + array2\nend",
"def array_concat(array_1, array_2)\n\n while array_2.length > 1\n array_1.push {array_2.each do |array_2.length| }\n\n return array_1\n end\n\nend",
"def array_concat(array_1, array_2)\n p array_1.concat array_2\nend",
"def array_concat(array_1, array_2)\n # Your code here\n return array_1.concat(array_2)\nend",
"def array_concat(array_1, array_2)\n concat_array = []\n array_1.each {|value| concat_array << value}\n array_2.each {|value| concat_array << value}\n concat_array\nend",
"def array_concat(array_1, array_2)\n # Your code here\n combined_array = []\n\n array_1.each { |i| \n combined_array.push(i)\n }\n\n array_2.each do |j| \n combined_array.push(j)\n end\n\n return combined_array\nend",
"def merge(other)\n append(*other)\n end",
"def merge_arrays (first, second)\n\nlarge_array = []\n\n 11.times do |i|\n smaller_array = []\n smaller_array << first[i]\n smaller_array << second[i]\n large_array << smaller_array\n end\n return large_array\n\nend",
"def array_concat(array_1, array_2)\n new_array = []\n array_1.each { |value| new_array << value }\n array_2.each { |value| new_array << value }\n return new_array\nend",
"def matrix_addition (arr1, arr2)\n new_arr = []\n arr1.each.with_index do|subarr1, idx1|\n new_sub = []\n subarr1.each.with_index do |num1, idx2|\n new_sub << arr1[idx1][idx2] + arr2[idx1][idx2]\n end\n new_arr << new_sub\n end\n\n new_arr\nend",
"def merge(arr1, arr2)\n new_arr = (arr1 + arr2).uniq\nend",
"def test_concat_arrays\n array = []\n array_one = [1,2,3,4,5]\n array_two = [6,7,8,9,10]\n array = array_one.concat(array_two)\n assert_equal [1,2,3,4,5,6,7,8,9,10], array\n end",
"def concat(another)\n case another\n when Array, ExternalArchive\n self[length, another.length] = another\n else \n raise TypeError.new(\"can't convert #{another.class} into ExternalArchive or Array\")\n end\n self\n end"
] | [
"0.76912",
"0.7652779",
"0.75134814",
"0.7469689",
"0.74564713",
"0.7365452",
"0.73516685",
"0.73151153",
"0.7289406",
"0.7261168",
"0.7248163",
"0.72362316",
"0.72358894",
"0.7233923",
"0.72325504",
"0.7226388",
"0.72243124",
"0.71952444",
"0.71671575",
"0.7158433",
"0.7156778",
"0.7144929",
"0.7140331",
"0.7134954",
"0.7132279",
"0.71261424",
"0.71144027",
"0.70821714",
"0.7079967",
"0.70619345",
"0.70619345",
"0.7061349",
"0.7034278",
"0.7032573",
"0.7024872",
"0.7020291",
"0.7011334",
"0.6999186",
"0.69917804",
"0.6958896",
"0.69506663",
"0.6947971",
"0.69340175",
"0.6928646",
"0.69226855",
"0.6919001",
"0.6896506",
"0.6881169",
"0.6879833",
"0.68744576",
"0.68744576",
"0.6868568",
"0.6843369",
"0.68334",
"0.68328613",
"0.6830995",
"0.68196565",
"0.68152606",
"0.6811508",
"0.68049604",
"0.68015695",
"0.67944306",
"0.6771582",
"0.6764162",
"0.67553943",
"0.6754231",
"0.6754231",
"0.6745183",
"0.6730597",
"0.67251456",
"0.6710926",
"0.6709849",
"0.67015463",
"0.6690611",
"0.6690391",
"0.6690126",
"0.66796136",
"0.6657862",
"0.6657047",
"0.6651709",
"0.6644845",
"0.66183525",
"0.6616643",
"0.6601035",
"0.65974236",
"0.6596476",
"0.65911126",
"0.65731823",
"0.6571095",
"0.6539942",
"0.6529559",
"0.65112215",
"0.6498017",
"0.6488972",
"0.6467452",
"0.64658964",
"0.64505535",
"0.6448402",
"0.6442167",
"0.6439178"
] | 0.70858574 | 27 |
adds the item to the 4th index of the array | def using_insert(array, element)
array.insert(4, element)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def using_insert(array, item)\n array.insert(4, item)\nend",
"def add_item(array, item)\n\tarray << item\nend",
"def index_arr_add(arr, index, element)\n # Add `element` at position `index` to the Array variable `arr` and return `arr`\n return arr.insert(index, element)\nend",
"def update_element_from_index(array, index_number, element)\nreturn array[index_number] = element\n\nend",
"def index_arr_add(arr, index, element)\n # Add `element` at position `index` to the Array \n # variable `arr` and return `arr`\n arr.insert(index, element)\n end",
"def using_insert(array,element)\n array.insert(4,element)\n end",
"def add_item(array, item)\n\tarray.push(item)\nend",
"def index_arr_multiple_add(arr, index)\n # add any two elements to the arr at the index\n return arr.push(index,arr)\n return arr.push(index,arr)\nend",
"def using_insert(array, element)\n array.insert(4, element)\n end",
"def add_to_back(item)\n @array << item\n end",
"def add_item(item)\r\n \t@arr.push(item)\r\n end",
"def add_to_array(array, item)\n array << item\nend",
"def using_insert (array, element)\n return array.insert(4, element)\nend",
"def add_to_array(array, item)\n\tarray += [item]\n\tp array\nend",
"def using_insert(array, element)\n array = array.insert(4, element)\n\n \nend",
"def add_at_index(index, val)\n \n end",
"def three(array)\n array.sort!.shift\n array << 6\nend",
"def add item\n self[index item] = item if check item\n# check item ? super : free key # delete key\n end",
"def using_insert(array, element)\n \n array.insert(4, element)\n \nend",
"def add_value(item)\n array.push(item)\n end",
"def add_element_to_beginning_of_array(array, element)\n array.insert(0, element)\nend",
"def using_insert(array, element)\n array.insert(4,element)\nend",
"def add_element_to_end_of_array(array, element)\n array << element \nend",
"def add_to_array!(array, item)\n array << item\nend",
"def add_element_to_beginning_of_array(array, element)\n\tn = [2, 3, 4, 5]\n\tn.unshift(1)\nend",
"def using_insert(array, i)\n array.insert(4, i)\nend",
"def using_insert(array,element)\n array.insert(4,element)\nend",
"def one(array)\n array.shift\n array << 6\nend",
"def add(item)\n # TODO\n # - add item to @array. resize if load exceeds threshold\n # - handle edge cases:\n # - @array has size 0.\n # - @array is full\n\n @array[@tail] = item\n @tail = @tail + 1\n\n end",
"def insert(index, element)\n oob_throw(index)\n if index == 0\n @array = [element] + @array[index + 1..-1]\n else\n @array = @array[0..index-1] + [element] + @array[index..-1]\n end\n end",
"def add_element_to_end_of_array(array, element)\n array << element\nend",
"def add(element)\n temp_list = array_list\n @array_list = FixedArray.new(length + 1)\n (length - 1).times do |index|\n @array_list.set(index, temp_list.get(index))\n end\n @array_list.set(length - 1, element)\n end",
"def add_item(elective_array, item)\n elective_array.push(item)\n puts elective_array\nend",
"def add_element_to_beginning_of_array(array,element)\n array.unshift(element)\nend",
"def add_element_to_start_of_array( array, element)\n return array.unshift(element)\nend",
"def my_array_modification_method!(array, num)\n array[2] = array[2] + num\n array[-1] = array[-1] + num\n array\nend",
"def add_item(list,new_item,item_count)\n\tlist[new_item] = item_count\nend",
"def add_element_to_start_of_array(array, element)\n array.unshift(element) \nend",
"def add_s(arry)\n arry.map! do |item|\n item = item + \"s\"\n# arry[1] >> arry[1].slice(0..-2)\n\n end\n arry[1]=arry[1].slice(0..-2)\n arry\nend",
"def add_item(glist, item, count=1)\n\tglist[item] = 1\n\treturn glist\nend",
"def add_element_to_beginning_of_array(array, element)\n array.unshift(element)\nend",
"def add_item!(list, item, qty=1)\r\n list[item] = qty\r\n list\r\nend",
"def add_element_to_beginning_of_array(array, element)\n array.unshift(element)\nend",
"def add_item(list, new_item, qty=1)\n list[new_item] = qty\nend",
"def add_element_to_start_of_array(array, element)\n array.unshift(element)\nend",
"def push(item)\n raise StackOverflow if full?\n @info[@index] = item\n @index += 1\n self\n end",
"def add_item(input_item, list, input_number=5)\n list[input_item] = input_number\n return list\nend",
"def add_sorted item\r\n # adds the item to the back of the array \r\n # array length increases by 1, index of item is length - 1\r\n @all_donations << item\r\n # selects the index before the index of item (length - 1)\r\n # previously largest value in array was length - 2\r\n index = @all_donations.length - 2\r\n # while the value of the data in front of item is greater\r\n # and we have not hit the front bound of the array\r\n # replace the largest value with the smaller one and move forward\r\n while @all_donations[index] > item && index >= 0 do\r\n @all_donations[index + 1] = @all_donations[index]\r\n index -= 1\r\n end \r\n # set the value of the properly indexed position to item\r\n @all_donations[index + 1] = item\r\n end",
"def using_insert(arr, elem)\n arr.insert(4, elem)\nend",
"def insert_element_at_given_index(array, index, element)\n array.insert(index, element)\nend",
"def add_ay(array)\n array.push(\"ay\")\nend",
"def add_item(list, item, qty = 1)\n list[item] = qty\n return list\nend",
"def push_to_array_jeff(original_array, new_item)\n # I think this is my best\n\n # make new_array that's one item longer than original\n original_length = original_array.length\n new_array = [nil] * (original_length + 1)\n # add all original items to new_array\n original_array.each_with_index do |val, idx|\n new_array[idx] = val\n end \n # make new_item the last element of new_array\n new_array[original_length] = new_item\n return new_array\nend",
"def add_item(list, new_item, quantity=1)\n list[new_item] = quantity \nend",
"def at( index )\r\n @ary.at(index + @offset)\r\n end",
"def add_item(list, item, qty = 1)\n list[item] = qty\n\n list\nend",
"def update_array_at_with (array, i, char)\n array[i] = X\nend",
"def insert_(array, item, index)\n array = array.insert(index, item)\n puts array\n return array\n \nend",
"def at(index)\n \t@array[index]\n end",
"def add_at_index(index, val)\n return if index > @list.size \n @list.insert(index, val)\n end",
"def add_to_ary_modified(ary,elt)\n\tary << elt\n\tputs \"#{elt} is now in your array.\"\n\tary\nend",
"def add_to_end(arr, element)\n arr.push(element)\nend",
"def array_1(array1)\n array1.shift\n array1.push(6)\n return array1\nend",
"def add_item(list,item,quantity=1)\r\n list[item] = quantity\r\n list\r\nend",
"def append(item, data = nil)\n super(item)\n __wx_item_data[count - 1] = data\n end",
"def insert(item)\n\t\t\n\t\tif self.size == @capacity\n\t\t\t@a.pop\n\t\tend\n\t\t@a.push item\n\tend",
"def add_to_list(list, item, quantity = 1)\n\tlist[item] = quantity\nend",
"def add_rutabaga_to_array(an_array_param)\n an_array_param << \"rutabaga\"\nend",
"def add_to_index(item)\n @content << '\\index{' + (item) + '}'\n end",
"def add_new_gift(gifts_array, new_gift)\r\n gifts_array << new_gift\r\nend",
"def add_item(list, item, quantity = 1)\r\n list[item] = quantity\r\nend",
"def pack(item, index); end",
"def replace_index!(arr, i,array)\n arr.replace( (arr[0, i] || []) + array + arr[i + 1 .. -1] )\n end",
"def add_item_to_list(*p)\r\n if p.length==2 then\r\n p[0][p[1]]=1\r\n elsif p.length==3 then\r\n p[0][p[1]]=p[2]\r\n end\r\n print_list(p[0])\r\nend",
"def add_item(grcy_list, string, i=1)\n grcy_list[string] = i\nend",
"def add_item(list, item, quantity)\n #list = item.push\n list[item] = quantity.to_i\n list\nend",
"def add_item(list,item,quantity=1)\n list[item] = quantity\nend",
"def add_item(list,item,quantity=1)\n list[item] = quantity\nend",
"def item; @data[@index]; end",
"def add_item(list, item, quantity = 1)\n list[item] = quantity\n list\nend",
"def add_item(list, item, quantity=1)\n list[item] = quantity\nend",
"def add_item(list, item, quantity=0)\n list[item] = quantity\n list\nend",
"def begin_arr_add(arr, element)\n # Add `element` to the beginning of the Array \n # variable `arr` and return `arr`\n arr.unshift(element)\n end",
"def []=(index, element); end",
"def add_item(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend",
"def add_item (list, item, qty)\n list[item]=qty\nend",
"def my_array_modification_method!(source, thing_to_modify)\n first_integer = []\n first_integer.push(i_want_pets[2])\n i_want_pets.delete_at(2)\n i_want_pets.insert(2, (first_integer.join.to_i + thing_to_modify) )\n\n second_integer = []\n second_integer.push(i_want_pets[7])\n i_want_pets.delete_at(7)\n i_want_pets.push(second_integer.join.to_i + thing_to_modify)\n\nend",
"def []=(index, new_payload)\n item = @first_item\n index.times do\n item = item.next_list_item\n end\n item.payload = new_payload\n end",
"def item(i)\n @parts.push(take: i)\n end",
"def test_insert_negative_index_append\n assert_equal([\"a\",\"b\",\"c\",7,8,9], @array.insert(-1, 7, 8, 9))\n end",
"def add_to_list(list, item, quantity = 1)\n list[item] = quantity\n p list\nend",
"def [](index)\n @items[index - 1]\n end",
"def [](index)\n @items[index - 1]\n end",
"def add_item(current_list, item_added, quantity)\n current_list[item_added] = quantity\n current_list\nend",
"def move( array, index, value=\"X\" )\n array[index] = value\nend",
"def reappend_el(index)\n element = @cache.slice!(index)\n @cache << element\n end"
] | [
"0.69418097",
"0.6788948",
"0.6742472",
"0.67088306",
"0.6707434",
"0.66805154",
"0.66803867",
"0.66455716",
"0.663238",
"0.65624106",
"0.6540289",
"0.65217257",
"0.65185714",
"0.6514281",
"0.6502582",
"0.65024966",
"0.64935154",
"0.6487453",
"0.6467238",
"0.6467036",
"0.64568496",
"0.64447874",
"0.64412063",
"0.642926",
"0.6425895",
"0.6415351",
"0.6402432",
"0.6393187",
"0.6340883",
"0.63380116",
"0.6329701",
"0.63294834",
"0.6249644",
"0.62482816",
"0.62386864",
"0.6238001",
"0.62332904",
"0.622645",
"0.62161696",
"0.6180319",
"0.6174263",
"0.6173633",
"0.6168458",
"0.6149244",
"0.61396605",
"0.61391723",
"0.61275524",
"0.61225957",
"0.6117217",
"0.61062783",
"0.6082087",
"0.6072644",
"0.60464495",
"0.6034161",
"0.60315484",
"0.6025078",
"0.6008176",
"0.60019267",
"0.5976329",
"0.59762996",
"0.5971774",
"0.5966313",
"0.59585595",
"0.5950357",
"0.59427965",
"0.59350836",
"0.59259015",
"0.59248596",
"0.5920875",
"0.5916508",
"0.5911122",
"0.58984053",
"0.5898018",
"0.5885312",
"0.5884745",
"0.5883558",
"0.58689606",
"0.58689606",
"0.58636343",
"0.58537453",
"0.58504665",
"0.5846",
"0.5837926",
"0.5833395",
"0.5829792",
"0.5828034",
"0.58245724",
"0.5824458",
"0.5818389",
"0.5798497",
"0.5798418",
"0.5795666",
"0.5795666",
"0.5794077",
"0.5787023",
"0.5784667"
] | 0.6486821 | 21 |
removes any duplicate items | def using_uniq(array)
array.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_duplicates\n return @remove_duplicates if @set_remove_duplicates\n @remove_duplicates ||= true\n end",
"def remove_duplicates()\n self.duplicate_transactions_by_actor().each do |a, txns|\n # Spaceship operator, if my actor is of greater value than theirs, skip because they should remove the dupe\n next if (self.actor <=> a) == 1\n txns.each do |txn|\n self.counts[self.actor][\"txns\"].delete(txn)\n end\n end\n end",
"def dedup(match_section: true)\n unique = Items.new\n each do |item|\n unique.push(item) unless unique.include?(item, match_section: match_section)\n end\n\n unique\n end",
"def rem_dup(list)\n list.uniq!\n return list\nend",
"def remove_duplicates(list)\n d = list.clone\n dups = find_duplicates(list).each_with_object([]) { |(k, v), a| a << k if v > 1 }\n dups.each { |i| d.delete(i) }\n d\nend",
"def clean_up_dupes(dupes, output)\n unless dupes.empty?\n dupes.uniq.each do |sequence|\n output.delete sequence\n end\n end\n\n output\n end",
"def removeDupe(linkedlist)\n return linkedlist.uniq!\nend",
"def without_duplicates(bindings); end",
"def removeDup(list)\n hash = {}\n count = list.count\n i = 0\n while i < count\n key = list[i].key\n if hash[key]\n list.remove_pos(i)\n i = i-1\n count = count-1\n else\n hash[key] = true\n end\n i = i+1\n end\nend",
"def delete_duplicates(el)\n location = @cache.index(el)\n @cache.delete_at(location) if location\n end",
"def drop_duplicated_records(pois, poi)\n\tpois.each do |xx|\n\t\txx.destroy if xx.ref == poi.ref && (!xx.lat || !xx.lng)\n\tend\nend",
"def prune\n @set.clear\n end",
"def remove_duplicates_2(list)\n seen = {}\n to_delete = []\n\n list.each do |node|\n if seen[node.value]\n to_delete << node\n end\n seen[node.value] = true\n end\n\n to_delete.each do |node|\n list.delete_node(node)\n end\n\n return list\nend",
"def delete!\n uniq.both_e.uniq.bulk_job { |e| e.delete! }\n uniq.bulk_job { |e| e.delete! }\n end",
"def uniq() end",
"def clean_cache_collection collection # :nodoc:\n collection.each do |name, item|\n if item.empty? then\n collection.delete name\n else\n # HACK mongrel-1.1.5 documents its files twice\n item.uniq!\n item.sort!\n end\n end\n end",
"def remove_all()\n @items.clear()\n end",
"def remove_duplicates(array)\nend",
"def remove_duplicate_matches(matches)\r\n # Sort the items.\r\n # Sort the array without matches[0], since we need it to\r\n # stay in place no matter what.\r\n if matches.length>0\r\n matches[1..-2] = matches[1..-2].sort.uniq\r\n end\r\n matches\r\n end",
"def remove_duplicates(cart:[])\n cart.uniq\nend",
"def direct_duplicates\n\t\tself.class.unscope.where(archetype: self)\n\tend",
"def uniq!() end",
"def non_duplicated_values(values)\n values.find_all do |e|\n if values.count(e) > 1\n values.delete(e)\n end\n end\n values\nend",
"def unique(mylist)\r\n\r\n counts = Hash.new(0)\r\n\r\n mylist.each { |item|\r\n # if item is Not in the hash\r\n puts \"looking in hash for #{item}\"\r\n if counts[item] == 0\r\n puts \"#{item} is not in hash. Adding it!\"\r\n counts[item] = 1\r\n end\r\n # counts[item] +=1\r\n # puts counts\r\n # if counts[item] > 1\r\n # end\r\n}\r\n\r\n # if element you are testing is the same\r\n # remove the element you are testing\r\n # else redo the loop\r\n \r\nend",
"def remove_duplicates(list)\n list.each do |unique_node|\n if unique_node.next\n unique_node.next.each do |possible_duplicate|\n if possible_duplicate.value == unique_node.value\n list.delete_node(possible_duplicate)\n end\n end\n end\n end\n\n return list\nend",
"def remove_duplicate(head)\n existing = [head.data]\n current = head\n while current.next_item != nil do\n if existing.include?(current.next_item.data)\n if current.next_item.next_item\n current.next_item = current.next_item.next_item\n else\n current.next_item = nil\n break\n end\n else\n existing << current.data\n end\n\n current = current.next_item\n end\n\n head\nend",
"def remove_duplicates(list)\n list.inject({}){ |ele, n| ele[n] = nil; ele }.keys\nend",
"def test_removes_duplicates\n stream = FromArray.new([2, 2, 3, 4, 1, 1, 2, 5, 4, 3, 6])\n collected = stream.distinct.collect\n assert(collected == collected.uniq)\n assert(collected.length == collected.uniq.length)\n end",
"def remove_dupes list\n cur = list.head\n i = 0\n while cur != nil\n list.remove i\n if !contains(list, cur.node)\n list.insert cur.node, i\n i += 1\n end\n cur = cur.nxt\n end\n\n return list\nend",
"def remove_duplicates(list)\n if list.length < 2\n return list\n else\n i = 0\n list.each do |num|\n if num == list[(i+1)]\n list.delete_at(i)\n end\n i += 1\n end\n return list\n end\nend",
"def clear\n @seen.clear\n return self\n end",
"def list_remove(hash_items, item_name)\n hash_items.delete(item_name)\n return hash_items\nend",
"def dupitems(arr)\n puts arr.reject { |e| arr.rindex(e) == arr.index(e) }.uniq\nend",
"def uniq_by\n clean = []\n self.collect{|x| yield(x)}.uniq.each do |x|\n clean << self.select{|y| yield(y) == x}.last\n end\n clean\n end",
"def remove_duplicate_entries\n File.open(\"#{output_directory_path}unique_ucf_lists.txt\", \"w+\") { |file|\n file.puts File.readlines(single_bad_ucf_file).uniq\n }\n end",
"def remove_dupes(affix = [])\n affix.delete_if do |page|\n range_first.include?(page) || range_second.include?(page)\n end\n end",
"def deleteItems\n self.items.each do |item|\n item.delete\n end\n end",
"def remove(item)\n # TODO\n # - removes first occurence of `item` in list.\n # - uses '==', so beware if expecting eql? or equals? logic instead\n # - shifts element in array to fill in spot\n\n (0...@array.size).each do |i|\n if @array[i] == item\n @array[i] = nil\n\n # TODO\n # - consider resizing array if load is under some threshold (maybe 0.25?)\n\n shift_elements\n break\n end\n end\n\n end",
"def indexed_list_delete_single(indexed_list)\n indexed_list.delete_if{|key, filename_arr|\n filename_arr.size == 1\n }\nend",
"def destroy_duplicates!(duplicant = self.duplicant())\n\t\t\tns()::Fieldlet.filter(:instance_id => self.instance_id(), \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t:entity_id => duplicant[:id]).delete\n\t\tend",
"def purge\n @items.delete_if(&:is_done) \n end",
"def remove_duplicates(list)\n length = list.length\n i = 0\n while i < length - 1\n if list[i] == list[i + 1]\n list.delete_at(i + 1)\n end \n i += 1\n end \n return list \nend",
"def non_duplicated_values(values)\n duplicates = values.find_all { |item| values.count(item) > 1 }.uniq\n duplicates.each do |item|\n values.delete(item)\n end\n return values\nend",
"def remove_item(list,item)\r\n list.delete_if {|key,value| key == item}\r\n list\r\nend",
"def remove\n @instantiations.dup.each(&:remove)\n @instantiations[0..-1] = []\n true\n end",
"def delete_item(name)\n previous = items.size\n items.reject! { |item| item.name == name}\n previous != items.size\n end",
"def eliminar_duplicados(lista)\n if lista.instance_of?(Array)\n return lista.uniq\n end\n end",
"def remove_item!(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def nondupes(array)\n new_array = []\n array.each do |elem| \n if array.count(elem) == 1\n new_array << elem \n end\n end\n new_array\nend",
"def eliminate_duplicate_parent_child_additions!\n parents_to_add.uniq!\n children_to_add.uniq!\n parents_to_remove.uniq!\n children_to_remove.uniq!\n end",
"def remove_item(item, hash)\n hash.delete(item)\n return hash\nend",
"def remove_dup(linked)\n dups = Set.new\n remove = []\n copy = linked\n while (copy != nil)\n if dups.include? copy.data\n remove << copy.data\n else\n dups.add copy.data\n end\n copy = copy.next\n end\n p remove\n i = 0\n while i < remove.size do\n linked = linked.delete(remove[i])\n i += 1\n end\n return linked\nend",
"def prune_subscriptions\n exisiting_subscription_ids = Spree::Subscription.where(order: self).pluck :id\n needed_ids = self.line_items.pluck(:subscription_id).uniq\n to_delete = exisiting_subscription_ids - needed_ids\n\n # kaboom!\n Spree::Subscription.where(id: to_delete).destroy_all\n end",
"def prune(items)\n wants = []\n # owners = []\n items.each do |item|\n # owners << item.user\n item.user.wants.each do |want|\n if want.possession.trade_id == self.id\n wants << want.possession\n end\n end\n end\n # wants = []\n # owners.each do |owner|\n # owner.wants.each do |want|\n # if want.possession.trade_id == self.id\n # wants << want.possession\n # end\n # end\n # end\n items.each do |item|\n if !wants.include?(item)\n items.delete(item)\n end\n end\n items\n end",
"def remove_duplicates(list)\n list & list # list | list would work too\nend",
"def my_uniq\n unique = []\n self.each do |ele|\n unique << ele if !unique.include?(ele)\n end\n unique\n end",
"def remove_item(hash_of_items, item)\n hash_of_items.delete(item)\n hash_of_items\nend",
"def uniq\n end",
"def uniq\n end",
"def delete!\n uniq.bulk_job { |e| e.delete! }\n end",
"def remove_dups(arr)\n\treturn arr.uniq()\nend",
"def remove_item(list, item)\n\t# if list.keys.include?(item)\n\t# \tlist.delete(item)\n\t# end\n\t# list.delete(item) if list.keys.include?(item)\n\tlist.delete_if { |key, value| key == item } \n\t# Destructive method\n\tp list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def deduplicate(records:)\n return [] unless records.present? && records.is_a?(Array)\n\n out = []\n found = []\n records.each do |rec|\n next if found.include?(rec[:sort_name]) || found.include?(rec[:id])\n\n found << rec[:sort_name]\n found << rec[:id] if rec[:id].present?\n out << rec\n end\n out\n end",
"def dedup_brands\n $data.map {|iso| iso[\"brand\"]}.uniq\nend",
"def delete(item)\n fingerprint = fingerprint(item)\n first_index = hash(item)\n second_index = alt_index(first_index, fingerprint)\n\n if @buckets[first_index].remove(fingerprint) || @buckets[second_index].remove(fingerprint)\n decrement_filled_count\n return true\n end\n\n false\n end",
"def non_duplicated_values(values)\n values.each do |x|\n values.delete(x) if values.count(x) == 2\n end\nend",
"def uniq\n dup.uniq! or dup\n end",
"def remove_duplicate_app_sessions(app_sessions)\n duplicates = app_sessions.group_by{|model| [model.timestamp_start,model.timestamp_end] }\n removed_usages = 0\n removed_sessions = 0\n duplicates.values.each do |duplicate|\n first_one = duplicate.shift\n # puts first_one.inspect\n # puts \"Behalte #{first_one.id}\"\n duplicate.each do|double|\n # puts double.inspect\n removed_sessions += 1\n apps = AppUsage.where(app_session_id: double.id)\n # puts \"Lösche #{double.id}\"\n removed_usages += apps.count\n double.destroy\n end\n end\n # puts \"#{removed_sessions} Sessions gelöscht\"\n # puts \"#{removed_usages} Apps gelöscht\"\n end",
"def remove_duplicates!\n \t\t# current will move forward 1 each step\n \t\tcurrent = @head\n\n \t\t# prev will hold on to the last non-duplicate node\n \t\tprev = @head\n\n \t\twhile (current.next_node)\n \t\t\t# if we find a new value...\n \t\t\tif prev.val != current.val\n \t\t\t\t# add this current node to our non-duplicate list\n \t\t\t\tprev.next_node = current\n \t\t\t\t# update prev to store this most recent non-duplciate node\n \t\t\t\tprev = current\n \t\t\tend\n \t\t\t\n \t\t\t# always advance current\n \t\t\tcurrent = current.next_node\n \t\tend\n \t\t# finally, add tail value if it's unique\n \t\tif prev.val != current.val\n\t\t\t# add this current node to our non-duplicate list\n\t\t\tprev.next_node = current\n\t\t\t@tail = current\n\t\telse\n\t\t\tprev.next_node = nil\n\t\t\t@tail = prev\n\t\tend\n \tend",
"def remove_dup(a,b)\n b.each {|e| a.delete_at(a.index(e)) unless a.index(e).nil?}\n a\nend",
"def remove_from_list(item_to_rmv)\n item_to_rmv.to_str\n updated_list = Hash.new\n updated_list = $old_list.to_h\n #updated_list.delete_if {|key, value| key == item_to_rmv}\n if updated_list.include?(item_to_rmv) == true \n #p \"test\"\n #p item_to_rmv\n #p $old_list\n p updated_list.delete(item_to_rmv)\n p updated_list.each {|key, val| p key, val}\n #p updated_list\n else \n p \"that item isn't on the list\"\n end\n #if $old_list.to_h.include?(item_to_rmv) == true\n # updated_list.delete(item_to_rmv)\n # updated_list = $old_list.to_h\n #else\n # p \"that item isn't on the list\"\n #end\n \n \nend",
"def remove_item (item,list)\nlist.delete(item)\nlist\nend",
"def remove_item(item_list, item)\r\n item_list.delete(item)\r\n item_list\r\nend",
"def remove_unwanted_duplicates word_pairs\n all_sequences = word_pairs.map{ |pair| pair.first }\n\n duplicate_seqs = identify_duplicate_sequences all_sequences\n\n word_pairs.reject do |seq, original|\n duplicate_seqs.include? seq\n end\n end",
"def eliminate_duplicates\n match_reduce(\n ->((_, rhs1_s), (_, rhs2_s)) { rhs1_s == rhs2_s },\n ->(lhs1, lhs2, _) { @cfg.replace! lhs2, lhs1 }\n )\n end",
"def grouped_duplicates(collection)\n collection.group_by { |item| item }.values.reject(&:one?)\n end",
"def remove_item(list, item)\n list_hash = list\n if list_hash.keys.include?(item)\n list_hash.delete(item)\n end\n return list_hash\nend",
"def remove_dups(arr)\n new_arr = []\n arr.each do |x|\n unless new_arr.include? x\n new_arr.push x\n end\n end\n new_arr\nend",
"def remove_item(list, item)\n # list.delete_if do |grocery_item, qty|\n # grocery_item == item\n # end\n list.delete(item)\n\n list\nend",
"def remove_item(list, item_name)\r\n # list.delete_if { |item, amount| item == item_name }\r\n list.delete(item_name)\r\nend",
"def unique\n lambda do |rec, acc|\n acc.uniq!\n end\n end",
"def grouped_duplicates(collection); end",
"def remove_from_combos\n # Get all the combos associated with this trick\n self.combos.uniq.each do |combo|\n # Get the number of times the trick appears in this combo\n # and subtract from total num of tricks\n no_tricks = combo.no_tricks\n no_duplicates = combo.tricks.where(:name => @trick.name).length\n combo.no_tricks = no_tricks - no_duplicates\n \n # If a combo ends up with less than 2 tricks, delete it\n if (combo.no_tricks < 2)\n combo.destroy\n else\n # Update the indexes of the remaining tricks in the combo\n index = 1\n combo.elements.each do |elem|\n if elem.trick.name != self.name\n elem.index = index\n elem.save\n index += 1\n else\n elem.delete\n end\n end\n end\n combo.cache_sequence\n end\n end",
"def unchosen\n the_set = []\n self.itemlist.each { |k,v| the_set << self.object(k).unchosen }\n the_set\n end",
"def purge!\n unless self.ordered?\n self.line_items.each do |line_item|\n remove_line_item(line_item) if line_item.invalid?\n end\n end\n end",
"def clean!\n for duplicate in duplicates.map{|duplicate| duplicate[0]}\n @commands.delete_if{ |i| i[0] == duplicate}\n @commands << [duplicate, ENV[duplicate]]\n end\n end",
"def query_by_duplicates\n tmp = self.clone\n tmp.list = list.select {|k,v| v.filename.count > 1}\n end",
"def remove_item(hash, item)\r\n grocery_list=hash\r\n if grocery_list.include?item\r\n grocery_list.delete(item)\r\n else\r\n puts \"Item not in list.\"\r\n end\r\n p grocery_list\r\nend",
"def clear_unique_from_redis\n redis = Redis.new\n keys = redis.scan(0, :match => \"unique*\").last\n redis.del(keys) if !keys.empty?\n end",
"def remove\n return @exact.shift unless @exact.empty?\n @list.shift\n end",
"def remove_item(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_duplicates(all_books, priority_list)\n array_without_dups = all_books - priority_list\n array_without_dups\n end",
"def one_week_wonders(songs)\n songs.each_with_index do |el, index|\n if el == songs[index + 1]\n songs.delete(el)\n end\n end\n songs.uniq\nend",
"def remove_item(item_to_remove)\n $list_hash.delete_if{|current_item, quantity|item_to_remove==current_item} #goes through entire item in delete if hash if item in hash delete from hash\nend",
"def find_unique_elements(arr)\n# Count how many times each element appears in the array, if an element appears\n# more than once, delete that element and any elements that are equal to it.\n \n arr.each do |i|\n\tif arr.count(i) > 1\n\t\tarr.delete(i)\n\tend\n end\n return arr\nend",
"def dedup_pure_rec\n return if @misc[:by_rmid].size < 2\t# Dups not possible for 0 or 1 rmids\n\n rmids = {}\n is_preferred_rmids = {}\n @misc[:by_rmid].each{|rmid,values|\n uuid = values[:pure_rec_ids][:uuid]\n rmids[uuid] ||= []\n rmids[uuid] << rmid\n\n is_preferred_rmids[uuid] ||= []\n is_preferred_rmids[uuid] << (rmid == values[:pure_rec_ids][:externalId])\n }\n return if rmids.all?{|uuid,id_list| id_list.size < 2}\t# 1 rmid for each uuid\n\n # At least 1 record (uuid) needs to be deduped by discarding some rmids.\n is_preferred_rmids.each{|uuid,is_prefs|\n i = is_prefs.find_index{|is_pref| is_pref}\n rmid_keep = i ? rmids[uuid][i] : rmids[uuid][0]\n rmids_to_del = rmids[uuid] - [rmid_keep]\n STDERR.puts \"INFO: For uuid #{uuid} & rmid #{rmid_keep}; deleting matching-rmids #{rmids_to_del.inspect}\"\n rmids_to_del.each{|id| @misc[:by_rmid].delete(id)}\n }\n end",
"def remove_duplicate_imports\n files.each(&:remove_duplicate_imports)\n end",
"def clear\n @excluded = Set.new\n end",
"def remove(entry); end",
"def remove_item(list, item)\n list.delete(item)\n list\nend"
] | [
"0.73704195",
"0.7098819",
"0.6927093",
"0.6903166",
"0.6793666",
"0.67628163",
"0.6742184",
"0.6724654",
"0.6691295",
"0.6676369",
"0.6668123",
"0.66613764",
"0.66546863",
"0.66425705",
"0.65930635",
"0.6578563",
"0.6549495",
"0.64949054",
"0.6493671",
"0.64762974",
"0.64699864",
"0.6444118",
"0.6437135",
"0.64335734",
"0.63959485",
"0.638791",
"0.6352034",
"0.6319808",
"0.6316974",
"0.6307857",
"0.63077146",
"0.6306047",
"0.6305345",
"0.6304136",
"0.6291225",
"0.6290111",
"0.62719697",
"0.62672156",
"0.62659657",
"0.6243244",
"0.62361634",
"0.62169397",
"0.6197089",
"0.6193597",
"0.6178499",
"0.61756116",
"0.6174785",
"0.6168316",
"0.61657333",
"0.61611855",
"0.61601853",
"0.61572057",
"0.61543494",
"0.6148837",
"0.61428",
"0.6141254",
"0.6140443",
"0.6132033",
"0.6132033",
"0.61302876",
"0.61288685",
"0.6127747",
"0.612244",
"0.6119235",
"0.6117657",
"0.6116872",
"0.61155134",
"0.61142534",
"0.6105379",
"0.610427",
"0.61014557",
"0.6099909",
"0.6097363",
"0.6096644",
"0.6095911",
"0.60929537",
"0.60890484",
"0.6087128",
"0.6084492",
"0.6083621",
"0.60762",
"0.607598",
"0.6067172",
"0.6060614",
"0.60578084",
"0.60575014",
"0.60551983",
"0.60493183",
"0.60466063",
"0.60352314",
"0.6028632",
"0.60283864",
"0.60281956",
"0.60236216",
"0.60203636",
"0.6015766",
"0.60149187",
"0.60112107",
"0.599568",
"0.5993335",
"0.59905046"
] | 0.0 | -1 |
returns a new array that is a onedimensional flattening of self | def using_flatten(array)
array.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten\n\t\tmake_flat(@array)\n\tend",
"def my_flatten\n arr = []\n i = 0\n while i < self.length\n if self[i].is_a? Array\n arr += self[i].my_flatten\n else\n arr << self[i]\n end\n i += 1\n end\n return arr\n end",
"def my_flatten\n flattened = []\n self.my_each do |el|\n el.is_a?(Array) ? flattened.concat(el.my_flatten) : flattened << el\n end\n flattened\n end",
"def my_flatten\n # return self unless self.is_a?(Array)\n new_arr = []\n self.each do |el|\n if el.is_a?(Array)\n new_arr += el.my_flatten\n else\n new_arr << el\n end\n end\n new_arr\n end",
"def flatten!\n\t\t@array = make_flat(@array)\n\tend",
"def flatten() end",
"def flatten!() end",
"def my_flatten\n flattened = []\n self.my_each do |el|\n if el.is_a? Array\n flattened += el.my_flatten\n else\n flattened << el\n end\n end\n flattened\n end",
"def my_flatten\n flattened = []\n self.my_each do |el|\n el.is_a?(Array) ? flattened += el.my_flatten : flattened << el\n end\n flattened\n end",
"def to_flat_array\n ary = Array.new(self.size)\n self.each.with_index { |v,i| ary[i] = v }\n ary\n end",
"def flatten\n dup\n end",
"def flatten(*args)\n new_array = []\n self.each do |v|\n if v.is_a?(Array)\n new_array.push( *(v.flatten(*args)) )\n else\n new_array << v\n end\n end\n new_array\n end",
"def flatten\n self.class.new.flatten_merge(self)\n end",
"def flatten\n self.class.new.flatten_merge(self)\n end",
"def applying_flatten array_value\n return array_value.flatten!\n end",
"def flatten\n a=[]\n self.deep_each {|f| a << f}\n a\n end",
"def using_flatten(array)\n array.flatten\n end",
"def my_flatten\n flattened_array = []\n each do |item|\n if item.class != Array\n flattened_array << item\n else\n #recursevly call my flatten\n item.my_flatten.each { |sub_item| flattened_array << sub_item }\n end\n end\n flattened_array\n end",
"def flatten!\n self.replace(flatten)\n end",
"def using_flatten(array)\n array.flatten()\nend",
"def flatten(array)\n array.flatten(1)\nend",
"def flatten(array)\n array.flatten(1)\nend",
"def my_flatten(final_arr = []) \n self.my_each do |el|\n debugger\n if el.class == Integer\n final_arr << el\n else\n el.my_flatten(final_arr)\n end\n end\n result\n end",
"def using_flatten (array)\n return array.flatten!\nend",
"def flatten(array)\n new_array = []\n array.each do |x|\n if x.class == Array\n x.each {|y| new_array.push(y)}\n else\n new_array.push(x)\n end\n end\n new_array\nend",
"def using_flatten(array)\n \n array.flatten\n \nend",
"def flat(a)\n\tnew_arr = []\n\ta.each do |el|\n\t\tif el.is_a? Array\n\t\t\tel.each do |n|\n\t\t\t\tif el.is_a? Array\n\t\t\t\t\ta << n\n\t\t\t\telse\n\t\t\t\t\tnew_arr << n\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tnew_arr << el\t\n\t\tend\n\tend\n\tp new_arr\nend",
"def flatten_grid\n height = grid.row_size\n width = grid.column_size\n for i in 0...height\n for j in 0...width\n @grid[i,j].flatten!\n end\n end\n end",
"def using_flatten(array)\n array.flatten\nend",
"def using_flatten(array)\n array.flatten\nend",
"def my_controlled_flatten(n)\n return self if n == 0\n new_arr = []\n self.each do |el|\n if el.is_a? (Array)\n new_arr += el.my_controlled_flatten(n-1)\n else\n new_arr << el\n end\n end\n new_arr\n end",
"def using_flatten(array)\n array.flatten\n \nend",
"def my_controlled_flatten(n)\n flattened = []\n self.my_each do |el|\n if n > 0 && el.is_a?(Array)\n flattened += el.my_controlled_flatten(n - 1)\n else\n flattened << el\n end\n end\n flattened\n end",
"def one_line_flatten(array, ret = [])\n array.each { |x| x.is_a?(Array) ? one_line_flatten(x, ret) : ret << x }; ret\nend",
"def flatten_array(arr)\n arr.flatten\nend",
"def my_controlled_flatten(n)\n flattened = []\n\n self.each do |el|\n depth = 0\n if el.is_a?(Array)\n depth += 1\n flattened += el.my_flatten\n else\n flattened << el\n end\n end\n flattened\n end",
"def my_controlled_flatten(n)\n return self if n < 1\n new_arr = []\n my_each {|el| new_arr += (el.is_a?(Array) ? el.my_controlled_flatten(n-1) : [el])}\n new_arr\n end",
"def my_controlled_flatten(n)\n return self if n == 0\n result = []\n self.each do |el|\n result << el unless el.is_a? Array\n result += el.my_controlled_flatten(n - 1) if el.is_a? Array\n end\n result\n end",
"def my_controlled_flatten(n)\n return self if n == 0\n result = []\n self.each do |el|\n result << el unless el.is_a? Array\n result += el.my_controlled_flatten(n - 1) if el.is_a? Array\n end\n result\n end",
"def my_flatten_recursive \n results = []\n self.my_each do |ele|\n if ele.is_a? Array \n results.concat(ele.my_flatten_recursive)\n else \n results<< ele\n end\n end\n results\n\n end",
"def to_a(dimen=nil)\n if self.dim == 2\n\n return self.to_flat_a if self.shape[0] == 1\n\n ary = []\n begin\n self.each_row do |row|\n ary << row.to_flat_a\n end\n #rescue NotImplementedError # Oops. Try copying instead\n # self.each_row(:copy) do |row|\n # ary << row.to_a.flatten\n # end\n end\n ary\n else\n to_a_rec(0)\n end\n end",
"def flatten_cells() @cells.flatten end",
"def using_flatten(arr)\n arr.flatten\nend",
"def flatten\n map {|item| item.respond_to?(:flatten) ? item.flatten : item }.flatten\n end",
"def recursive_flatten(incoming_array, new_flattened_array = [])\n incoming_array.each do |item|\n if item.class == Array\n # Recursion\n recursive_flatten(item, new_flattened_array)\n else\n new_flattened_array << item\n end\n end\n new_flattened_array\n end",
"def flatten!\n nil\n end",
"def flatten\n todel = []\n count.times do |i|\n mpe = mapee(i)\n mpe.branches.times do |j|\n self << mapee(i).copy\n mapee_last << mpe[j].snd\n end\n todel << mapee(i)\n end\n dist >> todel\n end",
"def my_flatten!\n self.replace(my_flatten)\n end",
"def flatten(array, result = [])\n array.each do |element|\n if element.is_a?(Array)\n flatten(element, result)\n else\n result << element\n end\n end\n result\nend",
"def flatten(nested_array, result = [])\n nested_array.each do |integer|\n if integer.class == Array\n flatten(integer, result)\n else\n result << integer\n end\n end\n result\nend",
"def to_a\n\t\t\tflat = []\n\t\t\t\n\t\t\tflatten_to_array(flat)\n\t\t\t\n\t\t\treturn flat\n\t\tend",
"def flatten!\n # buggerit\n raise NotImplementedError\n end",
"def my_controlled_flatten(level = nil)\n flattened = []\n\n self.each do |ele|\n if ele.is_a?(Array) && level != 0\n flattened += (level.nil? ? ele.my_controlled_flatten : ele.my_controlled_flatten(level - 1))\n else\n flattened << ele\n end\n end\n\n flattened\n end",
"def my_controlled_flatten(level = nil)\n flattened = []\n\n self.each do |ele|\n if ele.is_a?(Array) && level != 0\n flattened += (level.nil? ? ele.my_controlled_flatten : ele.my_controlled_flatten(level - 1))\n else\n flattened << ele\n end\n end\n\n flattened\n end",
"def flatten(array)\n a = []\n array.each do |n|\n if n.is_a? Array\n b = flatten(n)\n b.each { |x| a << x }\n else\n a << n\n end\n end\n a\nend",
"def arr\n a = [1,2,[3,4,[5]]]\n return a.flatten\nend",
"def flatten_array(array, result = [])\n array.each do |element|\n if element.is_a? Array\n flatten_array(element, result)\n else\n result << element\n end\n end\n result\nend",
"def flatten_deeper(array)\n array.collect { |element| element.respond_to?(:flatten) ? element.flatten : element }.flatten\n end",
"def compacted\n if ndim == 1\n return self[]\n else\n newdim = dim.reject{|x| x == 1 }\n return ( ndim != newdim.size ) ? reshape(*newdim) : self[]\n end\n end",
"def my_controlled_flatten(n=1)\n #here\n return self if n < 1\n\n results = []\n self.each do |el|\n if el.class == Array\n #here\n results += el.my_controlled_flatten(n-1)\n else\n results << el\n end\n end\n\n results\n\n end",
"def _recursively_flatten_to!(array, out)\n array.each do |o|\n if NodeList === o\n _recursively_flatten_to!(o.nodes, out)\n elsif o.respond_to?(:to_ary)\n ary = Array === o ? o : o.to_ary\n _recursively_flatten_to!(ary, out)\n else\n out << o\n end\n end\n end",
"def unflatten(flat_array)\n result = []\n x = 0\n\n while x < flat_array.length do \n if flat_array[x] < 3 \n result.push flat_array[x]\n x += 1\n else\n temp = [*flat_array[x...x + flat_array[x]]]\n result.push temp \n x += flat_array[x]\n end\n end\n result \nend",
"def flatten(array)\n return [] if array.empty?\n\n res = []\n array.each do |el|\n if el.is_a? Array\n res += flatten(el)\n else\n res << el\n end\n end\n res\nend",
"def my_flatten(array)\n print array.flatten\n end",
"def my_controlled_flatten(n)\n return self if n == 0\n flattened = []\n\n self.each do |el|\n if el.is_a? Array\n next_val = n.nil? nil : n - 1\n flattened += el.my_controlled_flatten(next_val)\n else\n flattened += el\n end\n end\n\n flattened\n end",
"def to_nested_a(flat = false, mover = nil, &block)\n descendants = self.nested.all\n array = []\n\n while not descendants.empty?\n items = descendants.shift.to_nested_a(flat, mover, descendants, 0, &block)\n array.send flat ? 'concat' : '<<', items\n end\n\n return array\n end",
"def flatten\n bind(&:itself)\n end",
"def flatten(depth = -1)\n to_a.flatten(depth)\n end",
"def expand\n map { |p| p&.flatten || p }.flatten\n end",
"def multi_dimensional_sum(array)\n array.flatten\nend",
"def flatten(array)\n container = []\n\n array.each do |element|\n if element.is_a?(Array)\n container += element\n else\n container << element\n end\n end\n\n container\nend",
"def flattened_results\n\n f2 = results.flatten(2)\n f2.any? ? [ f2.shift ] + f2.flatten(2) : []\n end",
"def flatten_a_o_a(aoa)\n result = []\n x = 0\n while x < aoa.length do\n y = 0\n while y < aoa[x].length do\n result.push(aoa[x][y])\n y += 1\n end\n x += 1\n end\n return result\nend",
"def my_transpose\n new_array = []\n\n (0...self.length).each do |row|\n new_row = []\n\n (0...self.length).each do |col|\n new_row << self[col][row]\n \n end\n new_array << new_row\n end\n new_array\n end",
"def convert_1_level_deep(arr, result=[])\n arr.flatten.each_slice(3) { |ele| result.push(ele)}\n result\nend",
"def my_transpose\n ret = []\n i=0\n while i < self.length\n j=0\n ret2 = []\n while j < self[i].length\n ret2 << self[j][i]\n j += 1\n end\n ret << ret2\n i += 1\n end\n ret\n end",
"def alternate\n return [] if size.zero?\n return [[self[0]]] if size == 1 \n populate_alternate_arrays\n end",
"def recursively_flatten_finite(array, out, level)\n ret = nil\n if level <= 0\n out.concat(array)\n else\n array.each do |o|\n if ary = Backports.is_array?(o)\n recursively_flatten_finite(ary, out, level - 1)\n ret = self\n else\n out << o\n end\n end\n end\n ret\n end",
"def recursively_flatten_finite(array, out, level)\n ret = nil\n if level <= 0\n out.concat(array)\n else\n array.each do |o|\n if ary = Backports.is_array?(o)\n recursively_flatten_finite(ary, out, level - 1)\n ret = self\n else\n out << o\n end\n end\n end\n ret\n end",
"def flatt(arr, flat_arr = [])\n arr.each do |element|\n if element.is_a?(Array)\n flatt(element, flat_arr)\n else\n flat_arr << element\n end\n end\n flat_arr\nend",
"def flatten(data, level = 0)\n return [data] unless data.is_a?(Array) \n flat = []\n data.each do |ele|\n if ele.is_a?(Array)\n flat += flatten(ele, level + 1)\n else\n flat << ele\n end\n end\n flat\nend",
"def flat\n Flat.new(self)\n end",
"def flatten(arr)\n\n flat = []\n\n arr.each do |el|\n if el.class != Array\n flat << el \n else\n #flatten(el).each {|char| flat << char}\n flat.push(*flatten(el))\n end\n end\n flat \nend",
"def my_flatten(arr, flattened_arr = [])\nend",
"def my_controlled_flatten(n)\n\n end",
"def my_controlled_flatten(n)\n\n end",
"def flatten\n # if any item is a Set or Java Collection, then convert those into arrays before recursively flattening the list\n if any? { |item| Set === item or Java::JavaUtil::Collection === item } then\n return map { |item| (Set === item or Java::JavaUtil::Collection === item) ? item.to_a : item }.flatten\n end\n base__flatten\n end",
"def flatten_deeper(array)\n array.collect do |element|\n (element.respond_to?(:flatten) && !element.is_a?(Hash)) ? element.flatten : element\n end.flatten\n end",
"def flatten_a_o_a(aoa)\n result = []\n i = 0\n while i < aoa.length do\n k = 0\n while k < aoa[i].length do # DON'T CHANGE!\n result << aoa[i][k]\n k += 1\n end\n i += 1\n end\n result\nend",
"def flatten_a_o_a(aoa)\n result = []\n i = 0\n while i < aoa.length do\n k = 0\n while k < aoa[i].length do\n result << aoa[i][k]\n k += 1\n end\n i += 1\n end\n result\nend",
"def flatten_a_o_a(aoa)\n result = []\n i = 0\n\n while i < aoa.length do\n k = 0\n while k < aoa[i].length do\n result << aoa[i][k]\n k += 1\n end\n i += 1\n end\n\n result\nend",
"def flatten_a_o_a(aoa)\n result = []\n i = 0\n\n while i < aoa.length do\n k = 0\n while k < aoa[i].length do\n result << aoa[i][k]\n k += 1\n end\n i += 1\n end\n\n result\nend",
"def flatten_a_o_a(aoa)\n result = []\n i = 0\n\n while i < aoa.length do\n k = 0\n while k < aoa[i].length do\n result << aoa[i][k]\n k += 1\n end\n i += 1\n end\n\n result\nend",
"def flatten_a_o_a(aoa)\n result = []\n i = 0\n\n while i < aoa.length do\n k = 0\n while k < aoa[i].length do\n result << aoa[i][k]\n k += 1\n end\n i += 1\n end\n\n result\nend",
"def flatten_a_o_a(aoa)\n result = []\n i = 0\n\n while i < aoa.length do\n k = 0\n while k < aoa[i].length do\n result << aoa[i][k]\n k += 1\n end\n i += 1\n end\n\n result\nend"
] | [
"0.77120745",
"0.770132",
"0.7382087",
"0.7377283",
"0.73431385",
"0.7294778",
"0.72917634",
"0.72794485",
"0.7258651",
"0.7115506",
"0.70637363",
"0.6971108",
"0.6960108",
"0.6960108",
"0.684128",
"0.67989725",
"0.6789756",
"0.67784405",
"0.67644423",
"0.6729483",
"0.6729297",
"0.6729297",
"0.67127115",
"0.66948974",
"0.66478264",
"0.6634898",
"0.66277033",
"0.66173536",
"0.65996903",
"0.65996903",
"0.6592076",
"0.65776604",
"0.6564216",
"0.65265256",
"0.65165365",
"0.6511587",
"0.65088886",
"0.65055794",
"0.65055794",
"0.64960545",
"0.648067",
"0.6474039",
"0.64725417",
"0.6471146",
"0.6467409",
"0.6426992",
"0.6407224",
"0.64043695",
"0.63858306",
"0.63263166",
"0.63159525",
"0.6311114",
"0.6304682",
"0.63044286",
"0.6302019",
"0.63016117",
"0.6289812",
"0.6232321",
"0.6230872",
"0.61958766",
"0.61926454",
"0.61906445",
"0.618509",
"0.6180654",
"0.61805654",
"0.6153224",
"0.614434",
"0.6134235",
"0.6130382",
"0.61170894",
"0.6083852",
"0.60832494",
"0.60594106",
"0.6053089",
"0.6023323",
"0.60018265",
"0.59910774",
"0.5955527",
"0.5955527",
"0.59533614",
"0.5922142",
"0.59088427",
"0.58739007",
"0.58479017",
"0.58362365",
"0.58362365",
"0.57890576",
"0.5782341",
"0.5752879",
"0.5738771",
"0.5736325",
"0.5736325",
"0.5736325",
"0.5736325",
"0.5736325"
] | 0.6511354 | 39 |
removes any items from the array that are equal to the string | def using_delete(array, string)
array.delete(string)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_non_strings(array)\n array.delete_if {|word| word.to_s != word}\n end",
"def remove_non_strings(arr)\n arr.select do |element|\n element == element.to_s\n end\nend",
"def remove_non_strings (array)\n\tarray.delete_if {|element| element.class != String }\nend",
"def remove_non_strings(array)\n array.delete_if { |item| item.is_a?(String) == false }\nend",
"def match(array)\n array.delete_if {|w| w.split(\"\").sort != word.split(\"\").sort}\n end",
"def remove_non_strings(array)\n array.find_all { |a| a.is_a?(String)}\nend",
"def remove_non_strings(array)\n array.reject do |element|\n !element.is_a?(String)\n end\nend",
"def remove_non_strings (array)\n temp = []\n array.each do |data|\n if data.class == String\n temp << data\n end\n end\n temp\nend",
"def remove_non_strings(array)\n array.delete_if { |element| !(element.is_a? String) } #is not a string\nend",
"def my_array_deletion_method!(array, a)\n array.delete_if { |value| value.to_s.include?(a) }\nend",
"def remove_non_strings(array)\n array.select { |word| word.class == String }\nend",
"def remove_non_strings(array)\n array.delete_if do |i|\n i.instance_of?(String) == false\n end\n array.each do |i|\n if i.instance_of?(Hash) == true\n array.delete(i)\n end\n end\n return array\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.each {|word| remove_word = word.to_s\n if remove_word.include?(thing_to_delete) == true\n source.delete(string)\n p source\n end\n }\nend",
"def my_array_deletion_method(source, thing_to_delete)\n source.delete_if{|item| item.to_s.include?(thing_to_delete.to_s)}\nend",
"def match(w_array)\n w_array.delete_if {|w| w.split(\"\").sort != word.split(\"\").sort}\n end",
"def my_array_deletion_method!(source, thing_to_delete)\n source.reject! {|s| s.to_s.include?(thing_to_delete.to_s) }\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|item| item.is_a?(String) && item.include?(thing_to_delete)}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.select! {|el| el.to_s.include?(thing_to_delete) == false}\nend",
"def my_array_deletion_method(array, letter)\n array.delete_if { |data| data.to_s.match(letter.to_s)}\n return array\n end",
"def my_array_deletion_method(source, thing_to_delete)\n source.delete_if { |word| word.to_s.include?(thing_to_delete) }\nend",
"def my_array_deletion_method(source, thing_to_delete)\t\n\tsource.delete_if {|x| x.class.to_s == \"String\" && x.include?(thing_to_delete) == true}\n\t\nend",
"def my_array_deletion_method!(i_want_pets, letter)\n i_want_pets.delete_if { |item| item.to_s.include?(letter) }\nend",
"def my_array_deletion_method(source, thing_to_delete)\n source.reject!{ |x| x.to_s.include?(thing_to_delete) }\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if { |word| word.to_s.include? thing_to_delete }\nend",
"def my_array_deletion_method(source, thing_to_delete)\n\nsource = source.delete_if {|element| element.class == String && element.include?(thing_to_delete)\n}\nend",
"def my_array_deletion_method(source, thing_to_delete)\n\tsource.each do |word| if word.to_s.split(\"\").include? thing_to_delete\n\t\tsource.delete word\n\tend\nend\n\t source \nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.each do |items|\n if items.to_s.downcase.include?(thing_to_delete)\n source.delete(items)\n end\n end\n source\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n remove_letter = source.find_all { |letter| letter.to_s.include?(thing_to_delete)}\n\n remove_letter.each { |word| source.delete(word)}\n\n p source\nend",
"def custom_remove(array, remove)\n newarr = []\n array.each { |item| newarr << item unless remove.include?(item) }\n newarr\nend",
"def remove_all_with(*c)\n return nil if c.nil?\n\n if c.is_a? String\n return self.map {|x| x.include?(c) ? nil : x}.compact\n elsif c.is_a? Array\n if c == [[]] || c == []\n return self\n else\n return self.reject{|word| /[#{c.join}]/ =~ word}\n end\n end\n end",
"def my_array_deletion_method(source, thing_to_delete)\n source.delete_if {|x| x.to_s.include?(thing_to_delete) == true}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.reject! {|user_string| user_string.to_s.index(thing_to_delete) != nil}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|item| item.to_s.include?(thing_to_delete)}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|item| item.to_s.include?(thing_to_delete)}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.reject! {|user_string| user_string.to_s.index(thing_to_delete) != nil}\n return source\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.reject! {|word| word.to_s.rindex(thing_to_delete) != nil}\n return source\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if{|x| x.to_s.include?(thing_to_delete)}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.each do |thing|\n if thing.to_s.downcase.include?(thing_to_delete)\n source.delete(thing)\n end\n end\n source\nend",
"def my_array_deletion_method(source, thing_to_delete)\n source.each do |x|\n \tif x.to_s.split(\"\").include?(thing_to_delete) \n \t\tsource.delete(x)\n\tend\n end\nend",
"def my_array_deletion_method(source, thing_to_delete)\n source.delete_if {|element| element.to_s.include? (thing_to_delete)} \nend",
"def my_array_deletion_method!(source, thing_to_delete)\r\n words_to_delete = source.find_all { |f| f.to_s.include?(thing_to_delete)}\r\n words_to_delete.each do |word|\r\n source.delete(word)\r\n end\r\n p source\r\nend",
"def my_array_deletion_method!(array, letter)\n array.delete_if {|x| x.to_s.include?(letter) }\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|x| x.to_s.include?(thing_to_delete)}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|x| x.to_s.include?(thing_to_delete)}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if { |x| x.to_s.include?(thing_to_delete)}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.each {|x| \n source.delete(x) if (x.is_a?(String) && x.index(thing_to_delete) != nil)\n }\n p source\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n\n var_to_delete = thing_to_delete\n\n source.map! {|str| str.to_s}\n p source.delete_if {|str| str.include?(var_to_delete)}\n\nend",
"def my_array_deletion_method(source, thing_to_delete)\n source.delete_if{|x| x.to_s.include?(thing_to_delete)}\n return source\nend",
"def my_array_deletion_method(source, thing_to_delete)\n source.delete_if{|x| x.to_s.include?(thing_to_delete)}\n return source\nend",
"def match(array)\n array.keep_if do |string|\n #keep_if is a method that removes anything false and keep only elements that are true\n #binding.pry\n name.split(\"\").sort == string.split(\"\").sort\n #<- name here is being split and then being sorted and checking if it is equal to string element also being splitted and sorted\n #<- once its false, keep_if will remove both of them and only keep the elements that are true.\n end\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|x| x.to_s.include? thing_to_delete}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.each do |substring|\n if substring.class == thing_to_delete.class && substring.include?(thing_to_delete) == true\n source.delete(substring)\n end\n end\n return source\n end",
"def test_oposite_of_reject\n array = [\"hello\", 2, 3, \"there\", \"how\", 9, \"are you\"]\n array.keep_if{ |x| x.is_a?(String)}\n assert_equal [\"hello\", \"there\", \"how\", \"are you\"], array\n end",
"def remove_non_strings(strings)\n strings.select do |string|\n string.class == String\n end\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if do |item| \n item.to_s.include? thing_to_delete\n end\n source\nend",
"def my_array_deletion_method(source, thing_to_delete)\n\tsource.delete_if {|element| element.to_s.include?(thing_to_delete)}\nend",
"def my_array_deletion_method(source, thing_to_delete)\n\tsource.delete_if {|i| i.to_s.include? thing_to_delete}\nend",
"def remove_non_strings(collections)\n collections.reject {|element| element.class != String}\nend",
"def solo5(arr)\n\tarr.delete_if {|sup| sup.include?(\" \")} \n\t#p zombie_apocalypse_supplies\nend",
"def my_array_deletion_method(source, thing_to_delete)\n\t\tsource.delete_if { |i| i =~ /#{thing_to_delete}/}\n\t\tprint source\nend",
"def delete_matches(to_delete, array)\n to_delete = to_delete.reverse # so indexes don't shift down as items are being deleted\n to_delete.each do |num|\n array.delete_at(num)\n end\n array\n end",
"def clean_array(a)\n a.select{|el| el.gsub(/\\s/,\"\").size > 0}\n end",
"def my_array_deletion_method!(source, thing_to_delete)\n \n duplicate = source.dup\n\n i = 0\n while i < duplicate.length\n word = duplicate[i]\n if word.is_a?(Fixnum)\n i += 1\n next\n end\n if word.include?(thing_to_delete)\n source.delete(word)\n end\n i += 1\n end \n source\nend",
"def my_array_deletion_method(source, thing_to_delete)\n p source.delete_if {|thing_to_modify| thing_to_modify.to_s.include? (thing_to_delete)}\nend",
"def using_delete(array,string)\n array.delete(string)\n end",
"def remove_nils_and_false_from_array(array)\n array.reject!{ | word | word == nil || word == false }\nend",
"def my_unique(arr)\n res = []\n arr.each do |item|\n res << item unless res.include?(item)\n end\n \n res\nend",
"def remove_vowels2(array_of_strings)\n vowels = 'aeiouAEIOU'\n array_of_strings.map do |string|\n string.delete(vowels)\n end\nend",
"def clean_array(ary)\n ary.compact.map(&:strip).reject(&:blank?).uniq\n end",
"def reject_empty_text(arr)\n arr.reject { |x| x.type == :text && x.value == \"\" }\n end",
"def remove_all_without(c, i)\n return self.map {|x| x[i] == c ? x : nil}.compact\n end",
"def remove_vowels(array)\n vowels = %w(a e i o u)\n array.map!(&:chars)\n array.map { |ary| ary.delete_if { |chr| vowels.include?(chr.downcase) } }\n array.map(&:join)\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if { |a| a.include?(thing_to_delete) }\nend",
"def remove(input, string); end",
"def my_array_deletion_method!(source, thing_to_delete)\n\n indexChange = 0\n for x in 0..(source.length - 1)\n sourceString = source[x - indexChange].to_s\n\n if sourceString.include? thing_to_delete\n source[x - indexChange,source.length] = source[x + 1 - indexChange, source.length]\n indexChange = indexChange + 1\n end\n end\n # p source\n return source\nend",
"def using_delete(array, str)\n array.delete(str)\nend",
"def remove_vowels(str_arr)\n result = []\n str_arr.each do |string|\n result << string.chars.reject{|letter| letter =~ /[aeiou]/i }.join\n end\n result\nend",
"def reject_item(array, reject_item)\n output_array = []\n\n array.each do |item|\n if item == reject_item\n\n else\n output_array << item\n end\n end\n\n return output_array\nend",
"def remove_empty_values( arr )\n raise ArgumentError.new( 'The argument must be an array.' ) unless arr.is_a?( Array )\n\n arr.reject { |a| ( a.empty? if a.is_a?( String ) ) }\n end",
"def my_uniq(array)\n result = []\n array.each { |ele| result << ele unless result.include?(ele) }\n result\nend",
"def remove_vowels(array)\n array.map do |string|\n string.delete(\"aeiouAEIOU\")\n end\nend",
"def using_delete (array, string)\n return array.delete(string)\nend",
"def delete_item(unwanted)\r\n @arr.delete(unwanted)\r\n end",
"def remove_vowels(array)\n array.map do |string|\n string.delete('AEIOUaeiou')\n end\nend",
"def discard_useless_strings tokens_array\n tokens_array.delete_if do |item|\n item.length < 1 or\n (item.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true )\n end\n end",
"def remove_item(list, string)\n\tlist.delete(string.to_sym)\n\tlist\nend",
"def using_delete(arr, str)\n arr.delete(str)\nend",
"def using_delete(arr, str)\n arr.delete(str)\nend",
"def using_delete(array, string)\n array.delete(string)\n array\nend",
"def using_delete(array, string)\n \n array.delete(string)\n \nend",
"def filter_list l\n l.reject { |x| x.is_a? String}\nend",
"def clean_array( keywords )\n keywords.map!{|keyword| keyword.downcase.strip}\n blacklist = %w{ 000 do we from as other like working web data and 00 to you your our on in the of for ru }\n\n keywords.each do |keyword|\n keywords.delete( keyword ) if keyword.empty?\n end\n\n keywords.each do |keyword|\n keywords.delete( keyword ) if keyword.numeric?\n end\n\n keywords.each do |keyword|\n ('a'..'z').to_a.each do |letter|\n keywords.delete( keyword ) if letter == keyword\n end\n end\n\n keywords.each do |keyword|\n blacklist.each do |badword|\n keywords.delete( keyword ) if keyword == badword\n end\n end\n\n keywords.each do |k|\n if k == \"12\"\n ap 'bingo=======================================' if k.numeric?\n end\n end\n\n return keywords \nend",
"def exclude(arr, char)\n output = []\n i = 0\n charlength = char.length\n while i < arr.length\n if arr[i] != char\n output << arr[i]\n i += 1\n else\n i += 1\n end\n end\n return output\nend",
"def remove_vowels(array)\n array.map { |string| string.delete(\"AEIOUaeiou\") }\nend",
"def remove_vowels(array)\n array.map { |string| string.delete(\"aeiouAEIOU\") }\nend",
"def remove_vowels(array)\n array.map do |element|\n element.delete(\"aeiouAEIOU\")\n end\nend",
"def remove_vowels(array)\n array.map do |elements|\n elements.delete('aeiouAEIOU')\n end\nend",
"def remove_vowels(array)\n array.map {|word| word.delete(\"aeiou\")}\nend",
"def remove_miss_char_words(char)\n pattern = Regexp.new(\"[#{char}]\")\n\n array = @array.reject do |item|\n item.match(pattern) != nil\n end\n end",
"def filter_repeated_character_strings(arr)\nend",
"def remove_nils_and_false_from_array(array)\n\tn = ['a', 'b', nil, nil, false, 'c', nil]\n\tn.keep_if { |letter| letter != nil && letter != false }\nend"
] | [
"0.7720109",
"0.7636316",
"0.762875",
"0.7627442",
"0.7552872",
"0.73815334",
"0.736349",
"0.7361404",
"0.73528564",
"0.7334624",
"0.730869",
"0.7206498",
"0.7197225",
"0.7157979",
"0.7139616",
"0.71244895",
"0.71010286",
"0.7077331",
"0.7067973",
"0.7058944",
"0.70495105",
"0.70411956",
"0.7018709",
"0.7009457",
"0.6943825",
"0.69216585",
"0.6905451",
"0.6901142",
"0.689627",
"0.6867717",
"0.6864641",
"0.68606645",
"0.6828037",
"0.6828037",
"0.68208295",
"0.68177617",
"0.6789976",
"0.678959",
"0.6776608",
"0.67660606",
"0.67610985",
"0.67316747",
"0.6730845",
"0.6730845",
"0.67239547",
"0.6720783",
"0.672035",
"0.67112553",
"0.67112553",
"0.6709224",
"0.6697834",
"0.6696217",
"0.6682655",
"0.667946",
"0.667362",
"0.66708493",
"0.65848947",
"0.65567994",
"0.6551957",
"0.65518236",
"0.6418713",
"0.6409108",
"0.63888764",
"0.63777673",
"0.63743955",
"0.6358673",
"0.6330511",
"0.6309593",
"0.62948006",
"0.629253",
"0.6289997",
"0.62657565",
"0.6263729",
"0.625955",
"0.6253419",
"0.6252317",
"0.6248396",
"0.6241223",
"0.62397444",
"0.62310123",
"0.62298906",
"0.621505",
"0.61925524",
"0.6186962",
"0.61657596",
"0.6165134",
"0.616377",
"0.616377",
"0.61626303",
"0.61446583",
"0.61380637",
"0.6121007",
"0.61054474",
"0.6104909",
"0.61012065",
"0.61002237",
"0.60983187",
"0.6095496",
"0.6092079",
"0.6077569",
"0.60712"
] | 0.0 | -1 |
delete using the index | def using_delete_at(array, integer)
array.delete_at(integer)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_at_index(index)\n \n end",
"def delete(index_value)\n index.delete(index_value)\n end",
"def delete_at index\n idx = named_index_for index\n @data.delete_at @index[idx]\n\n if @index.index_class == Integer\n @index = Daru::Index.new @size-1\n else\n @index = Daru::Index.new (@index.to_a - [idx])\n end\n\n set_size\n set_nil_positions\n end",
"def delete_index\n dataset.delete_index\n end",
"def delete(index)\n Entity.remove_item(index)\n end",
"def delete_from_index\n SearchIndex.delete_record(self)\n end",
"def delete_from_index\n SearchIndex.delete_record(self)\n end",
"def remove(index)\n end",
"def delete_at index\n idx = named_index_for index\n @vector.delete_at @index[idx]\n\n if @index.index_class == Integer\n @index = Daru::Index.new @size-1\n else\n @index = Daru::Index.new (@index.to_a - [idx])\n end\n\n set_size\n end",
"def delete(path)\n exec { index.delete(path) }\n end",
"def delete_at(index)\n delete_idx = @indexes.each_index.find { |i| index == @indexes[i] }\n return nil unless delete_idx\n\n @indexes.delete_at(delete_idx)\n choice = @selected.delete_at(delete_idx)\n @size -= 1\n choice\n end",
"def delete_index index_name\n table = table index_list_table\n name_col = 0\n row = find_target_row table,index_name,name_col\n if row\n delete_button(table,row).click\n alert_ok\n else\n raise \"can not find target row\"\n end\n end",
"def delete_at(index)\n @store.delete_at(index)\n end",
"def delete_at_index(index)\n @list.delete_at(index)\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def delete_from_index\n case self.class.update_index_policy\n when :immediate_with_refresh\n self.class.delete_id_from_index(self.id, :refresh => true)\n # As of Oct 25 2010, :refresh => true is not working\n self.class.refresh_index()\n when :enqueue\n DistributedIndexing::RemoveDocuments.perform_async(self.class.to_s, [self.id.to_s])\n else\n self.class.delete_id_from_index(self.id)\n end\n end",
"def delete_at(index)\n # raises IndexOutOfBoundsException if index is out of bounds [0, @length)\n # TODO\n end",
"def delete_at(index)\n @driver_instance.delete_list_value_at(@key, index)\n end",
"def delete_index\n IndexJob.perform_later(self.class.name, 'delete', id) if index_exists?\n end",
"def delete_from_index\n mapping_name = self.class.instance_variable_get(:@_mapping_name)\n\n ElasticMapper.index.type(mapping_name).delete(self.id)\n end",
"def delete_at(index)\n @fields.delete_at(index)\n self\n end",
"def remove_index(index)\n resp = delete do |req|\n req.url \"#{index}\"\n end\n resp.body\n end",
"def delete_from_index\n begin\n __elasticsearch__.delete_document\n rescue Elasticsearch::Transport::Transport::Errors::NotFound\n nil\n end\n\n index_dependent_models.map(&:update_in_index)\n end",
"def delete_at(index)\n return nil if index >= @size || index < 0\n element = self[index]\n if direct_index = @map[index]\n @added.delete_at(direct_index)\n @map.delete(index)\n @map.keys.sort.each do |key|\n if key > index\n value = @map.delete(key)\n value -= 1 if value > direct_index\n @map[key-1] = value\n else\n if (value = @map[key]) > direct_index\n @map[key] -= 1\n end\n end\n end\n else\n lazy_index = lazy_index(index)\n position = @deleted.bsearch_upper_boundary{|e| e <=> lazy_index }\n @deleted.insert(position,lazy_index)\n @map.keys.sort.each do |key|\n if key > index\n @map[key-1] = @map.delete(key)\n end\n end\n end\n #@commands << [:delete,[index]]\n @size -= 1\n element\n end",
"def delete_index index\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}\")\n req = Net::HTTP::Delete.new(uri)\n begin\n run(uri, req)\n log.info \"Deleted #{index}\"\n log.info \"Status: #{index_exists index}\"\n rescue\n if !client.index_exists index\n log.info \"Index not deleted, does not exist: #{index}\"\n else\n raise \"Error deleting index: #{index}\"\n end\n end\n end",
"def delete(index)\n @alignments.delete(index).each do |alignment|\n @indexes.delete(alignment)\n end\n end",
"def drop_index\n call(ft_drop)\n end",
"def delete_current\n @deleted_entries.set(@record_index)\n end",
"def unindex(obj)\n XapianDb.database.delete_doc_with_unique_term(obj.xapian_id)\n XapianDb.database.commit\n end",
"def delete(index)\n save do\n items.delete_at(index.to_i-1)\n end\n end",
"def delete(key)\n raise NotImplementedError, \"#{__method__} has not been implemented for this #{name} index\"\n end",
"def delete_at(index)\n len = count\n values = @@redis.lrange(namespaced_key, 0, len-1)\n @@redis.multi do\n new_values = []\n\n values.each_with_index do |value, i|\n new_values << value unless i == index\n end\n\n @@redis.del(namespaced_key)\n new_values.each do |value|\n @@redis.rpush(namespaced_key, value)\n end\n end\n end",
"def delete(index)\n todo = @items.delete_at(index.to_i-1)\n save\n todo\n end",
"def rm_index(entity, field, value)\n return false unless index?(field)\n #return value.each {|x| rm_index(entity, field, x)} if value.respond_to?(:each)\n index_for_field(field).remove(entity, field, value)\n end",
"def clear_index\n @index = nil\n end",
"def delete\n association.delete association[element.dataset[:index].to_i]\n end",
"def delete_at_index(index)\n if index.zero?\n self.first_node = first_node.next_node\n else\n current_node = first_node\n current_index = 0\n while current_index < (index - 1)\n current_node = current_node.next_node\n current_index += 1\n end\n node_after_deleted_node = current_node.next_node.next_node\n current_node.next_node = node_after_deleted_node\n end\n end",
"def delete_at index\n @config.delete_at index\n end",
"def delete(path)\n self.stage { |idx| idx.delete(path) }\n end",
"def delete(target)\n index = assert_index(target, :at)\n objects.delete_at index\n end",
"def delete_tank_indexes\n tanker_config.index.delete_document(it_doc_id)\n end",
"def delete_item(index)\n LIST.delete_at(index)\nend",
"def delete element\n self.delete_at index_of(element) \n end",
"def delete element\n self.delete_at index_of(element) \n end",
"def delete(key, opts = {})\n options = setup_commit_options({:message => \"deleted #{key}\"}.merge(opts))\n self[key].tap do\n save(options) {|index| index.delete(key_for(key)) }\n end\n end",
"def delete(key, opts = {})\n options = setup_commit_options({:message => \"deleted #{key}\"}.merge(opts))\n self[key].tap do\n save(options) {|index| index.delete(key_for(key)) }\n end\n end",
"def delete_at ix\n return unless @list\n raise ArgumentError, \"Argument must be within 0 and #{@list.length}\" if ix < 0 or ix >= @list.length \n fire_dimension_changed\n #@list.delete_at(ix + @_header_adjustment)\n _ret = @list.delete_at(ix)\n @native_text = @list # 2014-05-27 - 16:34 \n return _ret\n end",
"def using_delete_at(arr, index)\n arr.delete_at(index)\nend",
"def destroy\n @index = Indice.find(params[:id])\n @index.destroy\n\n respond_to do |format|\n format.html { redirect_to(indices_url) }\n format.xml { head :ok }\n end\n end",
"def delete_at(index)\t\n\t\tif index==1\n\t\t\t@first = tmp.front\n\t\t\t@first.back = nil\n\t\telsif @length==index\n\t\t\tpop;\n\t\telse\n\t\t\ttmp = get(index)\n\t\t\ttmp.back.front = tmp.front \n\t\t\ttmp.front.back = tmp.back\n\t\tend\n\t\t@length-=1\n\tend",
"def remove_at(idx)\n @todos.delete(item_at(idx))\n end",
"def destroy\n @index = SHDM::Index.find(params[:id])\n @index.destroy\n\n respond_to do |format|\n format.html { redirect_to(indexes_url) }\n format.xml { head :ok }\n end\n end",
"def remove_from_index(name, key); end",
"def delete\n \n end",
"def using_delete_at(array, index)\n array.delete_at(index)\nend",
"def delete_search_index(name)\n @data[:search_indexes].delete(name)\n true\n end",
"def delete(thing)\n if thing.is_a? Integer\n @index = @index.delete_if {|idx| idx.r_id == thing }\n @records = @records.delete_if {|idx, data| idx == thing }\n else\n if thing.respond_to?(:r_id)\n r_id = thing.r_id\n @index = @index.delete_if {|idx| idx.r_id == r_id }\n @records = @records.delete_if {|idx, data| data == thing}\n end\n end\n res_index = @header.resource_index\n res_index.number_of_records = @index.length\n @header.resource_index = res_index\n end",
"def delete_at(p0) end",
"def delete_at(idx)\n idx = Maglev::Type.coerce_to(idx, Fixnum, :to_int)\n sz = self.__size\n if idx < 0\n idx = sz + idx\n if idx < 0\n return nil\n end\n end\n if idx >= sz\n return nil\n end\n elem = self.__at(idx)\n oidx = idx + 1\n self.__remove_from_to_(oidx, oidx)\n return elem\n end",
"def delete_index\n # set current version to delete alias later\n current_version = current_index_version\n\n # deletes any index version and the alias\n all_index_versions.each{|index_version|\n Escargot.client.alias_index(:remove => {index_version => current_index_name}) if (index_version == current_version)\n Escargot.client.delete_index(index_version)\n }\n\n # and delete the index itself if it exists\n begin\n Escargot.client.delete_index(current_index_name)\n rescue ElasticSearch::RequestError\n # it's ok, this means that the index doesn't exist\n end\n end",
"def using_delete_at(array, index)\n array.delete_at(index)\nend",
"def delete_at_without_hooks( index )\n\n @without_hooks = true\n\n object = delete_at( index )\n \n @without_hooks = false\n\n return object\n \n end",
"def delete_at(i)\n\t\t@storage.delete_at i\n\tend",
"def delete_item(idx, list)\n list.reject! { |item| item[:idx] == idx }\n end",
"def property_index_destroy\n connection = self.class.connection\n foreign_key = index_foreign_key\n current_id = self.id\n schema.index_groups.each do |group_name, definitions|\n next if group_name =~ FIELD_INDEX_REGEXP\n if group_name.kind_of?(Class)\n group_name.delete_property_index(self)\n else\n connection.execute \"DELETE FROM #{index_table_name(group_name)} WHERE #{foreign_key} = #{current_id}\"\n end\n end\n end",
"def delete_indices(group_name, keys)\n self.class.connection.execute \"DELETE FROM #{index_table_name(group_name)} WHERE #{index_reader_sql(group_name)} AND #{KEY} IN (#{keys.map{|key| connection.quote(key)}.join(',')})\"\n end",
"def delete_by_query index, query, conflicts_proceed\n conflicts = conflicts_proceed ? 'conflicts=proceed' : ''\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/_delete_by_query?#{conflicts}\")\n\n req = Net::HTTP::Post.new(uri)\n req.body = query.to_json\n run(uri, req)\n end",
"def delete(index)\n if index.between?(1, @items.count)\n @items.delete_at(index - 1)\n else\n raise UdaciListErrors::IndexExceedsListSize,\n \"item '#{index}' does not exist\"\n end\n end",
"def delete_at (i)\n\n outlen_op(:tclistremove, i)\n end",
"def remove_index(table, target)\n current_instructions << Instructions::RemoveIndex.new(table: table, field: target)\n end",
"def exist_index_remove_item(index_no)\n index_no -= 1\n @r_item = @items[index_no].description\n @items.delete_at(index_no)\n conf_message(@r_item, \"removed\")\n end",
"def remove_by_index(index)\n @items.delete_at(index-1)\n end",
"def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end",
"def destroy\n @index = Index.find(params[:id])\n @index.destroy\n\n respond_to do |format|\n format.html { redirect_to(indices_url) }\n format.xml { head :ok }\n end\n end",
"def drop_index\n index_adapter.drop_index(self)\n end",
"def using_delete_at(array,integer)\n array.delete_at(integer)\n end",
"def delete row_ind\n key, row = @row_refs.at row_ind\n return unless key\n\n if key.atom?\n if @row_refs.delete row_ind\n row.send :remove!\n self\n end\n else\n if row.send :reduce_repeated\n @row_refs.taper row_ind\n self\n end\n end\n end",
"def remove(index, type, id)\n resp = delete do |req|\n req.url \"#{index}/#{type}/#{id}\"\n end\n resp.body\n end",
"def removecmd(idx)\n {name: idx, type: :indexed}\n end",
"def removecmd(idx)\n {name: idx, type: :indexed}\n end",
"def delete_index(index_name)\n uri = @client.make_uri('/admin/cores', [\n [\"action\", \"UNLOAD\"],\n [\"core\", index_name],\n [\"deleteInstanceDir\", \"true\"]\n ])\n response = @client.send_http(HTTP::Post.new(uri), true, ['200'])\n end",
"def delete_ace(index=MAXDWORD)\n unless DeleteAce(@ace, index)\n raise Error, get_last_error\n end\n\n index\n end",
"def unindex(symbol)\n @index.delete symbol.digram rescue nil\n end",
"def index_delete\n listing\n puts \"please type the index of the recipe you would like to delete\"\n gets.chomp.to_i - 1\n end",
"def clear_index!\n search_backend.clear_index!\n end",
"def delete\n \n end",
"def delete_at_arr(arr, index)\n # delete the element at the position #index\n return arr.delete_at(index)\nend",
"def delete_and_create_index(cli=Elasticsearch::Persistence.client)\n\t\tbegin\n\t\t\tcli.indices.delete index: get_index_name\n\t\trescue => e\n\t\t\tputs \"index doesnt exist.\"\n\t\tend\n\t\t#if (Elasticsearch::Persistence.client.indices.exists? index: get_index_name)\n\t\t\t\n\t\t#end\n\t\tcli.indices.create index: get_index_name, body: {\n\t\t\tsettings: SaxObject::SETTINGS,\n\t\t\tmappings: to_mapping\n\t\t}\n\tend",
"def delete(key)\n id = @cache[key]\n @cache.delete(key)\n @index.delete(id) if id\n end",
"def delete_child_at(index)\n # NOTE: All deleting uses this method so that subclasses can override default behaviour when deleting a child\n @children.delete_at(index)\n end",
"def delete_row lb # {{{\n index = lb.current_index\n id = lb.list[lb.current_index].first\n lb.list().delete_at(index)\n lb.touch\n ret = @db.execute(\"UPDATE #{@tablename} SET status = ? WHERE rowid = ?\", [ \"x\", id ])\nend",
"def delete_at_index(index)\n if @llist\n if index == 0\n @llist = @llist.next_node\n else\n node = get(index)\n prev_node = get(index-1)\n prev_node.add_next_node node.next_node\n end\n else\n# todo: handle unknown index\n end\n end",
"def rm_index_config\n @config.rm_index_config\n end",
"def delete(category,task_index)\n @todo_container[category].each do |task_item|\n if task_item.index == task_index\n task_item.flag = false\n end\n end\n end",
"def delete(arr,index)\n # res = arr.clone;\n res = arr[0,index] + arr[index+1,arr.size-(index+1)];\n return res;\nend",
"def delete_col(idx)\n @header.delete_at(idx)\n @order -= 1\n each { |row| row.delete_at(idx) }\n end",
"def delete\n end",
"def remove_unique_index!\n @table_unique_index.remove!\n end",
"def delete\n end",
"def deregister_index(index)\n @indexes.delete index.path\n $LUCENE_LOGGER.debug{\"Deregistered index for #{index}\"}\n end",
"def delete(key)\n in_transaction_wr\n @table.delete key\n end"
] | [
"0.869793",
"0.8263856",
"0.8255343",
"0.81012404",
"0.7901392",
"0.7879432",
"0.7879432",
"0.7705953",
"0.77014935",
"0.767028",
"0.76054955",
"0.75758374",
"0.7519988",
"0.7492276",
"0.74708027",
"0.74678814",
"0.7444457",
"0.7436622",
"0.739986",
"0.73541504",
"0.7307726",
"0.7289882",
"0.7270313",
"0.7247898",
"0.72113526",
"0.7208311",
"0.7190324",
"0.71867245",
"0.7164745",
"0.71345353",
"0.711634",
"0.7106807",
"0.7086056",
"0.7085247",
"0.7085208",
"0.7023608",
"0.70169806",
"0.69880545",
"0.69615805",
"0.6959975",
"0.69548845",
"0.6915265",
"0.6912971",
"0.6912971",
"0.6891934",
"0.6891934",
"0.68916905",
"0.6876374",
"0.68738097",
"0.6873722",
"0.6872572",
"0.6864928",
"0.68648016",
"0.6864592",
"0.68450326",
"0.68433154",
"0.68288016",
"0.68264455",
"0.68253815",
"0.6810904",
"0.6809577",
"0.6808874",
"0.67982066",
"0.67961496",
"0.6794043",
"0.6747352",
"0.6731665",
"0.6724429",
"0.67200464",
"0.6704522",
"0.66956174",
"0.6676349",
"0.6670259",
"0.6662137",
"0.6651152",
"0.66467226",
"0.66434026",
"0.6640774",
"0.6623632",
"0.6623632",
"0.6620787",
"0.65947014",
"0.65609336",
"0.65565205",
"0.6529642",
"0.6519521",
"0.6492687",
"0.64909893",
"0.6489049",
"0.6485294",
"0.6481848",
"0.6477728",
"0.64649165",
"0.64575887",
"0.64529",
"0.64523524",
"0.6451548",
"0.6448631",
"0.64388895",
"0.6437932",
"0.6425761"
] | 0.0 | -1 |
Split the full name into individual characters and run each character against a conditional logic checking to see if it falls under a lower and upper case vowel or lower and upper case consonant or neither. If the vowel or consonant is found return the next character of it's kind and if it's not found under either one just return it. Combine the split characters back into a full name. Return the modified full name. | def alias_modifier(full_name)
low_vowels = ["a", "e", "i", "o", "u"]
up_vowels = ["A", "E", "I", "O", "U"]
low_consonants = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z"]
up_consonants = ["B", "C", "D", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "X", "Y", "Z"]
full_name = full_name.split('')
updated_name = full_name.map do |char|
if low_vowels.include?(char)
low_vowels.rotate[low_vowels.index(char)]
elsif up_vowels.include?(char)
up_vowels.rotate[up_vowels.index(char)]
elsif low_consonants.include?(char)
low_consonants.rotate[low_consonants.index(char)]
elsif up_consonants.include?(char)
up_consonants.rotate[up_consonants.index(char)]
else
char
end
end
updated_name.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fake_name (full_name)\n words_array = full_name.split (\" \")\n swap_name_array = words_array.reverse\n swap_name = swap_name_array.join(\" \")\n letters = swap_name.chars\n fake_letters = []\n letters.each do |letter|\n vowel = %w[a A e E i I o O u U]\n if vowel.include?(letter)\n fake_letters << next_vowel(letter)\n elsif letter == \" \"\n fake_letters << \" \"\n else\n fake_letters << next_unvowel(letter)\n end\nend\n return fake_letters.join (\"\")\nend",
"def nextLetter(full_name)\n vowels = 'aeiou'\n split_letters = full_name.split('')\n split_letters.map! { |letter|\n if letter != \" \"\n if vowels.index(letter.downcase) != nil\n letter = nextVowel(letter)\n else\n letter = nextConsonant(letter)\n end\n else\n # Don't know exactly why this has to be here but I lose my spaces if I\n # don't do it.\n letter = letter\n end\n }\n split_letters.join('')\nend",
"def fake_name_c2(real_name)\n\treal_full_name = real_name.split(\" \")\n\treal_first_name = real_full_name[0] \n\treal_last_name = real_full_name[1]\n\ti = 0\n\tfake_first_name = \"\"\n\tfake_last_name = \"\"\n\tvowel_index = \"\"\n\tlength_first = real_first_name.length\n\tlength_last = real_last_name.length \n\t\twhile i < length_last\n\t\tif real_last_name[i] == \"z\"\n\t\t\tfake_last_name += \"a\"\n\t\telsif real_last_name[i] == \"a\" || real_last_name[i] ==\"e\" || \n\t\t\t real_last_name[i] == \"i\" || real_last_name[i] == \"o\" || \n\t\t\t real_last_name[i] == \"u\"\n\t\t\tfake_last_name += real_last_name[i] \n\t\telse \n\t\t\tfake_last_name += real_last_name[i].next \n\t\tend \n\t\ti+=1\n\tend\n\tfake_last_name\nend",
"def aliass(full_name)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n new_string = \"\"\n \n #break input word into array and iterate through each letter\n #if the letter is a vowel, take it and change it to next_vowel\n #if the letter is a consonant, take it and change it to consonant\n #else just add with no modification\n full_name.split('').each do |letter|\n if vowels.include?(letter)\n new_string += vowel(letter)\n elsif alphabet.include?(letter)\n new_string += consonant(letter)\n else\n new_string += letter\n end\n end\n #transform this new string into an array\n new_word = new_string.split(' ')\n #swap first and second word in array\n new_word.reverse!\n #turn new word into string\n new_word.map {|names| names.capitalize!}\n new_string = new_word.join(\" \")\n end",
"def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n\t#break input word into array and iterate through each letter\n\t#if the letter is a vowel, take it and change it to next_vowel\n\t#if the letter is a consonant, take it and change it to consonant\n\t#else just add with no modification\n\tfull_name.split('').each do |letter|\n\t\tif vowels.include?(letter)\n\t\t\tnew_string += vowel(letter)\n\t\telsif alphabet.include?(letter)\n\t\t\tnew_string += consonant(letter)\n\t\telse\n\t\t\tnew_string += letter\n\t\tend\n\tend\n\t#transform this new string into an array\n\tnew_word = new_string.split(' ')\n\t#swap first and second word in array\n\tnew_word.reverse!\n\t#turn new word into string\n\tnew_word.map {|names| names.capitalize!}\n\tnew_string = new_word.join(\" \")\nend",
"def name_change(normal_name)\nvowels = \"aeiouAEIOU\".split(\"\")\nconsonants = \"bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ\".split(\"\")\n\nchanged_name = normal_name.split(\" \")\nchanged_name[0], changed_name[1] = changed_name[1], changed_name[0]\n split_name = changed_name.join(\" \")\nname = split_name.split(\"\")\n\nnew_name = \"\"\nname.each_with_index do |letter, letter_index|\n if vowels.include?(letter)\n vowels.each_with_index do |vowel, vowel_index|\n if letter === vowel\n if letter === \"u\"\n new_name << \"a\"\n elsif letter === \"U\"\n new_name << \"A\"\n else\n new_name << vowels[vowel_index+1]\n end\n end\n end\nend\n if consonants.include?(letter)\n consonants.each_with_index do |consonant, consonant_index|\n if letter === consonant\n if letter === \"z\"\n new_name << \"b\"\n elsif letter === \"Z\"\n new_name << \"B\"\n else\n new_name << consonants[consonant_index+1]\n end\n end\n end\nend\n if letter === \" \"\n new_name << \" \"\n end\n end\n new_name\nend",
"def name_converter(first_name, last_name)\n #1. swap the order names\n swapped_names = fake_name(first_name, last_name)\n #2 break swappedNames into array\n character_array = swapped_names.split('')\n #3. iterate through array\n vowel = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n consonant = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\",\"y\",\"z\"]\n\n result = ''\n character_array.each do |character|\n if vowel.include?(character)\n #move forward next vowel in vowel array\n if character == 'u'\n result += 'a'\n next\n end \n \n current_index = vowel.index (character)\n new_index = current_index + 1\n #3. go to vowel array with new_index and retrieve that letter\n # next_letter = 'i'\n # add next_letter to result\n result += vowel[new_index]\n\n #follow same steps for moving forward next vowel for consonant \n\n elsif consonant.include?(character)\n if character == \"z\"\n result += 'b'\n next\n end\n\n current_index = consonant.index (character)\n new_index = current_index + 1\n\n result += consonant [new_index]\n\n result += character \n # add new letter to result\n end\n end\n #4. if the character is a vowel do a vowel swap\n #5. elsif the character is a consonant do a consonant swap\n \n result\nend",
"def make_fake_name(name)\n # downcase to avoid issues due to capitalization\n # convert name to an array of characters\n # for each letter,\n name = name.downcase.chars.map! do |letter|\n # if it is a vowel, change it to the next vowel\n if 'aeiou'.include?(letter)\n next_vowel(letter)\n # elsif it is a letter, change it to the next consonant\n elsif ('a'..'z').include?(letter)\n next_consonant(letter)\n # otherwise, nil it\n end\n end\n # convert name back to a string and re-capitalize it\n name = name.join.capitalize\nend",
"def letter_change\n consonant = \"bcdfghjklmnpqrstvwxyz\"\n vowel = \"aeiou\"\n new_name = \"\"\n letter_new = \"\"\n\n split_flip_name.each do |letter|\n if consonant.index(letter) != nil\n letter_new = consonant[consonant.index(letter) + 1]\n elsif vowel.index(letter) != nil\n #addresses last vowel edge case\n if letter == \"u\"\n letter_new = \"a\"\n elsif\n letter_new = vowel[vowel.index(letter) + 1]\n end\n elsif letter == \" \"\n letter_new = letter\n end\n #.to_s addresses a nil edge case\n new_name += letter_new.to_s\n end\n p new_name\n\nend",
"def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n full_name.split('').each do |letter|\n \t\tif vowels.include?(letter)\n \t\t\tnew_string += vowel(letter)\n \t\telsif alphabet.include?(letter)\n \t\t\tnew_string += consonant(letter)\n \t\telse\n \t\t\tnew_string += letter\n \t\tend\nend\n#Transform this new string into an array\n#Swap first and second word in array\n#Turn new word into string\n#Create empty array outside of loop\nnew_word = new_string.split(' ')\n new_word.reverse!\n\nnew_word.map {|names| names.capitalize!}\nnew_string = new_word.join(\" \")\nend",
"def fake_name(real_name)\n\treal_full_name = real_name.split(\" \")\n\treal_first_name = real_full_name[0].downcase \n\treal_last_name = real_full_name[1].downcase\n\talphabet = [\"a\",\"b\", \"c\", \"d\", \"e\",\"f\", \"g\", \"h\",\"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\ti = 0\n\tfake_first_name = \"\"\n\tfake_last_name = \"\"\n\tlength_first = real_first_name.length\n\tlength_last = real_last_name.length \n\n\twhile i < length_first\n\t\tif real_first_name[i] == \"z\"\n\t\t\tfake_first_name += \"a\"\n\t\telsif real_first_name[i] == \"a\" || real_first_name[i] ==\"e\" || \n\t\t\t real_first_name[i] == \"i\" || real_first_name[i] == \"o\" || \n\t\t\t real_first_name[i] == \"u\"\n\t\t\tfake_first_name += real_first_name[i] \n\t\telsif \n\t\t\tind = alphabet.index(real_first_name[i])\n\t\t\tfake_first_name += alphabet[ind+1]\n\t\tend \n\t\ti+=1\n\t\t#fake_first_name[0] = fake_first_name[0].upcase\n\tend \n\tfake_first_name\nend",
"def spy_name(realname)\n\tvowels = ['a','e','i','o','u']\n\tconsonants = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n\treverseName = realname.downcase.split(\" \").reverse!\n\tfullName = reverseName[0] + \" \" + reverseName[1]\n\tletteredName = fullName.split('')\n \tletteredName.map! do |letter|\n \t if vowels.include?(letter)\n \t vowels.rotate(1)[vowels.index(letter)]\n \t elsif consonants.include?(letter)\n \t consonants.rotate(1)[consonants.index(letter)]\n \t end\n \tend\nfullName = letteredName.join('').insert(reverseName[0].length,' ')\nfullName.capitalize!\ntwoNames = fullName.split(\" \")\ntwoNames[1].capitalize!\nfullName = twoNames[0] + \" \" + twoNames[1]\np fullName\nend",
"def make_up_name(name)\nchanged_name = [] #empty array to push letters from name into when it goes through iteration\nvowels = \"aeiou\"\n\nconsonant = \"bcdfghjklmnpqrstvwxyz\"\n\n\n#if the index of the name provided is a consonant then change it to the next letter.\n\nindex = 0 #start at 0\n \n while index < name.length\n \t\tletter = name[index] #takes every index of every letter in name and stores it in a variable\n \t\tif vowels.include?(letter) #deals with edge case\n \t\t\tif letter == \"u\"\n \t\t\t\tchanged_name.push(\"a\")\n \t\t\telse #need to make it so every other vowel changes to next vowel letter.next\n \t\t\tend\n \t\telsif consonant.inlcude?(letter)\n \t\t\tif letter == \"z\" #deals with edge case\n \t\t\t\tchanged_name.push(\"b\")\n \t\t\telse #everything else will need to be next letter using letter.next \t\t \t\t\n \t\t\tend\n \t\telsif letter == \" \"\n \t\t\t\tchanged_name.push(\" \")\n \t\t\tend\n \t\t \t index += 1\n \tend\nnew_name_array = changed_name.join('') #takes all the letters in the array above and puts it in a new array\nnew_name_array.each {|name| p name.capitalize}\nend",
"def spy_alias1 full_name\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n vowels=['a','e','i','o','u']\n alias_name.map! do |letter|\n next_vowel=letter\n vowels.each_index do |index|\n if vowels[index]=='u'&&letter==vowels[index]\n next_vowel='a'\n elsif letter==vowels[index]\n next_vowel=vowels[index+1]\n end\n end\n next_vowel\n end\n \n consonants=['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n alias_name.map! do |letter|\n next_consonant=letter\n consonants.each_index do |index|\n if consonants[index]=='z'&&letter==consonants[index]\n next_consonant='b'\n elsif letter==consonants[index]\n next_consonant=consonants[index+1]\n end\n end\n next_consonant\n end\n \n alias_name=alias_name.join('').split(' ').map! {|name| name.capitalize}.join(' ')\nend",
"def abbreviate_sentence(sentence)\n vowels =\"aeiou\"\n new_word = \"\"\n \n sentence.split(\" \").each do |word| \n word.each_char do |char| \n if vowels.include?(char) && word.length > 4\n char = \"\"\n end\n new_word += char \n end\n new_word += \" \"\n end\n\n new_word\nend",
"def next_letter(name)\n vowels = \"aeiou\".split(\"\")\n consonants = \"bcdfghjklmnpqrstvwxyz\".split(\"\")\n spy_name = []\n \n name.split(\"\").map do |letter|\n if vowels.include?(letter)\n vowels.index(letter)\n index = vowels.index(letter)\n new_letter = vowels[index + 1]\n new_letter\n elsif consonants.include?(letter)\n consonants.index(letter)\n index = consonants.index(letter)\n new_letter = consonants[index + 1]\n new_letter\n elsif letter == \" \"\n new_letter = \" \"\n new_letter\n end\n spy_name.push(new_letter)\n end\n \n spy_name.join(\"\")\nend",
"def make_vowel_change(first)\n\tnew_first = first.split(\"\") \n\ti = 0\n\tfake_firstname = \"\"\n\tlengthfirst = first.length\n\twhile i < lengthfirst\n\tif new_first[i] == \"a\"\n\t\tfake_firstname += \"e\"\n\telsif new_first[i] == \"e\"\n\t\tfake_firstname += \"i\"\n\telsif new_first[i] == \"i\"\n\t\tfake_firstname += \"o\"\n\telsif new_first[i] == \"o\"\n\t\tfake_firstname += \"u\"\n\telsif new_first[i] == \"u\"\n\t\tfake_firstname == \"a\"\n\telsif (new_first[i] != \"a\" || new_first[i] !=\"e\" || new_first[i] != \"i\" || new_first[i] != \"o\" || new_first[i] != \"u\")\n\t\tfake_firstname += new_first[i]\n\tend\n\ti+=1 \n\tend \n\tfake_firstname\nend",
"def secret_name (name)\r\n\tname = name.downcase\r\n\r\n#create temporary name container \r\ntemp_name = \"\"\r\n#make to strings containing vowels and consonants \r\n#handle edge case by copying the first character to the end\r\nvowels = \"aeioua\"\r\nconsonants = \"bcdfghjklmnpqrstvwxyzb\"\r\n#iterate through each character in the name string and find vowels, consonants and spaces\r\n#add the corresponding letter/character to the temporary name variable and return that variable\r\nname.each_char do |letter| \r\n\tif letter == \" \"\r\n\t\ttemp_name += \" \"\r\n\t\t\r\n\telsif vowels.include?(letter)\r\n \t\ttemp_name += vowels[vowels.index(letter).next]\r\n \t\r\n elsif consonants.include?(letter)\r\n \ttemp_name += consonants[consonants.index(letter).next]\r\n \r\nend\r\n end\r\n return temp_name\r\n end",
"def next_vowel(str)\n\t# Need to identify the vowels in the English alphabet in a new variable\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n\t# Need to also identify the consonants in the English alphabet in a new variable\n\tconsonants = [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\n\t\t\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"]\n\twords = str.split # Splitting the name into words based on space (' ')\n\t\n\t## Loop into each name\n\ti = 0 # Setting an index to zero\n\tnew_word = [] # Setting up an empty array for our new scrambled word\n\tmod_word = [] # Setting up an empty array to hold the capitalized scrambled word\n\n\twhile i < words.length # Looping into each word\n\t\tchars = words[i].split('') # Split each word into characters\n\t\tnew_chars = chars.map{|char| # Mapping into each character\n\t\t\tif vowels.include?(char) # If the character is included in the vowels variable\n\t\t\t\tvowels.rotate(1)[vowels.index(char)] # Reassign it to the next vowel\n\t\t\telsif consonants.include?(char) # If the character is included in the consonants variable\n\t\t\t\tconsonants.rotate(1)[consonants.index(char)] # Reassign it to the next consonet\n\t\t\telse\n\t\t\t\tchar # Otherwise don't do anything (In case there are odd characters)\n\t\t\tend\n\t\t}\n\t\tnew_word.push(new_chars.join) # rejoin the word\n\t\t# This bit of code capitalizes the first character of the name\n\t\tmod_word.push(new_word[i].slice(0,1).capitalize + new_word[i].slice(1..-1))\n\t\ti += 1 # increment counter\n\tend\n\treturn mod_word.join(' ') # return the rejoined words\nend",
"def spy_alias2 full_name\n alphabet = {\n vowels: ['a','e','i','o','u'],\n consonants: ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n }\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n alias_name.map! do |letter|\n next_letter=letter\n if alphabet[:vowels].include?(letter)\n index=alphabet[:vowels].index(letter)\n if letter==alphabet[:vowels][-1]\n next_letter=alphabet[:vowels][0]\n else\n next_letter=alphabet[:vowels][index+1]\n end\n elsif alphabet[:consonants].include?(letter)\n index = alphabet[:consonants].index(letter)\n if letter==alphabet[:consonants][-1]\n next_letter=alphabet[:consonants][0]\n else\n next_letter=alphabet[:consonants][index+1]\n end\n end\n next_letter\n end\n alias_name=alias_name.join('').split(' ').map! {|name| name.capitalize}.join(' ')\nend",
"def vowel_changer(name)\n vowel_string = \"aeiou\"\n name_array = name.downcase.chars\n new_name = []\n name_array.each do |character|\n if character == \"u\"\n character = \"a\"\n new_name << character\n elsif vowel_string.include? character\n character = vowel_string[vowel_string.index(character) +1]\n new_name << character\n else\n new_name << character\n end\n end\n new_name.join(\"\").split(\" \").each {|word| word.capitalize!}.join(\" \")\nend",
"def consonant_changer(name)\n consonant_string = \"bcdfghjklmnpqrstvwxyz\"\n name_array = name.downcase.chars\n new_name = []\n name_array.each do |character|\n if character == \"z\"\n character = \"b\"\n new_name << character\n elsif consonant_string.include? character\n character = consonant_string[consonant_string.index(character) +1]\n new_name << character\n else\n new_name << character\n end\n end\n p new_name.join(\"\").split(\" \").each {|word| word.capitalize!}.join(\" \")\nend",
"def name_swapper(full_name)\n full_name = full_name.downcase\n vowel_array = ['a','e','i','o','u']\n consenant_array = \"bcdfghjklmnpqrstvwxyz\".split('')\n name_array = full_name.split(\" \")\n reversed_name= \"#{name_array[1]} #{name_array[0]}\"\n secret_name = reversed_name.split('').map! do |letter|\n if vowel_array.include?(letter)\n vowel_array[vowel_array.index(letter)+1]\n elsif consenant_array.include?(letter)\n consenant_array[consenant_array.index(letter)+1]\n elsif letter == \" \"\n \" \"\n end\n\n end\n puts \"Your name USED to be #{full_name.upcase}...but now your name is #{secret_name.join.upcase}!\"\n secret_name.join.upcase\nend",
"def alias_creator(full_name)\n full_name = full_name.downcase\n name = full_name.split(' ').to_a\n first_name = name[0]\n last_name = name[1]\n first_name_letters = first_name.split('')\n last_name_letters = last_name.split('')\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \"a\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\", \"b\"]\n \n first_name_letters.map! do |letter|\n if vowels.include?(letter)\n letter_index = vowels.index(letter)\n new_letter_index = letter_index + 1\n letter = vowels[new_letter_index]\n elsif consonants.include?(letter)\n letter_index = consonants.index(letter)\n new_letter_index = letter_index + 1\n letter = consonants[new_letter_index]\n end\n end\n new_first_name = first_name_letters.join('').capitalize\n \n last_name_letters.map! do |letter|\n if vowels.include?(letter)\n letter_index = vowels.index(letter)\n new_letter_index = letter_index + 1\n letter = vowels[new_letter_index]\n elsif consonants.include?(letter)\n letter_index = consonants.index(letter)\n new_letter_index = letter_index + 1\n letter = consonants[new_letter_index]\n end\n end\n new_last_name = last_name_letters.join('').capitalize\n\n new_name = new_last_name + \" \" + new_first_name\n return new_name\n \nend",
"def next_letter (name)\n vowels = \"aeiou\".split('')\nalphabet = ('a'..'z').to_a\nconsonants = alphabet - vowels\nname_array = name.split('')\nname_array.map! { |letter|\n if letter == \"u\"\n \"a\"\n elsif letter == \"z\"\n \"b\"\n elsif consonants.include? letter\n consonants[consonants.index(letter) + 1]\n elsif vowels.include? letter\n vowels[vowels.index(letter) + 1]\n else\n letter\n end\n}\nname_array.join('')\nend",
"def change_name(name)\n # swapes names\n name = name.split(' ').reverse.join(' ')\n\n #change all consonant's\n name = name.downcase.split('').map do |l|\n if l.match(/[a,e,i,o,u,\\s]/)\n l = l\n #account for edge case\n elsif l == \"z\"\n l = \"b\"\n else\n l = l.next\n #fixes consonant's that changed into vowels\n if l.match(/[a,e,i,o,u]/)\n l.next\n else\n l = l\n end\n end\n end\n#Loop through vowles\n for i in 0..name.length()-1\n case name[i]\n when \"a\"\n name[i] = \"e\"\n when \"e\"\n name[i] = \"i\"\n when \"i\"\n name[i] = \"o\"\n when \"o\"\n name[i] = \"u\"\n when \"u\"\n name[i] = \"a\"\n end\n end\nname = name.join()\nname = name.split.map(&:capitalize).join(' ')\nputs name\nname\nend",
"def spy_name(str)\n #CREATE VARIABLES FOR VOWELS AND CONSONANTS\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n #CHANGE STRING FIRST INTO ARRAY THAT MAKES EACH WORD A VALUE THEN REVERSE THEM. \n #THEN TURN ARRAY BACK INTO STRING AND DOWNCASE ANY LETTER.\n #THEN TURN STRING BACK INTO ARRAY THAT TAKES EACH INDIVIDUAL CHARACATER AS A VALUE.\n str = str.split(' ').reverse.join.downcase\n str = str.split('')\n #CREATE TEMPORARY VARIABLE STR_NEW TO EQUEL STR THEN CHANGE BUMP EACH \n #VOWEL AND CONSONANT TO THE NEXT ONE IN LINE. \n str_new = str.map do |char|\n if vowels.include?(char)\n vowels.rotate(1)[vowels.index(char)]\n elsif consonants.include?(char)\n consonants.rotate(1)[consonants.index(char)]\n else\n char\n end\n end\n #TURN ARRAY BACK INTO STRING.\n str_new.join\nend",
"def spy_name(real_name) ####Still in progress...######\nnew_name = real_name.downcase\nadjust = new_name.split(' ')\nfirst_n = adjust[0].split('')\nlast_n = adjust[1].split('')\n\n\tindex = 0\n\tuntil index == first_n.last\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\t\tif first_n[index] == [\"a\", \"e\", \"i\", \"o\"]\n\t\t\t\tfirst_n[index] = vowels.next\n\t\t\telsif first_n[index] == \"u\"\n\t\t\t\tfirst_n[index] = \"a\"\n\t\t\telsif first_n[index] == \"z\"\n\t\t\t\tfirst_n[index] = \"b\"\n\t\t\telse first_n[index].next\n\t\t\t\tfirst_n[index] = first_n[index].next\n\t\tend\n\t\tindex += 1\n\tend\n#don't forget to return the method\n\tindex = 0\n\tuntil index == last_n.last\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\t\tif last_n[index] == [\"a\", \"e\", \"i\", \"o\"]\n\t\t\t\tlast_n[index] = vowels.next\n\t\t\telsif last_n[index] == \"u\"\n\t\t\t\tlast_n[index] = \"a\"\n\t\t\telsif last_n[index] == \"z\"\n\t\t\t\tlast_n[index] = \"b\"\n\t\t\telse last_n[index].next\n\t\t\t\tlast_n[index] = last_n[index].next\n\t\tend\n\t\tindex += 1\n\tend\n\n\nend",
"def make_fake_name (name)\n\t# Swap first & last name\n\tswap_name = name.split(' ').reverse.join(' ')\n\n\t# Swap characters - change all vowels to next vowel,\n\t# and all consonants to next consonant\n\n\t# Initialize fake_name & index (counter) variables \n\tfake_name = ''\n\tindex = 0\n\twhile index < swap_name.length\n\t\tchar = swap_name[index]\n\n\t\t# For each character\n\t\tif char == ' '\n\t\t\t# If space, add space\n\t\t\tfake_name += ' '\n\t\telse\n\t\t\t# Handle lower & uppercase properly\n\t\t\tif char == char.downcase\n\t\t\t\tfake_name += get_swapped_char(char)\n\t\t\telse\n\t\t\t\tfake_name += get_swapped_char(char.downcase).upcase\n\t\t\tend\n\t\tend\n\n\t\t# Increment counter\n\t\tindex += 1\n\tend\n\n\tfake_name\nend",
"def change_name(name)\r\n\t#store new name in new variable, downcase, split in an array and reverse order\r\n\tnew_name = name.downcase.split(' ').reverse.join(' ')\r\n\t#return the array of all the letters\r\n\t#p new_name\r\n\t#puts new_name.length\r\n\t#p new_name\r\n\talias_and_real_name = []\r\n\tindex = 0\r\n\tvowel_list = \"aeiou\"\r\n\tconsonant_list = \"bcdfghjklmnpqrstvwxyz\"\r\n\twhile index < new_name.length\r\n\t\t#[index] takes and integer and retunrs char, .index takes a char\r\n\t\t#and returns integer**\r\n\t\t#Does the letter at the # index of new_name match the vowel_list string\r\n\t\tif vowel_list.include?(new_name[index])\r\n\t\t\t#next_vowel_index is a #\r\n\t\t\t#it equals the vowel string at the letter index \r\n\t\t\t#from new_name's # index\r\n\t\t\t#Then get the next number\r\n\t\t\tnext_vowel_index = vowel_list.index(new_name[index]).next\r\n\t\t\t#new_name at that index # now equal this new # \r\n\t\t\t#Equals the vowel list at index of the next #\r\n\t\t\tnew_name[index] = vowel_list[next_vowel_index]\r\n\t\t\t\t#Solve for edge cases\r\n\t\t\t\t#If the letter is the name is going to be the last letter \r\n\t\t\t\t#in the vowel string, change it automatically to \r\n\t\t\t\t#the first on\r\n\t\t\r\n\t\t\t\r\n\t\telsif consonant_list.include?(new_name[index])\r\n\t\t\tnext_consonant_index = consonant_list.index(new_name[index]).next\r\n\t\t\tnew_name[index] = consonant_list[next_consonant_index]\r\n\r\n\t\tend #End if statement\r\n\t\t#Incriment outside of if statment but inside while loop\r\n\t\tindex += 1\r\n\t\r\n\tend #End While loop\r\n\r\n\t#return the new alias name\r\n\tnew_name\r\n\t\r\n\t#Take the alias name and stoe it in an array, new name first and real \r\n\t#name second\r\n\talias_and_real_name << new_name << name\r\n\t\r\n#End method\t\t\r\nend",
"def next_letter(reversed_name)\n vowels = 'aeioua'\n consonants = 'bcdfghjklmnpqrstvwxy'\n #reversed name to array\n reversed_name_array = reversed_name.split('')\n #check if letter is vowel if so make it next vowel\n #check if letter is consonant if so make it next consonant\n reversed_name_array.map! { |letter|\n if vowels.index(letter) != nil\n new_vowel = vowels.index(letter) + 1\n letter = vowels[new_vowel]\n elsif consonants.index(letter) != nil\n new_consonant = consonants.index(letter) + 1\n letter = consonants[new_consonant]\n else\n letter = letter\n end\n }\n reversed_name_array_joined = reversed_name_array.join\nend",
"def first_name_second_letter_vowel\n @@VOWELS.include?(first_name[1])\n end",
"def full_name\n name = first_name.strip # required\n name << \" #{middle_name.strip}\" if !middle_name.nil?\n name << \" #{last_name.strip}\" # required\n name << \" #{mother_last_name.strip}\" if !mother_last_name.nil?\n\n # capitalize each word and return the capitalized version\n name.split.map(&:capitalize).join(' ')\n end",
"def alias_manager(name)\n name = name.downcase\n name = name.split(\" \").reverse.join(\" \")\n name = name.split(\"\")\n index = 0\n consonant = \"bcdfghjklmnpqrstvwqyz\"\n vowel = \"aeiou\"\n while index < name.length\n if\n !consonant.index(name[index]) && !vowel.index(name[index])\n elsif\n index_of_letter = vowel.index(name[index])\n new_letter = vowel[index_of_letter + 1]\n name[index] = new_letter\n else\n index_of_letter = consonant.index(name[index])\n new_letter = consonant[index_of_letter + 1]\n name[index]= new_letter\n end\n index += 1\n end\n name.join(\"\")\nend",
"def next_letter(full_name)\r\n\tidx = 0\r\n\twhile idx < full_name.length\r\n\t\tname = full_name.split('')\r\n\t\tname.map! { |letter| letter.next unless (letter.next == \"!\") }\r\n\t\tidx += 1\r\n\tend\r\n\tname\r\nend",
"def convert_vowels(full_name)\n\tconverted_name = \"\"\n\n\tfull_name.each_char do |character|\n\t\tconverted_name = converted_name + convert_vowel(character)\n\tend\n\n\treturn converted_name\nend",
"def next_vowel_consonant(str) \r\n #create an array with only vowels or consonants\r\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\",\"a\"]\r\n\tconsonants = (\"a\"..\"z\").to_a\r\n consonants.reject! { |letter| vowels.include?(letter)}\r\n consonants << \"b\" #for looping back to b when z is the letter\r\n\t\r\n\t#convert input into an array of each letter\r\n\tname_array = str.split(\"\")\r\n\t\r\n\t#iterate through each letter\r\n\tname_array.each_with_index do |letter,index|\r\n\t \r\n\t #if it is a vowel, find and replace with next\r\n\t if vowels.include?(letter)\r\n\t vowel_index = vowels.index(letter) + 1\r\n\t str[index] = vowels[vowel_index]\r\n\t \r\n \t #if it is a consonant, find and replace with next\r\n\t elsif consonants.include?(letter)\r\n\t \tc_index = consonants.index(letter) + 1\r\n\t str[index] = consonants[c_index]\r\n\t end\r\n\tend\r\n\tstr\r\nend",
"def fake_name(name)\n\n name_array = name.split('')\n\n name_array.map! do |letter|\n vowels = ['a','e','i','o','u', 'a']\n i = 0\n until i>vowels.length\n if i == 5\n letter = letter.next\n if vowels.include?(letter.downcase)\n letter = letter.next\n end\n break\n elsif letter.downcase == vowels[i]\n letter = vowels[i+1]\n break\n elsif letter.downcase == \" \"\n break\n else\n i += 1 \n end \n end\n letter\n end\n\n p name_array \n\n final_name = name_array.join.split(' ')\n\n final_name.map! do |letter|\n letter.capitalize\n end\n\n final_name2 = final_name.rotate.join(' ')\n\n return final_name2\n\nend",
"def vowel_or_consonant\n puts \"What is your first name?\"\n #request first name\n first_name = gets.chomp.downcase\n #save user input, remove capitalization\n puts \"What is your last name?\"\n #request for users last name\n last_name = gets.chomp.downcase\n #save user input, remove capitalization\n #method to check for letter type\n vowels_first = first_name.gsub(/[aeiou]/,'a'=>'e','e'=>'i','i'=>'o','o'=>'u','u'=>'a')\n #check first name for vowels, replaces with next vowel\n vowels_last = last_name.gsub(/[aeiou]/,'a'=>'e','e'=>'i','i'=>'o','o'=>'u','u'=>'a')\n consonant_first = vowels_first.gsub(/[bcdfghjklmnpqrstvwxyz]/, 'b'=>'c', 'c'=>'d', 'd'=>'f', 'f'=>'g', 'g'=>'h', 'h'=>'j', 'j'=> 'k', 'k'=>'l', 'l'=>'m', 'm'=>'n', 'n'=>'p', 'p'=>'q', 'q'=>'r', 'r'=>'s', 's'=>'t', 't'=>'v', 'v'=>'w', 'w'=>'x', 'x'=>'y', 'y'=>'z', 'z'=>'b')\n consonant_last = vowels_last.gsub(/[bcdfghjklmnpqrstvwxyz]/, 'b'=>'c', 'c'=>'d', 'd'=>'f', 'f'=>'g', 'g'=>'h', 'h'=>'j', 'j'=> 'k', 'k'=>'l', 'l'=>'m', 'm'=>'n', 'n'=>'p', 'p'=>'q', 'q'=>'r', 'r'=>'s', 's'=>'t', 't'=>'v', 'v'=>'w', 'w'=>'x', 'x'=>'y', 'y'=>'z', 'z'=>'b')\n spy_name = \"#{consonant_last.capitalize} #{consonant_first.capitalize}\"\n #declares spy name\n puts \"The name #{first_name.capitalize} #{last_name.capitalize} turns into #{spy_name}\"\n #displays product of method\nend",
"def make_vowel_change_2(last)\n\tnew_last = last.split(\"\") \n\ti = 0\n\tfake_lastname = \"\"\n\tlengthlast = last.length\n\twhile i < lengthlast\n\tif new_last[i] == \"a\"\n\t\tfake_lastname += \"e\"\n\telsif new_last[i] == \"e\"\n\t\tfake_lastname += \"i\"\n\telsif new_last[i] == \"i\"\n\t\tfake_lastname += \"o\"\n\telsif new_last[i] == \"o\"\n\t\tfake_lastname += \"u\"\n\telsif new_last[i] == \"u\"\n\t\tfake_lastname == \"a\"\n\telsif (new_last[i] != \"a\" || new_last[i] !=\"e\" || new_last[i] != \"i\" || new_last[i] != \"o\" || new_last[i] != \"u\")\n\t\tfake_lastname += new_last[i]\n\tend\n\ti+=1 \n\tend \n\tfake_lastname\nend",
"def name_muddler (array)\nvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\nconsonants = \"bcdfghjklmnpqrstvwxyz\"\nconsonant_array = consonants.chars \nnew_name = []\nindex = 0\nwhile index < array.length\n if array[index] == \"u\"\n new_name[index] = \"a\"\n elsif vowels.include?(array[index])\n new_name[index] = vowels[vowels.index(array[index]).next]\n elsif array[index] == \"z\"\n new_name[index] = \"b\"\n else new_name[index] = consonant_array[consonant_array.index(array[index]).next]\n end\n index += 1\nend \nreturn new_name\nend",
"def next_vowel(name)\n name = name.split('')\n name.each do |indivLetter| \n if indivLetter == \"a\"\n indivLetter.replace(\"e\")\n elsif indivLetter == \"e\"\n indivLetter.replace(\"i\")\n elsif indivLetter == \"i\"\n indivLetter.replace(\"o\")\n elsif indivLetter == \"o\"\n indivLetter.replace(\"u\")\n elsif indivLetter == \"u\"\n indivLetter.replace(\"a\")\n end\n end\nend",
"def next_vowcon(oldlet) #actually takes in the whole name (not just 1 letter), since it is only split to an array of [first_name, last_name]\r\n vowel = ['a','e','i','o','u']\r\n rot_vow = vowel.rotate #reverses vowel array\r\n consonant = 'bcdfghjklmnpqrstvwxzy'.split('')\r\n rot_cons= consonant.rotate #reverses consonant array\r\n i=0\r\n while i < oldlet.length\r\n if vow_index = vowel.index(oldlet[i])\r\n oldlet[i] = rot_vow[vow_index]\r\n else\r\n cons_index = consonant.index(oldlet[i])\r\n oldlet[i] = rot_cons[cons_index]\r\n end\r\n i +=1\r\n end\r\n return oldlet\r\nend",
"def abbreviate_sentence(sent)\n seperate = sent.split(\" \")\n \n i = 0\n new =\"\"\n j = 0\n while i < seperate.length\n if seperate[i].length > 4\n while j < seperate[i].length\n if seperate[i][j] !=\"o\" && seperate[i][j] !=\"e\" && seperate[i][j] !=\"a\" && seperate[i][j] !=\"i\" && seperate[i][j] !=\"u\"\n new << seperate[i][j]\n end\n j += 1\n end \n new << \" \"\n j = 0\n else \n new << seperate[i]\n new << \" \"\n end \n i += 1\n end\n return new\n end",
"def vowel_changer(name)\n vowel_guide = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n name.each do |names|\n name = names.split('')\n name\n name.map! do |char|\n index = 0\n while index < vowel_guide.length\n if char == vowel_guide[index]\n char = vowel_guide[index += 1]\n index += 1\n elsif char == \"u\"\n char = \"a\"\n index += 1\n else\n char\n index += 1\n end\n\n end\n char\n end\n name\n end\n name\nend",
"def fakeName(name)\r\n\tnameLen = name.length\r\n\tnameIndex = 0\r\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n\tcons = [\"b\", \"c\",\"d\", \"f\",\"g\", \"h\",\"j\", \"k\",\"l\", \"m\",\"n\", \"p\",\"q\", \"r\",\"s\", \"t\",\"v\", \"x\", \"z\",\"w\", \"y\"]\r\n\tnewName = \"\"\r\n\twhile nameIndex < nameLen\r\n\t\tvowelArrayIndex = 0\r\n\t\tvowels.each do |vow|\r\n\t\t\tif name[nameIndex] == vow\r\n\t\t\t\tnextchar = next_vowel(vowelArrayIndex)\r\n\t\t\t\tnewName = newName + nextchar\r\n\t\t\tend\r\n\t\t\tvowelArrayIndex += 1\r\n\t\tend\r\n\t\tvowelArrayIndex = 0\r\n\t\tconsArrayIndex = 0\r\n\t\tcons.each do |cons|\r\n\t\t\tif name[nameIndex] == cons\r\n\t\t\t\tnextchar = next_cons(consArrayIndex)\r\n\t\t\t\tnewName = newName + nextchar\r\n\t\t\tend\r\n\t\t\tconsArrayIndex += 1\r\n\t\tend\r\n\t\tnameIndex += 1\r\n\tend\r\n\treturn newName\r\nend",
"def alias\n puts \"Hello Agent, what is your name?\"\n original_name = gets.chomp.downcase\n\n# split first and last name into two arrays\n#swap first name and last name \n\n split_name = original_name.split\n reverse_name = split_name.reverse!\n \n #join back together in a string with a space\n new_name = reverse_name.join(\" \")\n \n\n# each character into it's own array\n\n letters = new_name.each_char.to_a\n#vowel logic\n#if a charcters = vowel then change to next vowel\n\n\n\n vowels = %w(a e i o u a)\n consonant = %w(b c d f g h j k l m n p q r s t v w x y z b)\n new_alias = letters.map do |letter|\n letter.next \n end\nputs new_alias.join('')\nend",
"def full_name\n new_name = first_name.capitalize + \" \" + last_name.capitalize\n final_name = new_name.split(' ').each(&:capitalize!).join(' ')\n end",
"def codeName (str)\n\tstr = str.to_s.downcase.split(' ')\n\tk = str[0]\n\tstr[0] = str[1]\n\tstr[1] = k\n\tvowels = \"aeiou\"\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\t\n\tlastName = str[0].chars\n\tfirstName = str[1].chars\n\t\n\tfor i in 0..(lastName.length-1)\n\t\tif lastName[i] == \"a\" || lastName[i] == \"e\" || lastName[i] == \"i\" || lastName[i] == \"o\" || lastName[i] == \"u\"\n\t\t\tlastName[i] = vowels[vowels.index(lastName[i])+1]\n\t\telse\n\t\t\tlastName[i] = consonants[consonants.index(lastName[i])+1]\n\t\tend\n\tend\n\t\n\tfor i in 0..(firstName.length-1)\n\t\tif firstName[i] == \"a\" || firstName[i] == \"e\" || firstName[i] == \"i\" || firstName[i] == \"o\" || firstName[i] == \"u\"\n\t\t\tfirstName[i] = vowels[vowels.index(firstName[i])+1]\n\t\telse\n\t\t\tfirstName[i] = consonants[consonants.index(firstName[i])+1]\n\t\tend\n\tend\n\tstr[0] = lastName.join('').capitalize\n\tstr[1] = firstName.join('').capitalize\n\tstr.join(' ')\n\t\nend",
"def format_name(first, last)\n return nil if first.empty? || last.empty?\n f = first.delete(\" \")\n l = last.delete(\" \")\n username = f[0]\n username << l\n user = username.downcase\n user.gsub(/[\\W]/, '') # this is meant to remove special characters, but it doesn't work!\nend",
"def short_name \r\n name.gsub(/([A-Z])[^A-Z]+/, '\\1')\r\n end",
"def parse_name(full_name)\n letter = full_name[0].upcase\n octave = full_name[/\\d+/].to_i\n accidental = full_name[/[b#x]+/] || \"\"\n return letter, octave, accidental\n end",
"def abbreviate_sentence(sent)\n vowels = 'aeiou'\n new_sent = []\n sent.split.each do |ele|\n if ele.length > 4\n ele.each_char { |char| vowels.include?(char) ? next : new_sent << char }\n else \n new_sent << ele \n end\n \n new_sent << ' ' if ele != sent.split.last\n end\n\n new_sent.join\nend",
"def vowels_consonant_movement2(name)\n name = name.downcase.split(\" \")\nfirst_name = name[0]\nsecond_name = name[1]\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n translated_name = []\n translated_name2 = []\n\n#adjust first name \n x = 0 \n while x < first_name.length\n if first_name[x] == \"z\"\n first_name[x] = \"b\"\n translated_name << first_name[x]\n elsif\n first_name[x] == \"u\"\n first_name[x] = \"a\"\n translated_name << first_name[x]\n \n elsif consonants.include?first_name[x]\n \n new_position = consonants.index(first_name[x]) + 1 \n \n first_name[x] = consonants[new_position]\n translated_name << first_name[x]\n \n elsif vowels.include?first_name[x]\n newer_position = vowels.index(first_name[x]) + 1\n first_name[x] = vowels[newer_position]\n translated_name << first_name[x]\n \n end\n \n x += 1\n end\n \n#adjust second name \n x = 0 \n while x < second_name.length\n if second_name[x] == \"z\"\n second_name[x] = \"b\"\n translated_name2 << second_name[x]\n elsif\n second_name[x] == \"u\"\n second_name[x] = \"a\"\n translated_name2 << second_name[x]\n \n elsif consonants.include?second_name[x]\n \n new_position = consonants.index(second_name[x]) + 1 \n \n second_name[x] = consonants[new_position]\n translated_name2 << second_name[x]\n \n elsif vowels.include?second_name[x]\n newer_position = vowels.index(second_name[x]) + 1\n second_name[x] = vowels[newer_position]\n translated_name2 << second_name[x]\n \n end\n \n x += 1\n end\n \n first_letter = translated_name[0].upcase\n translated_name.delete_at(0)\n translated_name.insert(0, first_letter)\n \n first_letter2 = translated_name2[0].upcase\n translated_name2.delete_at(0)\n translated_name2.insert(0, first_letter2)\n \n return translated_name2.join(\"\") + \" \" + translated_name.join(\"\")\n \n \nend",
"def create_alias(real_name)\n\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\",\n \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\",\n \"v\", \"w\", \"x\", \"y\", \"z\"]\n\n # takes the real name, splits into words, reverses the order, joins into string again, and lowercases\n reversed_lowcase_str = real_name.split(\" \").reverse.join(\" \").downcase\n name_char_array = reversed_lowcase_str.chars\n fake_name_char_arr = name_char_array.map! do |letter|\n if letter == \" \"\n letter\n elsif letter == \"u\"\n letter = \"a\"\n elsif letter == \"z\"\n letter = \"b\"\n elsif vowels.include?(letter)\n letter = vowels[vowels.index(letter) + 1] # assigns the letter to be the next vowel\n elsif consonants.include?(letter)\n letter = consonants[consonants.index(letter) + 1]\n end\n end\n\n# rejoins the character array into one string, splits it into word array,\n# capitalizes each word, rejoins into string\n fake_name = fake_name_char_arr.join(\"\").split(\" \").map!{|name| name.capitalize}.join(\" \")\nend",
"def alias_maker(name)\n \n consonants = \"bcdfghjklmnpqrstvwxz\"\n next_cons = \"cdfghjklmnpqrstvwxzb\"\n \n name.downcase.tr(consonants,next_cons)\n .tr('aeiouy', 'eiouya')\n .split.reverse.each {|word| word.capitalize!}\n .join(' ')\n\n # Separated methods on lines 24-27 for readability\n # First .tr changes all consonants to next\n # Second .tr changes all vowels to next vowel\n # Split names to reverse and capitalize them\n # Rejoin to a single string\n\nend",
"def abbreviate_sentence(sent)\n seperate = sent.split(\" \")\n \n i = 0\n new =\"\"\n j = 0\n vowels=\"aeiou\"\n while i < seperate.length\n if seperate[i].length > 4\n while j < seperate[i].length\n if !vowels.include?(seperate[i][j])\n new << seperate[i][j]\n end\n j += 1\n end \n new << \" \"\n j = 0\n else \n new << seperate[i]\n new << \" \"\n end \n i += 1\n end\n return new\n end",
"def name_change(real_name)\r\n\tnew_name = real_name.downcase.split(' ')\r\n\tnew_name.map! { |real_name|\r\n\t\treal_name.split('').map! { |char|\r\n\t\t\tif \"aeiou\".index(char) != nil\r\n\t\t\t\tchange_char(char, \"aeiou\")\r\n\t\t\telse \r\n\t\t\t\tchange_char(char, \"bcdfghjklmnpqrstvwxyz\")\r\n\t\t\tend\r\n\t\t}\r\n\t}\r\n\tnew_first_name = new_name[1].join('')\r\n\tnew_last_name = new_name[0].join('')\r\n\treturn new_first_name.capitalize + \" \" + new_last_name.capitalize\r\nend",
"def alias_creator(nickname)\nvowels=\"aeiou\"\nconsonants=\"bcdfghjklmnpqrstvwxyz\"\n#consonants exclude all vowels\n\nnickname_split=nickname.split(\"\")\nnew_nickname=[]\n#The translated nickname will be saved in the new_nickname arrawy\n\nnickname_split.map! do |x|\n\tif vowels.include?(x)\n\t\tnew_nickname << vowels[vowels.index(x)+1]\n\telsif consonants.include?(x)\n\t\tnew_nickname << consonants[consonants.index(x)+1]\n\telsif x == \" \"\n\t\tnew_nickname << \" \"\n\tend\nend\nnew_nickname.join(\"\").split.map {|x| x.capitalize}.join(\" \")\n#We are doing this so that we capitalize the first letter of both words\nend",
"def consonant_converter(string)\r\n name_array = string\r\n consonant = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\r\n counter = 0\r\n consonant_counter = 0\r\n# Outer loop that loops through entire name (first and last)\r\n while counter < name_array.length\r\n# Inner loop that loops through list of consonants, compares them with name, and changes consonants in name\r\n \twhile consonant_counter < consonant.length\r\n \t\tif name_array[counter] == consonant[consonant_counter]\r\n if name_array[counter] == 'z'\r\n \tname_array[counter] = 'b'\r\n break\r\n else\t\r\n \t\t name_array[counter] = consonant[consonant_counter + 1]\r\n \t\t break\r\n \t\t end\r\n \t end\r\n consonant_counter += 1\r\n end\r\n counter += 1\r\n consonant_counter = 0\r\n end \r\n new_name = name_array.join('')\r\n new_name = new_name.split(' ')\r\n new_name.map! { |word| word.capitalize! }\r\n new_name = new_name.join(' ')\r\n return new_name\r\nend",
"def process_word word\n const_match = /^[BCDFGHIJKLMNPQRSTVWXYZbcdfhhtjklmnpqrstvwxyz]+/.match(word)\n letter_match = /^[a-zA-Z]+/.match(word) #Match letters only\n other_chars = word[letter_match.to_s.length..-1]\n if const_match.to_s.length > 0\n return const_trans(letter_match.to_s, const_match) + other_chars\n else\n return vowel_trans(letter_match.to_s) + other_chars \n end\n \n end",
"def change_name(name)\n\t\t# create alphabet range\n\t\tvowels = 'aeiou'\n\t\tvowel_change = vowels.split('').reverse\n\t\tconsonants = 'abcdefghijklmnopqrstuvwxyz'\n\t\tconsonant_change = consonants.delete('aeiou').split('').reverse\n\n\t\toriginal_name = name\n\t\tname_reverse = original_name.downcase.split.reverse.join('').split('')\n\n\n\t\tnew_name = name_reverse.map do |letter|\n\t\t\tif vowels.include?(letter)\n\t\t\t\tvowel_change[vowel_change.index(letter)-1]\n\t\t\telsif consonants.include?(letter)\n\t\t\t\tconsonant_change[consonant_change.index(letter)-1]\n\t\t\telse\n\t\t\t\tletter\n\t\t\tend\nend\n\nfinal_name = new_name.join.split.map { |name| name.capitalize}.join('')\nend",
"def pig_latin_name(word)\n# and returns a new string (pig latinified)\n# need to define vowels (can be an array?)\n vowels_list = vowels\n# break word into letters\n letters = word.split(\"\")\n# iterate through each letter of the word\n# until we hit a vowel\n letters.each do |letter|\n\n # check if first letter is vowel or consonant\n if is_consonant?(letter)\n # move it to the end\n removed_consonant = letters.shift\n letters = letters + removed_consonant.split\n #\n else\n letters.push(\"ay\")\n return letters.join\n end\n\n # then add \"ay\" at the end and return\n end\n\nend",
"def undercover_name(name)\n name.downcase.split(' ').map!{|name| name.split('').map! {|letter| next_letter(letter)}.join('').capitalize}.reverse.join(\" \")\nend",
"def nameSwitch(name)\n vowels = 'aeiou'\n new_name = ''\n newname = name.split(' ').reverse.join(' ')\nend",
"def reverberate(sent)\n new_arr = []\n words_arr = sent.split(\" \")\n vowels = \"aeiouAEIOU\"\n words_arr.each do |word|\n capt = false\n if word.capitalize == word\n capt = true\n end\n if word.length < 3\n new_arr << capt ? word.capitalize : word #new_arr << capt ? word.capitalize : word\n elsif vowels.include?(word[-1])\n new_arr << (capt ? (word * 2).capitalize : word * 2)\n elsif !vowels.include?(word[-1])\n rev_index = word.chars.reverse.index { |char| vowels.include?(char) }\n i = word.length - 1 - rev_index\n new_arr << (capt ? (word + word[i..-1]).capitalize : word + word[i..-1])\n end\n end\n new_arr.join(\" \")\nend",
"def alias_genrator\n done = false\n real_names = []\n spy_names = []\n\n puts \"Welcome to the super secret alias name generator. What is your full name?\"\n real_name = gets.chomp.downcase\n\n until done\n done = false\n\n real_name_array = real_name.split(' ') # Turn name into array\n\n real_first_name = real_name_array[0].capitalize # Gets and capitalizes first string in real_first_name\n real_last_name = real_name_array.last.capitalize # Gets and capitalizes last string in real_first_name\n\n real_names << real_first_name + \" \" + real_last_name # Stores real name to an array\n\n name_letters = real_name.split('') # Turns user input into array of letters\n\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\" ]\n\n index = 0\n name_letters.each do |letter| # Checks each letter in name_letters to see if the letter is in the vowels array\n if letter == \"u\"\n name_letters[index] = \"a\"\n elsif\n if vowels.include?(letter) # If it is, store the index of the vowel plus one\n vowel_index = vowels.index(letter)+1\n name_letters[index] = vowels[vowel_index] # Store the new letter in the corresponding index of name_letters\n end\n end\n index+=1\n end\n\n index = 0\n name_letters.each do |letter| # Checks each letter in name_letters to see if the letter is in the consonants array\n if letter == \"z\"\n name_letters[index] = \"b\"\n elsif\n if consonants.include?(letter) # If it is, store the index of the consonants plus one\n consonant_index = consonants.index(letter)+1\n name_letters[index] = consonants[consonant_index] # Store the new letter in the corresponding index of name_letters\n end\n end\n index+=1\n end\n\n new_full_name = name_letters.join('').split(' ') # Joins the new letters of name_letters and splits it into two strings\n\n # In case spy's real name includes a middle name\n first_name = new_full_name[0].capitalize # Gets and capitalizes first string in new_full_name\n last_name = new_full_name.last.capitalize # Gets and capitalizes last string in new_full_name\n\n alias_name = last_name + \" \" + first_name\n\n spy_names << alias_name # Stores alias into an array\n\n p \"Great, your cool new alias is #{alias_name}! Enter another name or type 'done' to exit.\"\n answer = gets.chomp.downcase\n\n if answer == \"done\" # Checks if user is done\n done = true\n else\n real_name = answer\n end\n end\n\n num_of_spies = real_names.length # Gets the number of spies\n counter = 0\n\n while counter < num_of_spies\n p \"#{spy_names[counter]} is really #{real_names[counter]}\" # Prints spies real names and aliases\n counter+=1\n end\nend",
"def code_name(word)\n#set a new word to an empty string, we are going to fill it using the rest of the loop:\n\tnew_word = \"\"\n#start index at 0\n\ti = 0\n#loop through the string:\n\twhile i < word.length\n#letter is going to be the index of the word put in, starting at the 0 position until the end of the word's length\n\tletter = word[i]\n#if a space is found, add a space to the new word\n\t\tif letter == ' '\n\t\tnew_word += ' '\n#everything else, find the next letter or the next vowel or next edge case, and add it to the new word\n\t\telse\n\t\t letter == letter.downcase\n\t\tnew_word += vowels_and_edges(letter)\n \t\tend\n \t\ti += 1\n end\n#should result in a new word, when all strings are pieced together \n new_word\nend",
"def full_name\n \"#{first_name} #{last_name}\".gsub(/\\b('?[a-z])/) { $1.capitalize }.strip\n end",
"def advance_letter letter\n vowel='aeiou'\n consonant='bcdfghjklmnpqrsvwxyz'\n if vowel.include?(letter)\n if letter==vowel[-1]\n letter=vowel[0]\n else\n letter=vowel[vowel.index(letter)+1]\n end\n elsif consonant.include?(letter)\n if letter==consonant[-1]\n letter=consonant[0]\n else\n letter=consonant[consonant.index(letter)+1]\n end\n end\n letter\nend",
"def double_consonants(string)\n new_string = ''\n string.each_char do |char|\n if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n new_string << char << char\n else\n new_string << char\n end\n end\n new_string\nend",
"def alias_manager\nname = \"\"\nvowels = \"aeiou\"\nconsonants = \"bcdfghjklmnpqrstvwxyz\"\ninput = \"\"\nuser_input = []\ncapitalized_name_storage = []\ncounter = 0\n\nwhile input != \"quit\"\nputs \"What is your first and last name? Please separate with a space. Type 'quit' to exit.\"\ninput = gets.chomp\nif input == \"quit\"\n puts \"Thanks for using Alias Manager.\"\nelse\n user_input << input\n name = input.downcase.split(' ').reverse.join(' ')\n reverse_name = name\n split_reverse = reverse_name.chars\n new_name = \"\"\n split_reverse.map! do |letter|\n if letter == \" \"\n new_name += \" \"\n elsif letter.scan(/[aeiou]/).join == \"a\" ||\n letter.scan(/[aeiou]/).join == \"e\" ||\n letter.scan(/[aeiou]/).join == \"i\" ||\n letter.scan(/[aeiou]/).join == \"o\"\n index = vowels.index(letter)\n new_name += vowels[index + 1]\n elsif letter.scan(/[aeiou]/).join == \"u\"\n index = vowels.index(letter)\n new_name += \"a\"\n elsif letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"b\" || letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"c\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"d\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"f\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"g\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"h\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"j\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"k\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"l\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"m\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"n\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"p\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"q\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"r\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"s\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"t\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"v\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"w\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"x\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"y\"\n index = consonants.index(letter)\n new_name += consonants[index + 1]\n elsif letter == \"z\"\n new_name += \"b\"\n else\n p \"ERROR, UNRECOGNIZED CHARACTER\"\n end\n end\n\n capitalized_name_array = new_name.split(' ').map! {|name| name. capitalize}\n p capitalized_name = capitalized_name_array.join(' ')\n capitalized_name_storage << capitalized_name\nend\nend\nputs \"Summary:\"\nuser_input.each do |name|\n puts \"Name converted: #{name} is now #{capitalized_name_storage[counter]}.\"\n counter += 1\nend\nend",
"def double_consonants(str)\nnew_str = \"\"\n\nstr.each_char do |char|\n\tif /[aeiou\\W\\d\\s]/ =~ char \n\t\tnew_str << char\n\telse\n\t\tnew_str << char << char\n\tend\nend\nnew_str\nend",
"def next_vowel(name)\n\tvowels = %w( a e i o u )\n\tname = name.downcase!.split('')\n\tnew_name = name.map do |vowels_method|\n\t\tif vowels.include?(vowels_method)\n\t\t\tvowels.rotate(1)[vowels.index(vowels_method)]\n\t\telsif vowels == 'u'\n\t\t\tvowels.replace('a')\t\n\t\telse\n\t\t\tvowels_method\n\t\tend\n\tend\n\tnew_name.join.capitalize\nend",
"def reverberate(sentence)\n vowels = \"aeiou\"\n words = sentence.split(\" \")\n converted_sentence = []\n\n words.each do |word|\n if word.length < 3\n converted_sentence << word\n elsif vowels.include?(word[-1].downcase)\n converted_sentence << word + word[0].downcase + word[1..-1]\n else\n uppercase = word[0] == word[0].upcase ? true : false\n count = word.length - 1\n\n while count > 0\n if vowels.include?(word[count])\n new_word = word + word[count..-1]\n converted_sentence << new_word\n break\n end\n count -= 1\n end\n end\n end\n\n converted_sentence.join(\" \")\nend",
"def LetterChanges(str)\n str = str.split(\"\")\n \n str.each do |c|\n c.next! if c =~ /[a-z]/\n c.upcase! if c =~ /[aeiou]/\n end\n \n return str.join\nend",
"def display_word(word, triedchars)\n res = \"\"\n word.split(\"\").each do |char|\n if triedchars.include?(char.upcase) or not char.match(/^[[:alpha:]]$/)\n res += char\n elsif\n res += \"_\"\n end\n end\n res\nend",
"def make_fake_full_name (full_name)\n # put names into an array and swap first and last (if you wanted a string instead: name.partition(' ').reverse.join)\n full_name = full_name.split(' ').reverse\n # for each name, replace it with a fake name\n full_name.map! {|name| make_fake_name(name)}\n # convert the full name back to a string with a space between the partial names\n full_name = full_name.join(' ')\nend",
"def LetterChanges(str)\r\n str = str.split(\"\")\r\n str.each do |x|\r\n x.next! if x =~ /[a-z]/\r\n x.upcase! if x =~ /[aeiou]/\r\n end\r\n return str.join(\"\")\r\nend",
"def short_country_name(name)\n if name.include? ' '\n temp = name.split(' ')\n temp[0][0] + temp[1][0]\n else\n name[0..2].upcase\n end\nend",
"def short_country_name(name)\n if name.include? ' '\n temp = name.split(' ')\n temp[0][0] + temp[1][0]\n else\n name[0..2].upcase\n end\nend",
"def next_consonant(name)\n name = name.downcase\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n i = 0\n consonants_changed = \"\"\n\n until i == name.length\n consonants_index = consonants.index(name[i])\n if consonants_index == nil\n consonants_changed += name[i]\n elsif consonants_index == 20\n consonants_changed += \"b\"\n else\n consonants_changed += consonants[consonants_index+1]\n end\n i = i + 1\n end\n return consonants_changed\n end",
"def name_to_alias(string)\n #--variables to be used inside the while loop--#\n vowels_downcase = \"aeiou\"\n vowels_downcase_array = vowels_downcase.split('')\n vowels_upcase = \"AEIOU\"\n vowels_upcase_array = vowels_upcase.split('')\n consonants_downcase = \"bcdfghjklmnpqrstvwxyz\"\n consonants_downcase_array = consonants_downcase.split('')\n consonants_upcase = \"BCDFGHJKLMNPQRSTVWXYZ\"\n consonants_upcase_array = consonants_upcase.split('')\n #--loop that iterates through and modifies a string--#\n alias_string = \"\"\n count = 0\n while count < string.length\n if string[count] == \" \"\n alias_string[count] = \" \"\n count +=1\n elsif string[count].downcase == \"z\"\n if string[count] == \"z\"\n alias_string[count] = \"b\"\n else\n alias_string[count] = \"B\"\n end\n count += 1\n elsif string[count].downcase == \"u\"\n if string[count] == \"u\"\n alias_string[count] = \"a\"\n else\n alias_string[count] = \"A\"\n end\n count += 1\n elsif vowels_downcase_array.include? string[count]\n converted = vowels_downcase.index(string[count]) + 1\n alias_letter = vowels_downcase[converted]\n alias_string[count] = alias_letter\n count += 1\n elsif consonants_downcase_array.include? string[count]\n converted = consonants_downcase.index(string[count]) + 1\n alias_letter = consonants_downcase[converted]\n alias_string[count] = alias_letter\n count += 1\n elsif vowels_upcase_array.include? string[count]\n converted = vowels_upcase.index(string[count]) + 1\n alias_letter = vowels_upcase[converted]\n alias_string[count] = alias_letter\n count += 1\n elsif consonants_upcase_array.include? string[count]\n converted = consonants_upcase.index(string[count]) + 1\n alias_letter = consonants_upcase[converted]\n alias_string[count] = alias_letter\n count += 1\n else\n alias_string[count] = \" \"\n count += 1\n end\n end\nalias_string\nend",
"def vowel_converter(swapped_name)\r\n\t# Forces all letters to be lower case in order for code to work properly\r\n\tcode_name = swapped_name.downcase.chars\r\n\tvowels = %w{a e i o u}\r\n\tcode_name.map! do |letter|\r\n\t\t# Edge case fix to make code work as intended\r\n\t\tif letter == \"u\"\r\n\t\t\tletter = \"a\"\r\n\t\telsif vowels.include?(letter)\r\n\t\t\tvowels[vowels.index(letter) + 1]\r\n\t\telse\r\n\t\t\tletter\r\n\t\tend\r\n\tend\r\n\t# This re-capitalizes the first letter of each part of the name\r\n\tcode_name.join('').split.map(&:capitalize).join(' ')\r\nend",
"def fake_name(name)\n name = name.split.rotate\n name.map! do |n|\n n.downcase!\n vowels = 'aeiou'\n vowels_shifted = vowels.split('').rotate.join\n consonants = 'bcdfghjklmnpqrstvwxyz'\n consonants_shifted = consonants.split('').rotate.join\n\n n.tr!(vowels, vowels_shifted)\n n.tr!(consonants, consonants_shifted)\n\n n = n.split('')\n n[0] = n[0].upcase\n n = n.join\n end\n name = name.join(' ')\nend",
"def format_name(first, last)\n\n if first.length == 0\n p nil\n elsif last.length == 0\n p nil\n else\n # this will remove all empty spaces\n first_name = first.gsub(/[^A-Za-z]/,\"\")\n last_name = last.gsub(/[^A-Za-z]/, \"\")\n # this will get the first letter in first name\n first_inlast = first_name[0]\n # this will return the first letter of the name + the last name\n full_name = first_inlast + last_name\n # this will return the full name lowercased along with deleting white spaces\n lowercase_name = full_name.downcase\n # remove_allcharacters = full_name.gsub(/[^a-zA-Z0-9\\-]/,\"\")\n p lowercase_name\n end\nend",
"def alias_method (name)\r\n\tnew_first = []\r\n\tnew_last = []\r\n\tvowels_string = \"aeiou\"\r\n\tvowels = vowels_string.split('')\r\n\tconsonants_string = \"bcdfghjklmnpqrstvwxyz\"\r\n\tconsonants = consonants_string.split('')\r\n\ttwo_names = name.split(' ')\r\n\tfirst_name = two_names[0].split('')\r\n\tlast_name = two_names[1].split('')\r\n\tlast_name.each do |character|\r\n\t\tcharacter = character.downcase\r\n\t\tif vowels.include?(character)\r\n\t\t\tindex = vowels.index(character)\r\n\t\t\tnew_last.push(vowels[index + 1])\r\n\t\tend\r\n\t\tif consonants.include?(character)\r\n\t\t\tindex = consonants.index(character)\r\n\t\t\tnew_last.push(consonants[index + 1])\r\n\t\tend\r\n\t\tif character.downcase == 'z'\r\n\t\t\tnew_last.push('b')\r\n\t\tend\r\n\t\tif character.downcase == 'u'\r\n\t\t\tnew_last.push('a')\r\n\t\tend\r\n\tend\r\n\tfirst_name.each do |character|\r\n\t\tcharacter = character.downcase\r\n\t\tif vowels.include?(character)\r\n\t\t\tindex = vowels.index(character)\r\n\t\t\tnew_first.push(vowels[index + 1])\r\n\t\tend\r\n\t\tif consonants.include?(character)\r\n\t\t\tindex = consonants.index(character)\r\n\t\t\tnew_first.push(consonants[index + 1])\r\n\t\tend\r\n\t\tif character.downcase == 'z'\r\n\t\t\tnew_first.push('b')\r\n\t\tend\r\n\t\tif character.downcase == 'u'\r\n\t\t\tnew_first.push('a')\r\n\t\tend\r\n\tend\r\n\tnew_last.push(' ')\r\n\tnew_last = new_last.join('').capitalize\r\n\tnew_first = new_first.join('').capitalize\r\n\treturn_val = new_last + new_first\r\n\treturn_val\r\nend",
"def alias_creator (str)\n# downcase all characters incase the name had initial caps.\nstr = str.downcase\t\n\n# create vowel string for cross checking each character (I ADDED 3 REPEATING VOWEL SEGMENTS TO PREVENT EDGE CASE FROM BREAKING WHEN ENCODING A VOEWEL AT THE END OF THE STRING LIKE U in \"AEIOU\") \nvowels = \"aeiouaeiouaeiou\"\n# create consonant string for cross checking each character\nconsonants = \"bcdfghjklmnpqrstvwxz\"\n# create empty strings that encoded first and last names will be stored in.\nname_alias = \"\"\n# create empty string to create an encoded full name \nspy_alias = \"\"\n=begin encoding names \n 1.taking the first name string and iterate through each character \n 2. check if vowels string includes current character in first name string\n 3. if it does access the letter in vowels string by its index, increment that index by one\n add that new letter to the alias string. \n 4. if the current character is a consonant it will go through the same process but using the consonants string\n 5. if the current character is a space a space will be added to the encoded string. \n=end\n \n str.each_char do |char| \n \tif char == \" \"\n name_alias+= \" \"\n\n \telsif vowels.include?(char)\n \t\tname_alias += vowels[vowels.index(char).next]\n \n elsif consonants.include?(char)\n \tname_alias += consonants[consonants.index(char).next]\n\n \n\n end \n \t\n end\n # check if the string that was encoded was a full name or just a first or last name\n # if it is a full name. sperate the first and last name and reverse the order (Lastname Firstname)\n \n if name_alias.include?(\" \")\n swap_name = name_alias.split(\" \")\n spy_alias = swap_name[1] + \" \" +swap_name[0]\n else spy_alias = name_alias\n end \n \n \n return spy_alias\n\n\nend",
"def initials(name)\n idx = 0\n new_str = ''\n\n loop do\n new_str << name.split[idx][0].upcase\n new_str << '.'\n idx += 1\n break if idx == name.split.length - 1\n end\n \n new_str << name.split[-1].capitalize\n\n new_str\nend",
"def full_name\n if first_name? && last_name?\n name_words = first_name.split(\" \") + last_name.split(\" \")\n return name_words.map{ |w| w.capitalize }.join(\" \")\n else\n return email\n end\n end",
"def fake_name(letters)\r\n\tvowel_arr = ['a', 'e', 'i', 'o', 'u']\r\n\tletters.map! do |letter|\r\n\t\tif vowel_arr.include?(letter.downcase)\r\n\t\t\tif letter.upcase! == nil\r\n\t\t\t\t\tif letter.downcase == vowel_arr[4]\r\n\t\t\t\t\t\tletter = vowel_arr[0].upcase\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tnumber = vowel_arr.index(letter.downcase)\r\n\t\t\t\t\t\tnumber = number + 1\r\n\t\t\t\t\t\tletter = vowel_arr[number].upcase\r\n\t\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\tnumber = vowel_arr.index(letter.downcase)\r\n\t\t\t\t\tif number == 4\r\n\t\t\t\t\t\tletter = vowel_arr[0]\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tnumber = number + 1\r\n\t\t\t\t\t\tletter = vowel_arr[number]\r\n\t\t\t\t\tend\r\n\t\t\tend\r\n\t\telsif \"abcdefghijklmnopqrstuvwxyz\".include?(letter.downcase) == false\r\n\t\t\tletter = letter\r\n\t\telse \r\n\t\t\t\tif letter.downcase == 'z'\r\n\t\t\t\t\tletter = (letter.chr.ord - 24). chr\r\n\t\t\t\telsif vowel_arr.include?(letter.next.downcase) == false\r\n\t\t\t\t\tletter = letter.next\r\n\t\t\t\telse\r\n\t\t\t\t\tletter = letter.next.next\r\n\t\t\t\tend\r\n\t\tend\r\n\tend\r\nletters.join(\"\")\r\nend",
"def consonant_swap (secret_name)\n\t\n\tsecret_name.map do |letters|\n\t\t\n\t\tif letters == \" \"\n\t\t\tletters\n\t\telsif letters == \"z\"\n\t\t\tletters.gsub!(/[z]/, \"a\")\n\t\telsif letters =~ /[aeiou]/\n\t\t\tletters\n\t\telse \n\t\t\tletters.next!\n\t\t\tif letters =~ /[aeiou]/\n\t\t\t\tletters.next!\n\t\t\tend\n\t\tend\n\n\tend\n\tsecret_name\nend",
"def vowel_converter(string)\r\n\tname_array = string.split('')\r\n vowel = ['a', 'e', 'i', 'o', 'u']\r\n counter = 0\r\n vowel_counter = 0\r\n# Outer loop that loops through entire name (first and last)\r\n while counter < name_array.length\r\n# Inner loop that loops through list of vowels, compares them with name, and changes vowels in name\r\n \twhile vowel_counter < vowel.length\r\n \t\tif name_array[counter] == vowel[vowel_counter]\r\n if name_array[counter] == 'u'\r\n \tname_array[counter] = 'a'\r\n break\r\n else\t\r\n \t\t name_array[counter] = vowel[vowel_counter + 1]\r\n \t\t break\r\n \t\t end\r\n \t end\r\n vowel_counter += 1\r\n end\r\n counter += 1\r\n vowel_counter = 0\r\n end \r\n return name_array\r\nend",
"def make_first_half(word)\n last_vowel = -1\n word.each_char { |c|\n if is_vowel?(c)\n # used reverse index to start right to left\n last_vowel = word.rindex(c) \n end\n }\n# Notes from class collaboration:\n# another way to achieve each_char would be to set a loop with word.length and then iterate through that number of characters\n# instead of reverse index, you could reverse the string itself\n# I could have also used break to end the iteration through the word. What I did instead was set up a new variable named last_vowel and that's how I kept my spot and sliced from there\n\n if last_vowel == -1\n return word\n end\n return word.slice(0...last_vowel)\nend",
"def cypher(name)\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n\tnew_name = split_reverse(name).map! { |name| \n\t\tname.chars.map! { |char| \n\t\t\tif consonants.include?(char)\n\t\t\t \tconsonant(char)\n\t\t\telsif vowels.include?(char) \n\t\t\t\tvowel(char)\n\t\t\telsif consonants.upcase.include?(char) || vowels.upcase.include?(char) \n\t\t\t\tupcase(char)\n\t\t\telse\n\t\t\t\tspecial_char(char)\n\t\t\tend\n\t\t}\n\t}\n\tjoin(new_name)\nend",
"def translate_char(char)\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\" # list of possible characters\n\thalfway = alphabet.length/2 \n\tis_capitalized = (char.upcase == char) # checks if character has already been capitalized or not\n\tif alphabet.index(char.downcase) == nil # if character is a letter at all\n\t\t\"boing\"\n\telsif is_capitalized && alphabet.index(char.downcase) < halfway # checks if letter is capitalized and in first half of alphabet\n\t\t\"bloop\"\n\telsif is_capitalized || char == \"e\" # checks if letter is capitalized or \"e\"\n\t\t\"buzz\"\n\telse\n\t\t\"beep\"\n\tend\n\nend",
"def make_fake_name (name)\n\t# Swap first & last name\n\tswap_name = name.split(' ').reverse.join(' ')\n\n\tfake_name = ''\n\tindex = 0\n\twhile index < swap_name.length\n\t\tchar = swap_name[index]\n\t\tif char == ' '\n\t\t\tfake_name += ' '\n\t\telse\n\t\t\tif char == char.downcase\n\t\t\t\tfake_name += get_swapped_char(char)\n\t\t\telse\n\t\t\t\tfake_name += get_swapped_char(char.downcase).upcase\n\t\t\tend\n\t\tend\n\n\t\t# Increment counter\n\t\tindex += 1\n\tend\n\n\tfake_name\nend",
"def next_vowel(name)\n name = name.downcase\n vowels = \"aeiou\"\n i = 0\n change = \"\"\n until i == name.length\n vowels_index = vowels.index(name[i]) # for each letter in first name find if and which index it is in vowels string\n if vowels_index == nil\n change += name[i]\n elsif vowels_index == 4\n change += \"a\" #edge cases\n else # 0-3 index\n change += vowels[vowels_index+1]\n# p \"else: \" + change\n# p vowels[vowels_index+1]\n end\n i = i + 1\n end\n return change\n end",
"def initials\n @name.split[0..1].map { |segment| segment[0] }.join('').upcase\n end",
"def fix_capitalized_species_epithet(str)\n # Is second word capitalized?\n return str unless str.match?(/^\\S+ [A-Z]/)\n\n # Trust it if there is actually a name with that author present.\n return str if Name.find_by(search_name: str).present?\n\n # Try converting second word to lowercase.\n str2 = str.sub(/ [A-Z]/, &:downcase)\n\n # Return corrected name if that name exists, else keep original name.\n if Name.where(search_name: str2).or(Name.where(text_name: str2)).present?\n str2\n else\n str\n end\n end"
] | [
"0.73680586",
"0.72787887",
"0.71903306",
"0.7187212",
"0.7153722",
"0.7009704",
"0.6930415",
"0.6819983",
"0.6816364",
"0.67795926",
"0.6713809",
"0.66752636",
"0.6661062",
"0.66135",
"0.6591218",
"0.65676045",
"0.65536165",
"0.6545161",
"0.65293187",
"0.6485878",
"0.64839584",
"0.6471229",
"0.64621264",
"0.64431924",
"0.642351",
"0.6414681",
"0.63851064",
"0.63769794",
"0.6374014",
"0.6360102",
"0.6335858",
"0.6334883",
"0.63169545",
"0.6312775",
"0.62575316",
"0.6254707",
"0.62520355",
"0.624934",
"0.62161386",
"0.6205646",
"0.619576",
"0.61948574",
"0.6189333",
"0.61814874",
"0.61702883",
"0.6169288",
"0.6166583",
"0.61619765",
"0.6159271",
"0.6132102",
"0.61011815",
"0.60738724",
"0.60716724",
"0.60657775",
"0.60452926",
"0.60445327",
"0.6043873",
"0.6037484",
"0.6019399",
"0.60149515",
"0.59884363",
"0.59841025",
"0.598205",
"0.5974384",
"0.5965484",
"0.5961175",
"0.59601134",
"0.5950384",
"0.5943466",
"0.5934067",
"0.5932663",
"0.5918249",
"0.5912437",
"0.5909097",
"0.59053266",
"0.59012926",
"0.58921874",
"0.5882556",
"0.5867441",
"0.5843598",
"0.5843598",
"0.58431524",
"0.5831807",
"0.5831556",
"0.58278656",
"0.58256197",
"0.5825139",
"0.5822134",
"0.58215463",
"0.58210105",
"0.58205",
"0.58123714",
"0.5811839",
"0.5810677",
"0.5797112",
"0.57937187",
"0.57921153",
"0.57913476",
"0.57893866",
"0.5788382"
] | 0.6117013 | 50 |
Adds a new comment. | def <<(new_comment)
@config.ffi_delegate.set_comment('%s', :string, new_comment)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_comment(comment)\n @comments << comment\n end",
"def add_comment(comment)\n @comments << comment\n end",
"def add_comment(comment)\n comments << comment\n end",
"def add_comment(comment)\n @comments << comment\n end",
"def add_comment\n return client.add_comment(repository, pr_id, report_urls.comment_body) unless comment\n\n client.update_comment(repository, comment[:id], report_urls.comment_body(comment[:body]))\n end",
"def add_comment(comment)\n @comments << comment\n end",
"def add_comment(comment); end",
"def add_comment(comment)\n @comment = comment\n end",
"def add_comment(comment)\n @comments_list << comment\n end",
"def add_comment(*args)\n commit('addComment', *args)\n end",
"def add_comment(comment)\n @comment += comment + \"\\n\"\n end",
"def add_comment(text)\n client.add_comment(self, text)\n end",
"def add_comment(text)\n client.add_comment(self, text)\n end",
"def add_comment(*args)\n commit('addComment', *args)\n end",
"def add_comment comment\n comment = extract_comment comment\n\n return if comment.empty?\n\n case comment\n when RDoc::Comment then\n @comments << comment\n when RDoc::Markup::Document then\n @comments.concat comment.parts\n when Array then\n @comments.concat comment\n else\n raise TypeError, \"unknown comment type: #{comment.inspect}\"\n end\n end",
"def addComment( text )\n\t\t\tloadComments if @comments.length == 0\n\t\t\t@comments.push( TicketComment.new( text ) )\n\t\tend",
"def add_comment(comment)\n if Trebuchet.backend.respond_to?(:add_comment)\n Trebuchet.backend.add_comment(self.name, comment)\n end\n end",
"def add_comment(comment)\n \"\\n+++++++++++++++++++++++++++++++++++++++++ #{comment} ++++++++++++++++++++++++++++++++++++++++++++++\\n\"\n end",
"def <<(comment)\n @comments << comment\n end",
"def add_comment(comment)\n comment_threads << comment\n end",
"def add_comment(comment)\n comment_array << comment\n end",
"def add_comment(text)\n resp = self.class.post(\"/api/comment\", {:body => {:thing_id => id, :text => text, :uh => modhash, :r => subreddit }, :headers => base_headers, :debug_output => @debug })\n resp.code == 200\n end",
"def add_comment(applicant_id, comment)\n details = { type: \"comment\", comment: comment }.to_json\n options = { body: details, headers: { \"Content-Type\" => \"application/json\" } }\n\n request(:post, \"applicant_tracking/applications/#{applicant_id}/comments\", options)\n end",
"def add_comment(card_id, text, options = {})\n options.update text: text\n create_card_resource card_id, \"actions\", \"comments\", options\n end",
"def add_comment(id, comment=\"\", _private=false, work_time=nil)\n comment = {'id' => id, 'comment' => comment}\n comment.store('private', _private) if _private\n comment.store('work_time', work_time) unless work_time.nil?\n return call('Bug.add_comment', comment)\n end",
"def add_comment(comment, options={})\n @jira.add_comment(self[:key], comment, options)\n end",
"def add(comment)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'comment', comment)\n\t\t\tclient.queue_service_action_call('assetcomment', 'add', 'KalturaAssetComment', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def comment(text)\n comments << text\n end",
"def comment message\n @instructions << Comment.new(message)\n self\n end",
"def add_comment comment\n \"\\n###### #{comment} ######\\n\" \n end",
"def comment_add(task_id, text, options={})\n post(\"wrike.comment.add\", options.merge(:taskId => task_id, :text => text))\n end",
"def add_comment(options = {})\n raise ArgumentError, \"Comment require an author\" unless options[:author]\n raise ArgumentError, \"Comment requires text\" unless options[:text]\n raise ArgumentError, \"Comment requires ref\" unless options[:ref]\n\n self << Comment.new(self, options)\n yield last if block_given?\n last\n end",
"def add_comment(message)\n rsp = @flickr.send_request('flickr.photos.comments.addComment', {:photo_id => self.id, :comment_text => message}, :post)\n true\n end",
"def add_comment\n data = request.subset(:post_id, :username, :comment)\n comment = Comment.new\n\n # If the user is logged in the user_id field should be set instead of the\n # username field.\n if logged_in?\n data.delete('username')\n data['user_id'] = user.id\n end\n\n begin\n comment.update(data)\n flash[:success] = 'The comment has been added'\n rescue => e\n Ramaze::Log.error(e)\n\n flash[:form_errors] = comment.errors\n flash[:error] = 'The comment could not be added'\n end\n\n redirect_referrer\n end",
"def add_comment(project_id, id_or_key, body, opts = {})\r\n data, _status_code, _headers = add_comment_with_http_info(project_id, id_or_key, body, opts)\r\n return data\r\n end",
"def add_comment\n @issue.comment @user_message.empty? ? @message : @user_message\n end",
"def add_comment(eco_task_comment, user)\n if !eco_task_comment.comment.blank?\n eco_task_comment.user_id = user.id\n self.eco_comments << eco_task_comment\n end\n eco_task_comment\n end",
"def add_comment(issue_id_or_key, content, params = {})\n params[:content] = content\n post(\"issues/#{issue_id_or_key}/comments\", params)\n end",
"def add_comment(body)\n\n raise ArgumentError(\"Comment body must be a string\") unless body.is_a?(String)\n\n url = \"/api/v1/projects/#{project_id}/tickets/#{id}/comments.json\"\n @client.post(url , {:body => body})\n end",
"def add_comment(id, api_comment, opts = {})\n data, status_code, headers = add_comment_with_http_info(id, api_comment, opts)\n return data\n end",
"def add_comment(id, api_comment, opts = {})\n data, status_code, headers = add_comment_with_http_info(id, api_comment, opts)\n return data\n end",
"def add_comment(id, api_comment, opts = {})\n data, status_code, headers = add_comment_with_http_info(id, api_comment, opts)\n return data\n end",
"def add_comment(id, api_comment, opts = {})\n data, status_code, headers = add_comment_with_http_info(id, api_comment, opts)\n return data\n end",
"def add_comment\n @link = Link.find(params[:id])\n @notice = @link.add_comment params[:comment][:title], params[:comment][:text]\n \t\t@count = @link.comments.size\n \t\t@comment = @link.comments[@count-1]\n end",
"def add_comment(checkin_id, comment)\n options = { :checkin_id => checkin_id, :comment => comment }\n post('/add_comment', options)\n end",
"def add_comment(uid, comment_text)\n\n radlib = find_radlib_by_radlib_id(radlib_id)\n\n author = find_user_by_uid(radlib.author_uid)\n author.increment_comments_received\n\n comment_index = increase_atomic_count(@docs[:num_comments])\n timestamp = Time.now.getutc\n comment_key = radlib_fillin_id + \"::comment::\" + comment_index.to_s\n\n comment_doc = {\n :type => \"radlib_fillin_comment\",\n :author => uid,\n :text => comment_text,\n :timestamp => timestamp\n }\n\n create_document(comment_key, comment_doc)\n comment_index\n end",
"def add_comment(samp, comm, snd = selected_sound(), chn = selected_channel())\n if array?(comments = channel_property(:comments, snd, chn))\n comments.push([samp, comm])\n else\n set_channel_property(:comments, [[samp, comm]], snd, chn)\n end\n end",
"def add_comment(options = {})\n request_model = @request_model_factory.add_comment_request_model(options)\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body)\n end",
"def add_comment(text: required(\"text\"), options: {}, **data)\n with_params = data.merge(text: text).reject { |_,v| v.nil? || Array(v).empty? }\n Story.new(parse(client.post(\"/tasks/#{gid}/stories\", body: with_params, options: options)).first, client: client)\n end",
"def add_comment(task_id, str)\n task = Task.find(task_id)\n new_comment = Comment.new\n new_comment.comment = str\n task.comments << new_comment\n new_comment.save\nend",
"def add_comment(post_num_input)\n puts \"Type in a username.\"\n username = gets.chomp\n puts \"Type your comment\"\n comment = gets.chomp\n BLOG[post_num_input].comments << Comment.new(username,comment)\n puts \"Thank you #{username}! Your comment has been added to \" +\n \"\\\"#{BLOG[post_num_input].title}\\\"!\"\n show_comments(post_num_input)\n end",
"def add_new_comment\n\t# Get the object that you want to comment\n\tcommentable = Post.find(params[:id])\n\n\t# Create a comment with the user submitted content\n\tcomment = Comment.new(comment_params)\n\t# Add the comment\n\tcommentable.comments << comment\n\t@comments = commentable.comments\n respond_to do |format|\n\t format.html { redirect_to root_path }\n\t format.js\n\tend\n end",
"def add_comment(model_task_comment, user)\n if !model_task_comment.comment.blank?\n model_task_comment.user_id = user.id\n self.model_comments << model_task_comment\n end\n model_task_comment\n end",
"def create_gist_comment(id, comment)\n post \"/gists/#{id}/comments\", :body => { :body => comment }\n end",
"def comment options={}\n client.post(\"/#{id}/comments\", options)\n end",
"def comment(text)\n comments.create!(user_id: current_user.id,\n content: text)\n end",
"def add_comment(user_comment, topic_id)\n comment = Comment.new\n comment.description = user_comment\n comment.user = self\n comment.topic = Topic.find(topic_id)\n comment.save\n end",
"def add_comment\n unless params[:comment].nil? || params[:comment]== ''\n @oligo_design = OligoDesign.find(params[:id])\n store_comment(@oligo_design, params)\n end\n \n redirect_to :action => 'show', :id => params[:id]\n end",
"def add_comment comment, location\n return unless document_self\n\n original = comment\n\n comment = case comment\n when RDoc::Comment then\n comment.normalize\n else\n normalize_comment comment\n end\n\n if location.parser == RDoc::Parser::C\n @comment_location.delete_if { |(_, l)| l == location }\n end\n\n @comment_location << [comment, location]\n\n self.comment = original\n end",
"def comment_add(name)\n if name !~ /\\w=/ # We accept 'name=' in case you want to leave the value empty\n raise FlacInfoError, \"comments must be in the form 'name=value'\"\n end\n begin\n @comment[@comment.length] = name\n @comments_changed = 1\n rescue\n return false\n end\n return true\n end",
"def comment=(value)\n @comment = value\n end",
"def comment=(value)\n @comment = value\n end",
"def new_comment comment, line_no = nil\n c = RDoc::Comment.new comment, @top_level, :ruby\n c.line = line_no\n c.format = @markup\n c\n end",
"def add_comment\n if current_user.id.to_s == params[:user_id].to_s\n comment = Comment.new(:user_id => params[:user_id], :post_id => params[:post_id],\\\n :content => params[:content], :upvotes => 0, :downvotes => 0, :rank => 0)\n comment.save!\n end\n end",
"def comment comment\n end",
"def comment args #id, comment\n id = args.shift\n unless id\n id = ask(\"Issue Id? \", Integer)\n end\n db, row = validate_id id, true\n die \"No issue found for #{id}\" unless row\n if !args.empty?\n comment = args.join(\" \")\n else\n message \"Enter a comment (. to exit): \"\n comment = Cmdapp.get_lines\n end\n die \"Operation cancelled\" if comment.nil? or comment.empty?\n message \"Comment is: #{comment}.\"\n message \"Adding comment to #{id}: #{row['title']}\"\n _comment db, id, comment\n 0\n end",
"def add\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n # format.html { redirect_to comments_url, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def push_comment(text)\n\t text.strip!\n\t @primitives.push Comment.new(text) if text && text.length\n\tend",
"def comment\n Comment.new(@params[\"lf_comment_id\"], conversation,\n :body => @params[\"body_text\"],\n :user => user,\n :parent_id => @params[\"lf_parent_comment_id\"],\n :author_ip => @params[\"author_ip\"],\n :state => @params[\"state\"]\n )\n end",
"def addComment (id, comment)\n item = Comment.new\n item.comment = comment\n item.todo_id = id\n item.save\nend",
"def add_comment(text, file_data = nil, file_mime_type = 'text/plain',\n file_name = 'attachment.txt')\n add_page = @client.get @add_comment_url\n add_form = add_page.form_with :action => /addcomment/i\n \n add_form.field_with(:name => /newCommentRaw/i).value = text\n add_form.field_with(:name => /newComment/i).value = text\n add_form.checkbox_with(:name => /privateComment/i).checked = :checked\n if file_data\n upload = add_form.file_uploads.first\n upload.file_name = file_name\n upload.mime_type = file_mime_type\n upload.file_data = file_data\n end\n add_form.submit add_form.button_with(:name => /submit/i)\n self\n end",
"def add_comment(issue_key, comment)\n url = \"#{@base_url}/rest/api/2/issue/#{issue_key}/comment\"\n post = {\"body\" => comment}\n options = [@login_options, {\"data\" => post}].inject(:merge)\n result = rest_call(url, \"post\", options)\n log result.inspect\n result\n end",
"def comment(text)\n self.comment(self.id, text)\n end",
"def add_pr_comment(pull_comments_url,comment_body)\n url = pull_comments_url\n payload = {\n body: \"#{comment_body}\"\n }\n RestClient.post(\n url,\n payload.to_json,\n @git_headers\n )\n end",
"def comment str\n self.add_comment(\"This is a paragraph comment for the paragraph\", \"OCELOT Commenter\");\n end",
"def add_new_comment\n @product = Product.find(params[:id])\n comment = @product.comments.create\n comment.comment = params[:comment]\n comment.user_id = current_user.id\n comment.save\n redirect_to :action => :show, :id => @product\n end",
"def create_comment(comment)\n post_params = {\n :body => comment.post_json,\n :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})\n }\n\n response = Logan::Client.post \"/projects/#{@project_id}/todos/#{@id}/comments.json\", post_params\n Logan::Comment.new response\n end",
"def comment_added(comment)\n @comment = comment\n @user = @comment.user\n @track = @comment.track\n @project = @track.project\n\n mail to: @user.email,\n bcc: \"pierre@sugaryourcoffee.de, #{@project.user.email}\",\n subject: \"[apptrack] New Comment in Project #{@project.title}\"\n end",
"def add_comment_node(node, text)\n comment_node = Nokogiri::XML::Comment.new(node.document, \"wovn-src:#{text}\")\n if node.parent.name == 'title'\n node.parent.add_previous_sibling(comment_node)\n else\n node.add_previous_sibling(comment_node)\n end\n end",
"def comment\n\n client = user_client\n comment = params[:comment]\n mixpanel_tab_event(\"View Item\", \"Post Comment\")\n\n if (comment != \"\")\n # get file and add comment\n file = client.file_from_id(session[:fileId])\n client.add_comment_to_file(file, message: comment)\n end\n\n redirect_to view_doc_path(session[:fileId])\n end",
"def redmine_add_comment(m, params)\n begin\n \tcertificate = redmine_check_auth(m)\n\t\tif ! certificate\n\t\t\t# ne rien faire, l'utilisateur n'est pas connecté\n\t\telse\n\t\t\tresulted_task = redmine_check_task(m, params, certificate)\n\t\t\tif ! resulted_task.nil?\n\t\t\t\t# Best way to save text line\n\t\t\t\tmessageEntry = params[:message].to_s.strip\n\t\t\t\t# Ajout d'un commentaire\n\t\t\t\tresulted_task.notes = messageEntry\t\n\t\t\t\t# Save an issue\n\t\t\t\tif ! resulted_task.save\n\t\t\t\t\t# on indique à l'utilisateur\n\t\t\t\t\t@bot.say m.replyto, \"#{certificate[:username]}, #{@redmine_l_thetask} ##{resulted_task.id} #{@redmine_l_hasnotbeenupdated}\"\n\t\t\t\telse \n\t\t\t\t\t# on indique à l'utilisateur\n\t\t\t\t\t@bot.say m.replyto, \"#{certificate[:username]}, #{@redmine_l_thetask} ##{resulted_task.id} #{@redmine_l_hasbeenupdated} => #{@redmine_rapid_url}#{@redmine_issue_show_path}/#{resulted_task.id}\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tm.reply \"#{@redmine_l_thetask} ##{params[:task]} #{@redmine_l_doesnotexistsinredmine}\"\n\t\t\tend\n\t\tend\n rescue Exception => e\n m.reply e.message\n m.reply e.backtrace.inspect\n end\n end",
"def create_comment(gist_id, params={})\n _normalize_params_keys(params)\n # _merge_mime_type(:gist_comment, params)\n _filter_params_keys(ALLOWED_GIST_COMMENT_INPUTS, params)\n _validate_inputs(REQUIRED_GIST_COMMENT_INPUTS, params)\n\n post(\"/gists/#{gist_id}/comments\", params)\n end",
"def add_comment(message, internal: true)\n fail ArgumentError, \"message is required\" if message.blank?\n\n body = {\n type: \"activity-comment\",\n attributes: {\n message: message,\n internal: internal\n }\n }\n\n response_json = make_post_request(\"reports/#{id}/activities\", request_body: body)\n HackerOne::Client::Activities.build(response_json)\n end",
"def create_comment\n\t\tcomment = Comment.new\n\t\tcomment.body = @string = CGI.unescape(params[:comment][:body]).gsub(/\\n/,\"<br />\")\n\t\tcomment.project_id = params[:project_id]\n\t\tcomment.account_id = params[:account_id]\n\t\tcomment.save\n\n\t\tflash[:notice] = \"Your comment has been created\"\n\t\tredirect_to :controller => :projects, :action => :comments_show, :id => params[:project_id]\n\tend",
"def make_comment(content, user)\n return if content.blank?\n comment = PublicEarth::Db::Comment.new(PublicEarth::Db::Discussion.one.comment(self.id, user.id, content))\n @comments << comment\n comment\n end",
"def comment(comment)\r\n # Do nothing unless we're currently working on a <packet> element or one of its children\r\n return unless @element_stack.length > 0\r\n\r\n @element_stack.last.add(Comment.new(comment))\r\n end",
"def create_comment(sender, options={})\n comment = nil\n if allows_comment?(sender)\n comment = self.comments.create(comment_options(sender, options))\n comment.activate! if comment.valid?\n end\n comment\n end",
"def add_comment\n @comment = Comment.new(params[:comment])\n @project = Project.find(params[:id])\n @comment.project = @project\n @comment.save\n redirect_to :action => 'project', :id => @project\n end",
"def put_comment(object_id, message, options = {})\n # Writes the given comment on the given post.\n self.put_object(object_id, \"comments\", {:message => message}, options)\n end",
"def add_comment\n\t\tset_sale\n\t\t@sale.comment = params[:sale_comments][:comment]\n\t\t@sale.save\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend",
"def comment!(comment = nil)\n mutate(:comment, comment)\n end",
"def add_comment(body, location = nil)\n return comments << body if location.nil?\n\n add_comment_on_file(body, *parse_location(location))\n end",
"def _comment db, id, text\n rowid = db.sql_comments_insert id, text\n puts \"Comment #{rowid} created\"\n handle = db.db\n \n commcount = handle.get_first_value( \"select count(id) from comments where id = #{id};\" )\n commcount = commcount.to_i\n db.sql_update \"bugs\", id, \"comment_count\", commcount\n rowid = db.sql_logs_insert id, \"comment\", Cmdapp.truncate(text, 50)\n end",
"def create_gist_comment(gist_id, body, options = {})\n opts = options.dup\n opts[:body] = body\n post \"gists/#{Gist.new gist_id}/comments\", opts\n end",
"def put_comment(id, message, options = {}, &block)\n # Writes the given comment on the given post.\n put_connections(id, \"comments\", {:message => message}, options, &block)\n end",
"def add_comment_to_issue(issue_name, comment_text)\n\tissue = @client.Issue.find(issue_name)\n\tcomment = issue.comments.build\n\tcomment.save!(:body => comment_text)\nend",
"def write_comment(message)\n GitHub.add_comment repo_name, number, \":octocat: #{message}\"\n rescue Octokit::UnprocessableEntity => error\n raise CommentFailed, \"Unable to write the comment: '#{error.message}'\"\n end",
"def create_comment(sender, options={})\n comment = self.comments.create(comment_options(sender, options))\n comment.activate! if comment.valid?\n comment\n end",
"def createComment(data)\n ret = Comment.new(data)\n ret.ownerDocument = self\n ret\n end",
"def comment!(str)\n @comments_buf << str\n end",
"def create_comment_for_pull(id, comment)\n uri = URI(uri_comment_on_pull(id))\n execute_http_request(:post, uri, comment)\n end"
] | [
"0.8414552",
"0.8414552",
"0.8409626",
"0.84052885",
"0.8386455",
"0.8340048",
"0.8251898",
"0.8193716",
"0.81295615",
"0.7969205",
"0.7946953",
"0.7877461",
"0.7877461",
"0.7856832",
"0.7722643",
"0.77115965",
"0.7672535",
"0.75468194",
"0.7528655",
"0.7467862",
"0.74043787",
"0.72897935",
"0.7289393",
"0.72837764",
"0.72836655",
"0.7267741",
"0.7259406",
"0.7251309",
"0.7240977",
"0.72097033",
"0.7197085",
"0.7179737",
"0.71509886",
"0.71165884",
"0.711159",
"0.7093347",
"0.70637095",
"0.70593566",
"0.7056343",
"0.705563",
"0.705563",
"0.705563",
"0.705563",
"0.70505434",
"0.69400775",
"0.6922691",
"0.692046",
"0.6881431",
"0.68378437",
"0.6810844",
"0.6782382",
"0.6773582",
"0.67491174",
"0.67345184",
"0.6730549",
"0.67162055",
"0.67155516",
"0.6688593",
"0.6638332",
"0.66313934",
"0.6597601",
"0.6597601",
"0.65757185",
"0.6565851",
"0.65494376",
"0.6527811",
"0.65136796",
"0.6509361",
"0.65083987",
"0.65028775",
"0.6479845",
"0.64733213",
"0.64632213",
"0.64551497",
"0.64435834",
"0.64288586",
"0.64237237",
"0.64107126",
"0.64087826",
"0.63570285",
"0.63539654",
"0.63447845",
"0.6335038",
"0.6333008",
"0.6320802",
"0.6320415",
"0.62994325",
"0.62862766",
"0.62861264",
"0.62797385",
"0.62716675",
"0.62660426",
"0.62634385",
"0.6256437",
"0.62561613",
"0.6230066",
"0.6220326",
"0.62107164",
"0.61992145",
"0.61960256",
"0.61905706"
] | 0.0 | -1 |
Returns the Zlist to the list of comments for this config item. | def _zlist
@config.ffi_delegate.comments
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments\n get_ticket_property_list(\"comments\" , Unfuddled::Comment)\n end",
"def comments\n @comments\n end",
"def comments\n @comments\n end",
"def comments\n pull_comments\n @comments_list\n end",
"def getComments\r\n\t\t\t\t\treturn @comments\r\n\t\t\t\tend",
"def comments\n [ExpenseItemComment.new(self.description)]\n end",
"def list_comments\n hc = if has_comments_valided?\n comments(valided: true).collect do |dcom|\n next unless dcom[:ok]\n (\n (dcom[:ps] + ', le ' + dcom[:at].as_human_date).in_div(class: 'c_info') +\n traite_comments(dcom[:c]).in_div(class: 'c_content') + \"\".in_div(class: 'clear')\n ).in_div(class: 'comment')\n end.join('')\n else\n \"Aucun commentaire sur cet article pour le moment.\".in_div(class: 'italic small')\n end\n hc.prepend('<a name=\"lire_comments\"></a>')\n return hc\n end",
"def comments\n @list.client.get(\"#{url}/comments\")\n end",
"def comments\n @list.client.get(\"#{url}/comments\")\n end",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def return_comment\n @comments\n end",
"def comments\n if nodes = @node.xpath(\"comments\")\n nodes.map { |node| node.content }.compact\n end\n end",
"def comments\n out = []\n\n out << ''\n out << '#'\n out << \"# Deezy version #{app_version}\"\n out << '#'\n out << ''\n\n @conf['dhcpd']['subnets'].each do |s|\n out << '# %s/%s via %s' % [s['subnet'], s['netmask'], s['routers']]\n s['pools'].each do |p|\n exceptions = []\n p['exceptions'].each do |e|\n exceptions << \", [except: %s-%s (%s)]\" % [e['first'], e['last'], e['notes']]\n end if p['exceptions']\n out << [\n \"# #{p['first']}-#{p['last']}\",\n \"#{\" (#{p['notes']})\" if p['notes']}\",\n exceptions.join\n ].join\n end\n out << '#'\n end\n out << ''\n end",
"def comments\n @properties[\"C\"]\n end",
"def comments\n @comments.values\n end",
"def getComments\n\t\tself.root_comments\n\tend",
"def getComments\n\t\tself.root_comments\n\tend",
"def comments(options = {})\n @comments_list ||= CommentList.new(@id)\n return @comments_list.top_level(options)\n end",
"def comments\n\t\t\t@comments ||= read_comments\n\t\tend",
"def get_comments\n return unless @list\n comments = \"\"\n cnt = 0\n listn = @list.size\n while cnt < listn\n if @list[cnt].code == 108\n comments += @list[cnt].parameters[0] + 10.chr\n while cnt < listn && @list[cnt + 1].code == 408\n cnt += 1\n comments += @list[cnt].parameters[0] + 10.chr\n end\n end\n cnt += 1\n end\n \n return comments\n end",
"def getComments(list)\r\n comments = \"\"\r\n dbg(\"Kommentarer:\")\r\n list.each { |s| \r\n dbg(\"Kommentar:\")\r\n dbg(s)\r\n dbg(s[\"comment\"])\r\n \tcomments = comments + \"<p>\" + s[\"author_name\"] + \":\" + s[\"comment\"] + \"</p>\"\r\n \tdbg(s[\"comment\"])\r\n }\r\n return comments\r\nend",
"def getComments(list)\r\n comments = \"\"\r\n dbg(\"Kommentarer:\")\r\n list.each { |s| \r\n dbg(\"Kommentar:\")\r\n dbg(s)\r\n dbg(s[\"comment\"])\r\n \tcomments = comments + \"<p>\" + s[\"author_name\"] + \":\" + s[\"comment\"] + \"</p>\"\r\n \tdbg(s[\"comment\"])\r\n }\r\n return comments\r\nend",
"def comments\n @comments\n end",
"def comments\n @comments\n end",
"def to_s\n '#<Twilio.FlexApi.V1.InsightsSettingsCommentList>'\n end",
"def comments\n @docstring.all\n end",
"def cached_comments\n Rails.cache.fetch([self, 'comments']) { comments.to_a }\n end",
"def list \n @comment = Comment.all\n end",
"def cached_comments\n @comments\n end",
"def comments\n results = []\n return results unless @comments\n\n comment = ''\n @comments.split(\"\\n\").each do |line|\n if line =~ /^\\S/\n results << comment unless comment.empty?\n comment = line\n else\n comment += \"\\n\" + line\n end\n end\n\n results << comment unless comment.empty?\n return results\n end",
"def comment_list(list, base_indent='')\n commented_list = \"\"\n ids = list.split(/,/)\n ids.each do |id|\n id.gsub!(/\\s*$/, '')\n id.gsub!(/^\\s*/, '')\n list_id = \"#{id}\"\n list_id += ',' if id != ids.last\n id.gsub!(/\\=.*$/, '') \n id.gsub!(/\\[.*\\]/, '') \n id.gsub!(/\\s*$/, '')\n id.gsub!(/^\\s*/, '') \n id.gsub!(/;/, '') \n id.gsub!(/\\s*\\:\\s*\\d+/,'') \n doc_id = id.split(/\\s/).last\n doc_id.gsub!(/\\*/, '') \n commented_list += \"#{base_indent}\" if id != ids.first \n commented_list += \"#{@indent}\\t#{list_id} /**< <##{doc_id} description#> */\"\n commented_list += \"\\n\" if id != ids.last \n end\n commented_list \n end",
"def comments\n if @comment_feed.comments.nil?\n @comment_feed.fetch\n end\n\n @comment_feed.comments\n end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def get_comments\n xml_doc = @vimeo.get_xml(@vimeo.generate_url({\"method\" => \"vimeo.videos.comments.getList\",\n \"video_id\" => @id, \"api_key\" => @vimeo.api_key}, \"read\"))\n\n (xml_doc/:comment).each do |comment|\n @comments << build_comment(comment)\n end\n return self\n end",
"def comments\n worksheets.map(&:comments).compact\n end",
"def comments\n @mapped_comments ||= Basecamp3::Comment.all(bucket.id, id)\n end",
"def list_with_comments\n require 'method_source'\n list.map { |short| [short, public_method(\"mutate_#{short}\").comment.strip] }\n end",
"def get_comments()\n return self.get_all_comments()\n #issues = @issues\n #issues.each do |issue|\n # puts \"Processing issue #{issue['number']}...\"\n # comments = client.issue_comments( REPO, issue.number ) \n # num = issue['number']\n # @comments[num] = comments\n # issue[\"comments\"] = comments\n #end\n #return @comments\n end",
"def build_comments\n I18n.available_locales.map { |l| build_comment(l) }\n end",
"def comments\n c = Comment.where(:resource_id => self.id).all\n if c\n return c\n end\n end",
"def comments\n Comment.query({item_id: _id}, {sort: [[:created_at, -1]]})\n end",
"def comments\n @comments ||= Comments.new(worksheet)\n end",
"def get_comments\n return Comment.where(design_problem_id: self.id).sort_by! { |x| x.created_at }.sort! { |a,b| b.created_at <=> a.created_at }\n end",
"def comments(sheet = nil)\n sheet ||= default_sheet\n read_comments(sheet) unless @comments_read[sheet]\n return [] unless @comment[sheet]\n @comment[sheet].each.collect do |elem|\n [elem[0][0], elem[0][1], elem[1]]\n end\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.desc)}\n return(cfg)\n end",
"def note\n comment_list = []\n return @notes if !@notes.nil?\n for page in @pages\n next if !page || !page.list || page.list.size <= 0\n note_page = page.list.dup\n \n note_page.each do |item|\n next unless item && (item.code == 108 || item.code == 408)\n comment_list.push(item.parameters[0])\n end\n end\n @notes = comment_list.join(\"\\r\\n\")\n return @notes\n end",
"def admin_comments\n if self.comments.count > 0 \n return self.comments.where(\"public = ?\",true).map{|c| c.as_json(:only=>[:body],:methods=>[:admin_name])}\n else\n return \"No hay comentarios\"\n end\n end",
"def make_comment( content )\n\t\treturn [\n\t\t\tself.options[:comment_start],\n\t\t\tcontent,\n\t\t\tself.options[:comment_end],\n\t\t].join\n\tend",
"def comments\n client.get(\"/#{id}/comments\")\n end",
"def comments()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Comments::CommentsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def comment\n return @comment\n end",
"def comment\n return @comment\n end",
"def comments\n refresh if (@comments.nil? || @comments.empty?) && @comments_count > 0\n @comments ||= Array.new\n end",
"def comments\n refresh if (@comments.nil? || @comments.empty?) && @comments_count > 0\n @comments ||= Array.new\n end",
"def customer_comments\n end",
"def comments\n \tComment.where(commentable: commentable, parent_id: id)\n end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments(options = {})\n comments_resource(options)\n end",
"def comments\n if has_comments?\n @repository.load(:comments, number).map do |item|\n Github::Issue::Comment.new(item)\n end\n else \n []\n end\n end",
"def test_ListBugComments\n\t\tcolName = 'comments'\n\t\tretClass = LeanTesting::BugComment\n\t\tresp = rcol(colName, ['_id', 'text', '_owner_id', 'created_at'])\n\t\t@client.debugReturn = {'data'=> JSON.generate(resp), 'status'=> 200}\n\n\t\tcol = LeanTesting::Bug.new(@client, {'id'=> 0}).comments.all\n\n\t\tassert_equal resp[colName], col.toArray\n\t\tassert_instance_of retClass, col.collection[0]\n\t\tassert_equal resp['meta']['pagination']['total'], col.total\n\t\tassert_equal resp['meta']['pagination']['total_pages'], col.totalPages\n\t\tassert_equal resp['meta']['pagination']['count'], col.count\n\tend",
"def get_comments\n comments = self.comments.order(:created_at).to_a\n comments_hash = {}\n while comments.any? do\n comment = comments.shift\n comment_comments = comment.comments.order(:created_at)\n comments_hash[\"#{comment.id}\"] = comment_comments\n comments.concat(comment_comments)\n end\n comments_hash\n end",
"def list_tasks_with_comments\n all_tasks = Task.all\n all_tasks.each do |task|\n puts \"Task: \" + task.title\n task.comments.each {|c| puts \"Comment: \" + c.comment}\n end\nend",
"def get_comment\n\t\treturn @comment\n\tend",
"def as_comment_body\n\t\treturn self.inspect\n\tend",
"def comments_history\n self.comments.map { |comment| comment.content }.reverse\n end",
"def parse_comments\n @data[4][0]\n end",
"def comments\n # event_ids = events(@user).pluck(:id)\n # Comment.where(commentable_type: \"Event\", commentable_id: event_ids, program_favorite: true)\n # events(@user).unscope(:order).order(start_date_time: :asc).each { |event| event.map { |event| event.favorite_comments.first } }\n events(@user).map { |e| e.comments.select { |c| c.event_favorite == true }.first(2) }.flatten\n end",
"def comments(language = Tr8n::Config.current_language)\n Tr8n::TranslationKeyComment.where(\"language_id = ? and translation_key_id = ?\", language.id, self.id).all\n end",
"def index\n @comments = @snippet.comments\n end",
"def items_list\n return self.pickedup_items.ordered_by_item_category.map{|it| \n \" #{it.andand.item.andand.item_code} [#{it.number_donated}] \" << (it.comments.blank? ? \"\" : \"(#{it.comments}) \")\n }.join(\"/\")\n end",
"def comments(*options)\n options.insert 0, project_id\n options.insert 1, id\n easy_finder(provider_parent(self.class)::Comment, :all, options, 2)\n end",
"def comments(options={})\n @comments ||= self.class.parse_comments(request(singular(question_id) + \"/comments\", options))\n end",
"def getComments(response)\r\n\t\t\t\r\n\t\t\t\tjsonObject = JSON.parse response\r\n\t\t\t\t\r\n\t\t\t\tcommentsList = Array.new\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"comments\")\r\n\t\t\t\t\r\n\t\t\t\t\tcomments = jsonObject[\"comments\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor i in 0...comments.length\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tcommentsList.push(jsonToComment(comments[i]))\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\treturn commentsList\r\n\t\t\tend",
"def comments\n comments = []\n posts = Post.all\n posts.each { |p| comments += p.comments.where(user_id: self.id) }\n return comments\n end",
"def description\n comment_sections.reject do |section|\n section.modifiers.any? or section.section\n end.map(&:comment).join(\"\\n\\n\")\n end",
"def comment_configuration\n @comment_configuration ||= HamlLint::CommentConfiguration.new(self)\n end",
"def index\n @comments = @commentable.comments\n end",
"def comments; rest_query(:comment); end",
"def comments(language = Tr8n::RequestContext.current_language)\n Tr8n::TranslationKeyComment.where(\"language_id = ? and translation_key_id = ?\", language.id, self.id).all\n end",
"def comments\r\n @comments = Comment.active.belonging_to(@entry).paginate(:all,\r\n :order => \"#{Comment.right_column_name} DESC\", \r\n :page => params[:page], :per_page => setpagesize)\r\n end",
"def list_comments(params = {})\n return false unless check_required_params(params, ['activityId'])\n\n execute_with_api({\n :args => [\n @plus_api.comments.list,\n params\n ]\n })\n end",
"def one_line_description(opts={}) ; attributes['comments'] ; end",
"def comments_hash\n I18n.available_locales.map { |l| [l, comment(l).try(:comment)] }.to_h\n end",
"def stringify_comment_array(comments); end",
"def get_comments\n @public_comments = @user_key.comments.public_only.chronological\n @private_comments = @user_key.comments.private_only.chronological\n @comment = @user_key.comments.build\n end",
"def comment\n @comment\n end",
"def comments_text\n return self.comments.inject(\"\") do |string, comment| \n string + \n (string.empty? ? \"\" : \"\\n\") +\n comment.email +\n \": \" +\n comment.message\n end\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.source)}\n return(cfg)\n end",
"def admin_comments_stats\n get_admin_stats \"comments\"\n end"
] | [
"0.6938066",
"0.6897551",
"0.688011",
"0.6876297",
"0.684835",
"0.6825231",
"0.6788851",
"0.67877203",
"0.67877203",
"0.67596716",
"0.67596716",
"0.67596716",
"0.6717209",
"0.67012393",
"0.6682884",
"0.66785896",
"0.6668563",
"0.6597387",
"0.6597387",
"0.65674895",
"0.6529552",
"0.65144217",
"0.6509871",
"0.6509871",
"0.64853275",
"0.64853275",
"0.64455664",
"0.6427617",
"0.6327555",
"0.6300144",
"0.62947404",
"0.62762594",
"0.62082523",
"0.6185189",
"0.61672777",
"0.61672777",
"0.61672777",
"0.61672777",
"0.61672777",
"0.61672777",
"0.6128548",
"0.6126182",
"0.6118326",
"0.6099592",
"0.6096741",
"0.6073262",
"0.60464436",
"0.5950772",
"0.5948005",
"0.59321445",
"0.5926816",
"0.5917173",
"0.5909071",
"0.5808527",
"0.5803496",
"0.57551605",
"0.5747468",
"0.5745251",
"0.5745251",
"0.5743099",
"0.5743099",
"0.57332855",
"0.57286215",
"0.57235754",
"0.57235754",
"0.57235754",
"0.57235754",
"0.57235754",
"0.57025295",
"0.5689328",
"0.56847954",
"0.56542754",
"0.55985063",
"0.5583684",
"0.5583209",
"0.557369",
"0.5570337",
"0.5557345",
"0.55483913",
"0.5545607",
"0.5544214",
"0.55409724",
"0.55379725",
"0.55292124",
"0.55252486",
"0.5521671",
"0.5510973",
"0.550378",
"0.5499863",
"0.54777926",
"0.5476939",
"0.5473223",
"0.54705006",
"0.5462577",
"0.545761",
"0.54506123",
"0.5450147",
"0.54413223",
"0.54286647",
"0.54286253"
] | 0.75143844 | 0 |
all the listings that belongs to current_user | def index
if params[:tag]
@listings = current_user.listings.tagged_with(params[:tag])
else
@listings = current_user.listings.all
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listings\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\t\t@listings = Listing.find_all_by_user_id(@current_user)\n\tend",
"def user_listings\n @listings =current_user.listings\n end",
"def index\n @listings = Listing.all\n @personal_listings = current_user.listings\n end",
"def index\n @listings = current_user.listing.all\n # byebug\n end",
"def my_account\n @user = current_user\n @listings = Listing.where(user: current_user)\n end",
"def me\n\t\tuser_listings = current_user.listings\n render json: [current_user, user_listings]\n end",
"def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end",
"def set_listings\n @user = User.find(params[:user_id])\n end",
"def index\n @listings = Listing.where(\"host_email = ?\", current_user.email)\n end",
"def listings\n authorize! :read, @user\n end",
"def user\n \t@user = User.find(params[:id])\n @listings = User.find(params[:id]).listings\n end",
"def index\n if user_signed_in?\n @listings = Listing.where(\n [\"location = :location or visibility = :visibility\",{\n location: current_user.zip_code.to_s.to_region(city: true),\n visibility: \"global\" }]).where(status: \"pending\")\n else\n @listings = Listing.open_global\n end\n end",
"def set_listings\n @user = User.find(params[:user_id])\n end",
"def index\n @bookings = Booking.where(user_id: current_user.id)\n end",
"def index\n @bookings = current_user.bookings\n end",
"def index\n @bookings = Booking.where(\"user_id = #{current_user.id}\")\n end",
"def listings\n return @listings ||= build_all_listings\n end",
"def listings\n return @listings ||= build_all_listings\n end",
"def listings\n return @listings ||= build_all_listings\n end",
"def listings\n @listings = trips.select do |trip|\n trip.listings\n end\n end",
"def my_listings\n @listings = current_user.listings.where('id NOT IN (SELECT DISTINCT(listing_id) FROM purchases)').page(params[:page]).per(30)\n end",
"def set_listing\n @listing = current_user.listings.find(params[:id])\n end",
"def index\n @shopping_lists = ShoppingList.where(user_id: current_user.id)\n end",
"def index\n @lists = current_user.lists.all\n end",
"def index\n @lists = current.user.list\n end",
"def find_user_id\n @listings = Listing.where(\"user_id = ?\",params[:user_id]).all\n if !@listings.empty?\n ret = []\n @listings.each do |listing|\n ret << listing.as_json(include: :book)\n end\n render :json => ret\n else\n render :json => \"user has no listings\".to_json\n end\n end",
"def index\n @lists = current_user.lists\n end",
"def index\n @lists = current_user.lists\n end",
"def index\n # view account settings\n @has_paid_listing = check_has_paid_listing?\n @user = User.find(session[:user])\n @listings = Listing.find :all,\n :conditions => [ \"user_id = ?\", session[:user] ]\n# @listing = Listing.find_by_user_id(session[:user])\n render :action => \"account/index\", :layout => \"default\"\n end",
"def index\n @listing = Listing.find(params[:listing])\n if current_user == @listing.host\n @conversations = Conversation.where(listing_id: params[:listing])\n @messages = Message.where(read: :false)\n else\n @conversations = Conversation.where(user: current_user).where(listing_id: params[:listing])\n end\n end",
"def index\n @items = Item.select { |item| item.user == current_user}\n @bookings = Booking.select { |booking| booking.user == current_user }\n end",
"def index\n @bookings = @user.bookings\n end",
"def index\n #contains all the listings\n @listings = Listing.all\n end",
"def index\n @listings = Listing.all\n \n end",
"def listings\n Trip.all.map do |trip|\n if trip.guest == self\n return trip.listing\n end\n end\n end",
"def index\n @listings = Listing.all\n end",
"def index\n @listings = Listing.all\n end",
"def index\n @listings = Listing.all\n end",
"def index\n @listings = Listing.all\n end",
"def index\n @listings = Listing.all\n end",
"def index\n @listings = Listing.all\n end",
"def index\n if (!current_user.admin?)\n @user= current_user\n @bookings = @user.bookings.all\n else\n @bookings = Booking.all\n end\n end",
"def featured_listings\n @listings = Listing.limit(5)\n render\n end",
"def listings \n Trip.all.select {|trip| trip.guest == self}.map { |trip| trip.listing}\n\n end",
"def index\n \t@listings = Listing.all\n end",
"def listing\n if current_user.admin?\n @cars = Car.all\n else\n @cars = Car.where(user: current_user)\n end\n end",
"def index\n @bookings = Booking.user(@user.id)\n end",
"def index\n if !signed_in?\n redirect_to sign_in_path\n else\n # customer?\n if allowed?(action: 'for_superadmin_customer', user: current_user)\n @listings = Listing.all\n @listing = Listing.new\n else\n return redirect_back(fallback_location: root_path)\n end\n end\n end",
"def get_all_for_sale\n Listing.find_all_by_market_status( 1 , :include => :user )\n end",
"def active_recordings\n @recordings = current_user.active_recordings\n end",
"def manage_listings\n @user = User.by_slug!(params[:slug])\n acl_manage!(on: @user)\n @state = params[:state].present? ? params[:state] : 'active'\n @category_id = params[:category_id]\n terms = [ListingFilter.user(@user.id), ListingFilter.state(@state)]\n terms.push(ListingFilter.category(@category_id)) if @category_id.present?\n query = {filter: {bool: {must: terms}}, sort: {id: \"desc\"}}\n @listings = Listing.search(query).page(page).per(100).records\n\n @title = \"#{@user.handle} | Manage Listings\"\n end",
"def my_purchases\n @listings = Listing.joins(:purchase).merge(Purchase.where(user_id: current_user.id)).page(params[:page]).per(30)\n end",
"def wanted_list usr, cid=nil, loc=nil, adminFlg=true\n ListingDataProcessor.new(@listing).wanted_list(usr, cid, loc, adminFlg)\n end",
"def listings\n list = []\n venues = Venue.all.select {|venue|venue.area_id == self.id}\n venue_ids = venues.map {|venue| venue.id}\n Listing.all.select do |listing|\n if venue_ids.any?(listing.venue_id)\n list << listing\n end\n end\n list\n end",
"def show\n @listings = Listing.find(params[:id])\n end",
"def show\n @list = current_user.list\n end",
"def index\n # if current_user.admin?\n # @meetings = Meeting.all\n # else\n # @meetings = current_user.meetings.where(user_id: current_user)\n # end\n end",
"def user_product_listings\n render json: @user.product_listings\n end",
"def index\n if current_user.role == 'admin'\n\t@shoppinglists = Shoppinglist.all\n else\n\t@shoppinglists = Shoppinglist.select{|l| l.user == current_user}\n end\n end",
"def active_listings\n @active_listings ||= Listing.find_all_active_by_category(category_name)\n end",
"def index\n @bookings = Booking.all\n # Bookings where the current user is the expert\n @as_expert = Booking.where(expert: current_user)\n # Bookings where the current user is the client\n @as_client = Booking.where(client: current_user)\n\n # All session that the current user is a part of\n @sessions = @as_expert | @as_client\n end",
"def index\n if user_signed_in?\n @listings = []\n current_user.addresses.includes(user: { addresses: [] }).pluck(:postcode).uniq.each do |cupc|\n Listing.with_attached_images.all.active.includes(user: { addresses: [] }).each do |listing|\n pc = listing.user.addresses.first.postcode\n @listings << listing if pc == cupc\n end\n end\n @listings\n else\n @listings = Listing.with_attached_images.all.active.sample(6)\n end\n end",
"def index\n if current_user\n @bookings = current_user.bookings.all\n end\n\n if current_host\n @job = Job.find_by(id: params[:job_id])\n @bookings = @job.bookings\n end\n end",
"def listing\n @listing\n end",
"def browse\n #@listings = Listing.find(:all, :order => \"type\")\n @user = current_user\n @listings = Listing.find(:all, \n :conditions => [\"user_id != ? and status = 'new'\",@user.id ],\n :order => :type, \n :page => {:size => 4, :current => params[:page]})\n @header_type = \"Browse All Listings\"\n \n \n end",
"def index\n @lists = @user.lists\n end",
"def index\n if signed_in?\n if params[:search]\n @listings = Listing.search(params[:search]).order(\"created_at DESC\")\n else\n if current_user.customer?\n @reservations = Reservation.where(user_id: current_user.id)\n elsif current_user.moderator?\n @reservations = Reservation.all\n elsif current_user.superadmin?\n @reservations = Reservation.all\n else\n flash[:error] = \"Sorry. You are not allowed to perform this action.\"\n return redirect_to root_url, notice: \"Sorry. You do not have the permissino to view the properties.\"\n end\n end\n else\n redirect_to sign_in_path\n end\n end",
"def index\n @listas = Lista.where(user_id: current_user.id)\n end",
"def user_list\n @snippets = Snippet\n .where(user: current_user)\n .paginate(page: params[:page], per_page: 30)\n .order(created_at: :desc)\n render 'user_list'\n end",
"def selected_listings(options = {})\n options = {:select => '*'}.merge(options)\n @listings ||= current_user.mtg_listings.select(options[:select]).where(:id => (params[:edit_listings_ids].keys rescue params[:edit_listings_ids].split(' ').map(&:to_i)) )\n end",
"def index\n @bookings = policy_scope(Booking.where(user_id: current_user.id))\n end",
"def my_sales\n @listings = current_user.listings.joins(:purchase).merge(Purchase.all).page(params[:page]).per(30)\n end",
"def serve_listing_data\n @listings = Listing.open.joins(:origin_loc).group(\"listings.id\").\n order(\"listings.created_at DESC\").find_with(params, @current_user, @current_community).select(\"listings.id, listing_type, category\")\n render :json => { :data => @listings }\n end",
"def index\n # # @meetings = Meeting.all\n # # Why check params for user_holder, but then using the root user one?\n # # I assume it is root user for now.\n # if params[:user_holder_id]\n # @cur_user_holder = current_user.user_holder\n # @meetings = @cur_user_holder.meetings\n # else\n # # No point to show all meeting.\n # @meetings = Meeting.all\n # end\n @pending_meetings = current_user.user_holder.meetings.where(status: \"pending\")\n @confirmed_meetings = current_user.user_holder.meetings.where(status: \"confirmed\")\n end",
"def listings\n arr = []\n Trips.all.each do |trip|\n if trip.guest == self\n arr << trip.listing\n end\n end\n arr\n end",
"def current_listing\n cites_listing\n end",
"def browse\n\t\t@listings = Listings.find(:all)\n\tend",
"def view\r\n @profile.user_id == current_user.id ? @is_user = true : @is_user = false\r\n @current_listings = Listing.where(seller_id: @profile.user_id, sold: false)\r\n @owned_planets = Planet.where(user_id: @profile.user_id)\r\n @past_listings = Listing.where(seller_id: @profile.user_id, sold: true)\r\n @user_purchases = Listing.where(buyer_id: @profile.user_id)\r\n end",
"def index\n # @booking = Booking.where(user_id: current_user.id)\n if current_user.is_admin\n @bookings = Booking.all\n elsif current_user.is_agent\n # tour_owner = Tour.where(id: params[:tour_id]).pluck(:user_id)\n @bookings = Booking.where(tour_id: params[:tour_id])#.where(user_id: tour_owner)\n elsif current_user.is_customer\n @bookings = Booking.where(user_id: current_user.id)\n end\n\n end",
"def index\n if current_user.has_role?(:superadmin) \n @bookings=Booking.all\n \n else\n @bookings=Booking.where(user_id: current_user.id)\n \n end\n\n end",
"def index\n @listings = SaleListing.all\n end",
"def index\n @listings = Listing.order('created_at DESC').limit(5)\n end",
"def index\n @current_user = User.find(session[:user_id])\n \n @loans = Loan.all\n end",
"def listings\n Zoopla::CachedListings.new.search(self).sort_by(&:updated_at).reverse!\n end",
"def index\n @bookings = smart_listing_create(:bookings, Booking.includes(:seat, :user).where(user_id: current_user.id), partial: \"bookings/listing\")\n end",
"def index\n @listings = Listing.all.where(:private => false).paginate(:page => params[:page], :per_page => 25).order(:cached_votes_score => :desc)\n @listings = Listing.all.where(:private => false).name_search(params[:l]) if params[:l]\n end",
"def index\n @listings = Listing.where(status: :paid) \n end",
"def tourn_listing_wrapper(user)\n user_list = get_user_tourns(user); #get the list\n \n listing = {}; #rtn value\n \n end",
"def index\n @meetings = User.find(params[:user_id]).meetings\n #@meetings = Array.new\n Meeting.all.each do |m|\n if m.user_id == current_user.id\n @meetings.push(m)\n end\n end\n end",
"def user_list\n @room = current_user.room\n @user_list = @room.users\n render partial: \"user_list\"\n end",
"def lists\n load_user_lists\n end",
"def index\n @lists = current_user.lists\n #@lists = List.all\n render json: @lists\n end",
"def listings\n self.trips.map{|trip| trip.listing}\n end",
"def set_user_listing\n #Find the id of a listing associated with the current user and store in an instance variable\n @listing = current_user.listings.find_by_id(params[:id])\n if @listing == nil \n flash[:alert] = \"Access denied\"\n redirect_to listings_path\n end\n end",
"def listing\n @user = User.all\n unless current_user.admin?\n redirect_to dashboard_show_path\n end \n end",
"def show\n @lists = @cocktail.lists.where(user_id: @current_user)\n # raise \"hell\"\n end",
"def all_screenings\n @all_screenings ||= festival.screenings_visible_to(user)\n end",
"def index\n @building = Building.find(params[:building_id])\n @listings = Listing.all\n end",
"def index\n Listing.destroy_all(draft:true, draft_by:current_user.id)\n\n @search = Listing.search(params[:q])\n\n @listings = @search.result.where(draft:false).order(\"created_at DESC\").page(params[:page]).per(15)\n end",
"def set_user_listing\n # find the listing and check if that listing belongs to the loggedin user\n id = params[:id]\n @listing = current_user.listings.find_by_id(id)\n # option1\n if @listing == nil\n # boot the user out\n redirect_to listings_path\n end\n # # option2:\n\n # if listing.user_id != current_user.id\n # redirect_to listings_path\n # end\n\n end"
] | [
"0.884166",
"0.86853826",
"0.8165919",
"0.78842926",
"0.77413684",
"0.76383317",
"0.7507519",
"0.73346674",
"0.7302317",
"0.7245117",
"0.72264403",
"0.7220218",
"0.7213203",
"0.71016943",
"0.7086736",
"0.70820016",
"0.70707357",
"0.70707357",
"0.70707357",
"0.70372427",
"0.69537073",
"0.69340944",
"0.6906621",
"0.6877935",
"0.68770343",
"0.6865291",
"0.6837684",
"0.6837684",
"0.68267554",
"0.68012184",
"0.67862886",
"0.6784172",
"0.6760957",
"0.67596847",
"0.67554355",
"0.67363197",
"0.67363197",
"0.67363197",
"0.67363197",
"0.67363197",
"0.67363197",
"0.6719002",
"0.66299784",
"0.6629287",
"0.662023",
"0.661618",
"0.66109353",
"0.6604442",
"0.66007376",
"0.6583189",
"0.65799403",
"0.6578057",
"0.65596",
"0.6535818",
"0.65354925",
"0.65298784",
"0.65146375",
"0.65091693",
"0.64911324",
"0.6488656",
"0.6485806",
"0.6479534",
"0.6437028",
"0.64311934",
"0.6426256",
"0.64221525",
"0.64194894",
"0.64104545",
"0.639723",
"0.6393359",
"0.63922834",
"0.6363617",
"0.6349547",
"0.6334803",
"0.63273615",
"0.63194984",
"0.6313117",
"0.6310694",
"0.63093764",
"0.6308927",
"0.63045317",
"0.63041776",
"0.6293535",
"0.62897813",
"0.6282095",
"0.62750185",
"0.62692934",
"0.6258399",
"0.62580836",
"0.624356",
"0.6239592",
"0.6238436",
"0.62234855",
"0.62140715",
"0.6210736",
"0.62061113",
"0.6205811",
"0.6204579",
"0.6199349",
"0.6182483"
] | 0.6812662 | 29 |
just one specific listing | def show
@reservation = Reservation.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def given_listing(attributes = {})\n given_listings(attributes).first\n end",
"def listing\n @listing\n end",
"def show\n # this gets the todo items listing params :id\n @listing = Listing.find(params[:id])\n end",
"def show\n impressionist(@listing)\n \n @listing = Listing.friendly.find(params[:id])\n end",
"def browse\n #@listings = Listing.find(:all, :order => \"type\")\n @user = current_user\n @listings = Listing.find(:all, \n :conditions => [\"user_id != ? and status = 'new'\",@user.id ],\n :order => :type, \n :page => {:size => 4, :current => params[:page]})\n @header_type = \"Browse All Listings\"\n \n \n end",
"def set_listing\n @listing = Listing.friendly.find(params[:id])\n end",
"def set_listing\n @listing = Listing.friendly.find(params[:id])\n end",
"def set_listing\n @listing = Listing.friendly.find(params[:id])\n end",
"def set_listing\n @listing = Listing.friendly.find(params[:id])\n end",
"def list\n @view.listing\n end",
"def show_list\n\t\t\t@my_list.show\n\t\tend",
"def current_listing\n cites_listing\n end",
"def listing\n @listing = Listing.find(params[:listing_id])\n end",
"def show\n @listing = Listing.find(params[:listing_id])\n end",
"def featured_listings\n @listings = Listing.limit(5)\n render\n end",
"def start_special_list_item\n end",
"def default\n document_link = @opts[:path].last\n if @opts[:path].size == 1 or document_link == 'bloggers'\n list_bloggers\n elsif @opts[:path].size == 2 \n list(@opts[:path])\n else\n show(document_link)\n end\nend",
"def show\n #debugger\n @photos = @listing.photos.order(\"order_priority ASC\")\n @main_photo = Photo.where(listing_id: @listing.id, main_photo: true).first\n if @main_photo \n @main_photo = @main_photo.image_url\n end\n\n @title = \"\"\n @title = \"#{@listing.street_number} \" if @listing.show_street_number\n @title = @title + \"#{@listing.address}, \"\n @title = @title + \"Unit #{@listing.unit_number}, \" unless @listing.unit_number.blank? || !@listing.show_unit_number\n @title = @title + \"#{@listing.city_province}\"\n\n end",
"def search_results(all_pages)\n formatted_list = []\n all_pages.each do |show_hash|\n formatted_list << \"id. #{show_hash[\"id\"]} - #{show_hash[\"name\"]}\"\n end\n if formatted_list.count != 1\n self.print_search_results(formatted_list)\n else\n fetch_show_by_id(all_pages[0][\"id\"].to_s)\n end\nend",
"def next\n if next_listing = self.class.where(\"id > ?\", id).first\n next_listing\n else\n Listing.first\n end\n end",
"def set_listing\n @listing = Listing.find_by_slug!(params[:id])\n end",
"def show\n #using cached results provide similar performance so we use cache in order to limit DB I/O\n @sales_listing = SalesListing.cached_saleslisting(params[:id])\n @items = Item.all_cached_item\n # using uncached results provide better performance, might be due to smaller data set\n @listing_statuses = ListingStatus.find(:all, :select => \"id, description\", :order => \"description\")\n respond_to do |format|\n if @sales_listing.user_id == current_user[:id] then\n format.html # show.html.erb\n format.xml { render :xml => @sales_listing }\n else\n format.html { redirect_to(signin_path, :notice => 'You can only view your own listings') }\n end\n end\n end",
"def show_list\n process_show_list\n end",
"def show\n @listing_status = ListingStatus.find(:first, :conditions => [\"id = ?\", params[:id]], :select => 'id, description, position, is_final', :order => 'description')\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @listing_status }\n end\n end",
"def show\n @listings = Listing.find(params[:id])\n end",
"def index\n # @listings = Listing.all\n @listings = Listing.order(:name).page params[:page]\n end",
"def browse\n\t\t@listings = Listings.find(:all)\n\tend",
"def show\n initLists\n end",
"def show\n @website = Website.find_by_id(@page.website_id) \n @websitepages = @website.pages \n @times = @website.timetables\n @sections = @page.page_sections\n\n if (@page.title == \"inventory\")\n # @newlisting = Listing.new(\"https://fierce-sea-43472.herokuapp.com/categories.json\")\n # @listings = @newlisting.getresponse((User.find_by_id(@website.user_id).email).to_s) \n if params[:sort].present? && params[:direction].present?\n @listings = Inventory.where(:website_id => @website.id).search(params[:search]).order(params[:sort] + \" \" + params[:direction]).paginate(:per_page => 12, :page => params[:page]) \n else\n @listings = Inventory.where(:website_id => @website.id).search(params[:search]).paginate(:per_page => 12, :page => params[:page]) \n end\n\n # @listings = Inventory.where(:website_id => @website.id)\n \n end\n\n end",
"def index\n @listings = Listing.all.where(:private => false).paginate(:page => params[:page], :per_page => 25).order(:cached_votes_score => :desc)\n @listings = Listing.all.where(:private => false).name_search(params[:l]) if params[:l]\n end",
"def show\n @listings = Listing.find_by_programming_language_id(params[:id])\n end",
"def show\n @list = List.find(params[:id])\n end",
"def index\n @list_items = @list.list_items\n end",
"def show\n @listing = Listing.find(params[:id])\n # this line ensures that the you'll only see the reviews for the selected listings, you won't see all reviews of all listings\n @reviews = @listing.reviews\n end",
"def show\n @listing_type = ListingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def list\n display_meals\n end",
"def show\n @list = List.find(params[:id])\n end",
"def show\n @list = List.find(params[:id])\n end",
"def show\n @listing = Listing.find(params[:id])\n if params[:sort]\n @bids = Bid.where(:listing_id => @listing).order(params[:sort] + ' DESC')\n else\n @bids = Bid.where(:listing_id => @listing)\n end\n end",
"def index\n @listings = current_user.listing.all\n # byebug\n end",
"def run\n self.welcome.listing_titles\n loop do \n home_listings\n end\n end",
"def index\n #contains all the listings\n @listings = Listing.all\n end",
"def index\n\t\tlist\n\t\trender('list')\n\tend",
"def index\n\t\tlist\n\t\trender('list')\n\tend",
"def show\n if user_signed_in?\n @list = List.includes( listeds: [:listable] ).find(params[:id])\n render layout: 'layouts/twoColumn'\n else\n respond_to do |format|\n format.html { redirect_to management_lists_path(:user), notice: 'You must have an account to manage lists' }\n format.json { head :no_content }\n end\n end\n end",
"def start_special_list(list_type)\n end",
"def show #Should show the item depending on the requested item, not on the current user!\n begin\n @listing = Listing.find(:first, :conditions => [\"id = ? and removed = ? and creation = ?\", params[:id], \"0\", \"completed\"])\n if !self.current_user.blank?\n @favorite = Favorite.find(:first, :conditions => [\"user_id = ? and listing_id = ?\", self.current_user.id, @listing.id])\n @hearted = Hearted.find(:first, :conditions => [\"user_id = ? and listing_id = ?\", self.current_user.id, @listing.id])\n end \n @listings = Listing.find(:all, :conditions => [\"seller_id = ? and id != ? and removed = ? and creation = ?\", @listing.seller_id, @listing.id, \"0\", \"completed\"], :limit => 10)\n logger.info @listings.inspect\n #Select items for the carrousel\n @pictures = []\n @listings.each do |l| \n @pic = l.pic1.url(:small)\n logger.info \"run\"\n logger.info @pic.inspect\n @pictures << @pic\n end \n logger.info @pictures.inspect\n @shop = Shop.find(:first, :conditions => [\"seller_id = ?\", @listing.seller_id]) \n @l1_link = listing_overview_path\n @l1_name = \"Items\"\n @l2_link = listing_path\n if self.current_user\n if self.current_user.is_seller? and self.current_user.seller.id == @listing.seller_id\n @l2_name = \"Item \" + @listing.id.to_s \n else\n @l2_name = \"Item \" + @listing.id.to_s\n end\n end\n @listing.v += 1\n @listing.save\n rescue\n flash[:notice_bad] = t(\"controllers.listings.s5\")\n redirect_to site_path\n else\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @listing }\n end\n end\nend",
"def index\n #if params[:category].blank?\n @datagalleries = Datagallery.paginate(:page => params[:page], :per_page => 10).order(\"created_at DESC\")\n #else\n #@category_id = Category.find_by(name: params[:category]).id\n #@listings = Listing.where(category_id: @category_id).order(\"created_at DESC\")\n #end\n end",
"def show\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @list_item }\n end\n end",
"def first ; list.first ; end",
"def print_list(type='all')\n\n\t\tputs \"{#name} List - #{type} items\"\n\t\tprint '-' * 30 + \"\\n\"\n\n\n\n\t\ttodo_items.each do |item|\n\t\t\tcase type\n\t\t\twhen 'all'\n\t\t\tputs item\n\t\twhen 'complete'\n\t\t\tputs item if item.complete?\n\t\twhen 'incomplete'\n\t\t\tputs item unless item.complete?\n\t\tend\n\t\tend\n\tend",
"def show\n @websitepages = @website.pages\n @pages = @websitepages.where(:show_page_on_index => true)\n @times = @website.timetables \n @search = Inventory.where(:website_id => @website.id).ransack(params[:q]) \n @listings = @search.result.paginate(:per_page => 12, :page => params[:page]) \n @search.build_condition \n\n # @newlisting = Listing.new(\"https://fierce-sea-43472.herokuapp.com/categories.json\") \n # @listings = @newlisting.getresponse((User.find_by_id(@website.user_id).email).to_s)\n # if params[:sort].present? && params[:direction].present?\n \n # else\n # @listings = @search.result.paginate(:per_page => 12, :page => params[:page]) \n # end\n\n end",
"def set_listing\n\t\t\t@listing = Listing.find(params[:id])\n\t\tend",
"def list\n\n end",
"def index\n @working_specific_small_items = WorkingSpecificSmallItem.all\n end",
"def retrieve_listing_basics(listingDetail, listing)\n\t\t\t\tcase listingDetail[\"communityCode\"]\n\t\t\t\twhen \"NY026\"\n\t\t\t\t\tlisting[:title] = \"343 Gold Street\"\n\t\t\t\t\tlisting[:city_name] = \"Brooklyn\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"11201\"\n\t\t\t\t\tlisting[:contact_tel] = \"7185963143\"\n\t\t\t\t\tlisting[:description] = \"Avalon Fort Greene brings new meaning to luxury with these unbeatable Brooklyn apartments built on fabulous green living principles. The massive Fort Greene Avalon Tower offers spaciously designed studios along with one-, two- and three-bedroom designs that boast spectacular views of Manhattan and Brooklyn while providing residents a high-quality living experience. Inside the homes you’ll find a wide range of amenities including spacious floor plans, vaulted ceiling, mini blinds, stainless steel sinks, linen closets, high ceilings, large closets and balconies or patios. Residents are also privy to community amenities like a state of the art fitness center, stylish resident lounge, urban park plaza and valet parking service. Adding to the list of enticing features is the fact that our Brooklyn apartments have a courteous and attentive staff as well as all the necessary amenities to cater to the most discerning New York residents.\"\n\t\t\t\t\tlisting[:amenities] = [\"In-unit washer/dryer\",\"24-hour emergency maintenance\",\"Resident clubhouse\",\"On-site ZipCar\",\"Ceramic tile flooring\",\"ENERGY STAR appliances\",\"Marble vanity\"]\n\n\t\t\t\twhen \"DV007\"\n\t\t\t\t\tlisting[:title] = \"214 Duffield Street\"\n\t\t\t\t\tlisting[:city_name] = \"Brooklyn\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"11201\"\n\t\t\t\t\tlisting[:contact_tel] = \"7185963143\"\n\t\t\t\t\tlisting[:description] = \"\"\n\t\t\t\t\tlisting[:amenities] = \"\"\n\n\t\t\t\twhen \"DV102\"\n\t\t\t\t\tlisting[:title] = \"240 East Shore Road\"\n\t\t\t\t\tlisting[:city_name] = \"Great Neck\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"11023\"\n\t\t\t\t\tlisting[:contact_tel] = \"7185963143\"\n\t\t\t\t\tlisting[:description] = \"\"\n\t\t\t\t\tlisting[:amenities] = \"\"\n\n\t\t\t\twhen \"NY011\"\n\t\t\t\t\tlisting[:title] = \"2-01 50th Avenue\"\n\t\t\t\t\tlisting[:city_name] = \"Long Island City\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"11101\"\n\t\t\t\t\tlisting[:contact_tel] = \"7187297800\"\n\t\t\t\t\tlisting[:description] = \"In the heart of Long Island City, the stunning Avalon Riverview North is an urban paradise entrenched near the East River, LaGuardia Airport and Grand Central Station. Our apartments in Long Island City offer spacious studios and one-, two- or three-bedroom floor plans to fit your needs. These stunning Long Island City apartments feature gourmet kitchens with granite countertops, washer and dryers, modern hardwood floors, maple cabinetry and so much more. The community has a host of amenities as well, including a 24-hour concierge, state of the art fitness center, 9th floor sparkling swimming pool with views of Manhattan and a roof-garden with barbecue grills are just a few of the amenities at your disposal.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Spectacular views of Manhattan skyline\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"10 minutes to Grand Central on 7 train\",\"Beautifully landscaped courtyards\"]\n\n\t\t\t\twhen \"NY034\"\n\t\t\t\t\tlisting[:title] = \"525 West 28th Street\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10001\"\n\t\t\t\t\tlisting[:contact_tel] = \"2122391323\"\n\t\t\t\t\tlisting[:description] = \"AVA is a first. Our apartments are energized by this great city, personalized by you. You're on the High Line - steps away from the high life of art galleries, eclectic dining, and exciting clubs and bars such as the Frying Pan. Yep. Take our DIY kits and go to town in your new West Chelsea apartment. Our brand new studio, 1- and 2-bedroom apartments feature stainless steel appliances, black quartz countertops, plank flooring, and built-in charging stations.We're also smoke free, eco-friendly,and pet-friendly (big dogs too). Work out in our awesome fitness center, take in city views on the 14th floor roof deck or attend social events exclusive to AVA friends. Dive in and make it yours.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Chill Lounge\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"Smoke-free community\",\"Affordable housing available\"]\n\n\t\t\t\twhen \"NY018\"\n\t\t\t\t\tlisting[:title] = \"4-75 48th Avenue\"\n\t\t\t\t\tlisting[:city_name] = \"Long Island City\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"11109\"\n\t\t\t\t\tlisting[:contact_tel] = \"7189371390\"\n\t\t\t\t\tlisting[:description] = \"In the heart of Long Island City, the stunning Avalon Riverview North is an urban paradise entrenched near the East River, LaGuardia Airport and Grand Central Station. Our apartments in Long Island City offer spacious studios and one-, two- or three-bedroom floor plans to fit your needs. These stunning Long Island City apartments feature gourmet kitchens with granite countertops, washer and dryers, modern hardwood floors, maple cabinetry and so much more. The community has a host of amenities as well, including a 24-hour concierge, state of the art fitness center, 9th floor sparkling swimming pool with views of Manhattan and a roof-garden with barbecue grills are just a few of the amenities at your disposal.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Spectacular views of Manhattan skyline\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"10 minutes to Grand Central on 7 train\",\"Beautifully landscaped courtyards\"]\n\n\t\t\t\twhen \"NY034\"\n\t\t\t\t\tlisting[:title] = \"525 West 28th Street\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10001\"\n\t\t\t\t\tlisting[:contact_tel] = \"2122391323\"\n\t\t\t\t\tlisting[:description] = \"AVA is a first. Our apartments are energized by this great city, personalized by you. You're on the High Line - steps away from the high life of art galleries, eclectic dining, and exciting clubs and bars such as the Frying Pan. Yep. Take our DIY kits and go to town in your new West Chelsea apartment. Our brand new studio, 1- and 2-bedroom apartments feature stainless steel appliances, black quartz countertops, plank flooring, and built-in charging stations.We're also smoke free, eco-friendly,and pet-friendly (big dogs too). Work out in our awesome fitness center, take in city views on the 14th floor roof deck or attend social events exclusive to AVA friends. Dive in and make it yours.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Chill Lounge\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"Smoke-free community\",\"Affordable housing available\"]\n\n\t\t\t\twhen \"NY015\"\n\t\t\t\t\tlisting[:title] = \"11 East First Street\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10003\"\n\t\t\t\t\tlisting[:contact_tel] = \"2123877720\"\n\t\t\t\t\tlisting[:description] = \"Avalon Bowery Place was designed to let you indulge in Manhattan living, the way you always dreamt. Set in the famed Bowery, this luxury residence puts you in the center of an all-encompassing lifestyle. Our luxury New York City apartments offer studios and one- or two-bedroom designs that showcase the finest blend of sophisticated appointments. These apartments in New York have features that include fully equipped gourmet kitchens with stainless steel appliances, washers and dryers, hardwood flooring, floor to ceiling windows, spacious walk-in closets and private terraces and balconies. Residents of our New York apartments have a long list of stellar community amenities at their disposal as well. These include unbeatable features such as garage parking, a landscaped courtyard, a sundeck with gas barbecue grill, views of both downtown and uptown Manhattan, a resident lounge, amazing on-site retail shops and a state of the art fitness center are all here at the apartments in New York City.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"Private balcony or patio\",\"Chill Lounge\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"Smoke-free community\",\"Garages and covered parking\"]\n\n\t\t\t\twhen \"NY533\"\n\t\t\t\t\tlisting[:title] = \"515 West 52nd Street\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10019\"\n\t\t\t\t\tlisting[:contact_tel] = \"2129578200\"\n\t\t\t\t\tlisting[:description] = \"In the midst of the bustling city of Manhattan, you will discover the serenity of world class living at Avalon Clinton. Stumble upon thoughtfully designed studio, one-, and two-bedroom New York apartment rentals that will cater to all your needs. All our homes are equipped with luxurious amenities like floor-to-ceiling windows, parquet wood flooring, spacious closets, and white-on-white appliances. The Avalon Clinton apartment community offers breathtaking views of the Manhattan skyline as well as a wealth of facilities such as two private health clubs, cat-friendly homes, roof-top sky decks, and laundry rooms. The brilliant array of features and a courteous on-site staff makes this Avalon community the ideal place to set up your new home.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"On-site retail and restaurants\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\t\t\t\twhen \"NYC40\"\n\t\t\t\t\tlisting[:title] = \"377 East 33rd Street\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10016\"\n\t\t\t\t\tlisting[:contact_tel] = \"2126841333\"\n\t\t\t\t\tlisting[:description] = \"Enjoy beautiful views of the East River and the Chrysler building from your stunning apartment homes at Avalon Kips Bay. Discover studio, one-, two-, three- and four-bedroom New York apartment rentals that surpass all expectations in terms of their quality and design. Each of our lovely homes is equipped with amazing features such as granite countertops, stainless steel appliances, European-style marble vanities and high-speed internet access. You'll also enjoy excellent facilities within our Avalon community like an on-site fitness center with cardio theater equipment, additional storage and parking. The great collection of amenities and a professional on-site staff makes Avalon Kips Bay the ideal place to set up your new home.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Ceramic tile flooring\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\t\t\t\twhen \"NY525\"\n\t\t\t\t\tlisting[:title] = \"250 West 50th Street\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10019\"\n\t\t\t\t\tlisting[:contact_tel] = \"2122455050\"\n\t\t\t\t\tlisting[:description] = \"Discover life in the Big Apple with beautiful studio, one- and two-bedroom New York apartments at Avalon Midtown West. Enjoy a wide array of world class features such as open architecture featuring angled walls, high ceilings and wall-to-wall windows that provide sweeping city views, modern appliances, breakfast bars and white cabinetry, parquet wood flooring, and Botticino marble hotel-style vanities in the bathrooms. The Midtown West community also provides various facilities for residents like a fitness Center featuring cardio theatre equipment, resistance machines, free weights and a sauna, a wireless lounge fitted with convenient laptop tables, complimentary WiFi service and plasma TV, laundry facilities, Thalia Restaurant and the Food Emporium located on site on the ground level, and an expansive community room with multiple seating groups, plasma TV, laptop tables and caterers kitchen. The excellent amenities and professional on-site staff make this New York community the ideal place to live.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"On site ATM\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\n\t\t\t\twhen \"NY023\"\n\t\t\t\t\tlisting[:title] = \"1 Morningside Drive\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10025\"\n\t\t\t\t\tlisting[:contact_tel] = \"2123160529\"\n\t\t\t\t\tlisting[:description] = \"Wake up every day next to the stunning Morningside and Central Parks right in the heart of Manhattan at Avalon Morningside Park. Our brand new high-rise apartments in New York City, on Manhattan's Upper West Side, offer spacious studios and one-, two- and three-bedroom options each boasting breathtaking views of the New York City skyline, East River, the parks and the rest of the sights of the city that never sleeps. The apartments in New York City sport luxury amenities like gourmet kitchens equipped with beautiful granite countertops and stainless steel appliances, spacious bathrooms with marble vanities, walk-in closets, floor to ceiling windows, washers and dryers in each home and beautiful hardwood floors. Residents can also enjoy a host of spectacular features like a state of the art fitness center with cardio theater, yoga room, children’s playroom, game room, resident lounge, landscaped courtyards and the easy access to the nearby parks’ biking and jogging trails.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"ENERGY STAR appliances\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\t\t\t\twhen \"NY029\"\n\t\t\t\t\tlisting[:title] = \"282 11th Avenue\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10001\"\n\t\t\t\t\tlisting[:contact_tel] = \"2125642813\"\n\t\t\t\t\tlisting[:description] = \"We believe elevating where you live is about blending it seamlessly with how you live. We go to great lengths designing amenities and choosing locations that put everything within reach. Where you live, is where you come alive. In a flourishing area, Avalon offers New York apartments that cater to all of your needs. Escape the hustle and bustle of midtown, inside our refreshing smoke-free community. Within our walls, you'll find thoughtfully designed studio, one- and two-bedroom apartment homes. Imagine entertaining in gourmet kitchens with ENERGY STAR® stainless steel appliances and quartz stone countertops. Live your life effortlessly with amenities that include a state-of-the-art fitness center, a resident lounge with a large entertaining kitchen and an outdoor lounge on the 8th floor with Hudson River and skyline views. Not to mention our community is also within walking distance to Citi Bike, C/E subway lines, Penn Station and the High Line. Make Avalon West Chelsea your next home and personal retreat within the city. This is not just apartment living. This is living up.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Central to the 7-line subway extension and the High Line\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\t\t\t\twhen \"NY037\"\n\t\t\t\t\tlisting[:title] = \"100 Willoughby Street\"\n\t\t\t\t\tlisting[:city_name] = \"Brooklyn\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"11201\"\n\t\t\t\t\tlisting[:contact_tel] = \"7186431581\"\n\t\t\t\t\tlisting[:description] = \"Which is why we chose to be in the heart of it all - steps from cultural icons such as the Barclay's Center and Brooklyn Flea, and local restaurants and nightlife of Fort Greene, Carroll Gardens, and Brooklyn Heights. Our brand new studio, 1-, 2-, and 3-bedroom floor plans feature kitchens with stainless steel appliances, quartz-stone countertops, and tile backsplashes. Plus, each unit comes with hard-surface plank flooring, in-unit washer/dryer, and built-in charging station. Our community also features a 58th floor rooftop deck and lounge, 30th floor terrace with fire pit and grills, heated indoor/outdoor dog run, and fully-equipped fitness center . Best of all, we're directly above the subway giving you immediate access to the A, C, F, and R trains, and less than a 5-minute walk from the 2, 3, 4, 5, B, N, and Q trains - making your home the perfect home base.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Hard-surface plank flooring\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\n\t\t\t\twhen \"NJ002\"\n\t\t\t\t\tlisting[:title] = \"444 Washington Boulevard\"\n\t\t\t\t\tlisting[:city_name] = \"Jersey City\"\n\t\t\t\t\tlisting[:state_name] = \"NJ\"\n\t\t\t\t\tlisting[:zipcode] = \"07310\"\n\t\t\t\t\tlisting[:contact_tel] = \"2012169200\"\n\t\t\t\t\tlisting[:description] = \"Located by the historic Waterfront Walkway on the Hudson River, Avalon Cove brings a new sense of luxury living to this metropolis. Our newly renovated Jersey City apartments boast one-, two-, three- and four-bedroom designs in this bustling haven. Some of the upgrades you will find include designer gourmet kitchens with granite counters, stainless-steel appliances, hardwood floors, espresso cabinetry, marble tile bathrooms, spacious walk-in closets and private patios and balconies with great views of Manhattan. Residents can choose to spend their leisure time in the landscaped barbecue and picnic areas, at the sparkling outdoor heated swimming pool, state of the art fitness center, clubroom with billiards or at the beautiful waterfront walkway. Residents can also engage in sporting activities as our Jersey City apartments have an indoor basketball court, two lighted tennis courts and two indoor racquetball courts. Residents of our apartments in Jersey City also have access to local public transportation, on-site storage units, private garage space, gated entrance with controlled access and 24-hour maintenance service.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"Marble tile entries and baths\",\"Spacious walk-in closets\",\"24-hour emergency maintenance\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\t\t\t\tend\n\t\t\t\tlisting\n\t\t\tend",
"def index\n @lists = List.includes(:user, :category).page(params[:page])\n\n if params[:category_id]\n @category = Category.where('lower(slug) = ?', params[:category_id].downcase).first!\n @lists = @lists.where(category: @category)\n end\n\n # Set default tab\n unless %w(newest excellent).includes? params[:tab]\n params[:tab] = 'newest'\n end\n\n case params[:tab]\n when 'newest'\n @lists = @lists.order(hot: :desc)\n when 'excellent'\n @lists = @lists.order(id: :desc)\n end\n end",
"def find_by_ln\n \t@listing = Listing.where(:LN => params[:ln]).first\n \tputs @listing.inspect\n \t\n \t# get gmap for the property location\n \t@gmaps = @listing.to_gmaps4rails unless @listing.nil?\n \tputs \"GMAPS JSON: #{@gmaps}\"\n \t\n \tif @listing.nil? then\n \t\t# catch non-existent listing numbers, redirect to home\n \t\tredirect_to '/'\n \telse\n\t \trender :template => 'listings/show'\n \tend\n end",
"def index\n @foods = Listing.all\n # Orders posts (Default is newst -> oldest) and sets paginate paramaters\n @foods = Listing.order(\"created_at DESC\")\n\n if params[:search]\n @foods = Listing.where('tool LIKE ?', \"%#{params[:search]}%\")\n end\n end",
"def index\n list\n render(\"list\")\n end",
"def set_listing\n\t\t@listing = Listing.find(params[:id])\n\tend",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def set_listing\n @listing = Listing.find(params[:id])\n end",
"def find_some(names,options={})\n return Postal.driver.selectLists(names,'')\n end",
"def show\n @listing = Listing.find(params[:id])\n # User might send information request\n if session[:information_request] # Load data from session after redirect\n @information_request = session[:information_request]\n session.delete(:information_request)\n else\n @information_request = InformationRequest.new\n end\n add_recent_listing(@listing) # remember listings seen\n end",
"def index\n list\n end",
"def index\n list\n end",
"def show\n #@item = Item.find(params[:id])\n #@item = Item.find(params[:id]) if Item.find(params[:id]).list.user == current_user\n if params[:id].blank?\n @item\n else\n @item ||= current_user.lists.find(Item.find(params[:id]).list.id).items.find(params[:id])\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item }\n end\n end",
"def show\n dummy_item\n end",
"def display_list\n puts \"-----------YOUR GIFTLIST-----------\"\n if $list.any?\n $list.each_with_index do |item, index|\n puts \"#{index + 1} #{item[:gift_status]} #{item[:gift_name]}\"\n end\n else\n puts \"Your list is empty\"\n end\nend",
"def index\n list\n\trender('list')\n end",
"def retrieve_listing_basics(listingDetail, listing)\n\t\t\t\tlisting[:title] = \"444 Washington Boulevard\"\n\t\t\t\tlisting[:city_name] = \"Jersey City\"\n\t\t\t\tlisting[:state_name] = \"NJ\"\n\t\t\t\tlisting[:zipcode] = \"07310\"\n\t\t\t\tlisting[:contact_tel] = \"2012169200\"\n\t\t\t\tlisting[:description] = \"Located by the historic Waterfront Walkway on the Hudson River, Avalon Cove brings a new sense of luxury living to this metropolis. Our newly renovated Jersey City apartments boast one-, two-, three- and four-bedroom designs in this bustling haven. Some of the upgrades you will find include designer gourmet kitchens with granite counters, stainless-steel appliances, hardwood floors, espresso cabinetry, marble tile bathrooms, spacious walk-in closets and private patios and balconies with great views of Manhattan. Residents can choose to spend their leisure time in the landscaped barbecue and picnic areas, at the sparkling outdoor heated swimming pool, state of the art fitness center, clubroom with billiards or at the beautiful waterfront walkway. Residents can also engage in sporting activities as our Jersey City apartments have an indoor basketball court, two lighted tennis courts and two indoor racquetball courts. Residents of our apartments in Jersey City also have access to local public transportation, on-site storage units, private garage space, gated entrance with controlled access and 24-hour maintenance service.\"\n\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"Marble tile entries and baths\",\"Spacious walk-in closets\",\"24-hour emergency maintenance\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\t\t\t\treturn listing\n\t\t\tend",
"def first(number = nil)\n if number\n self.class.new(@list.first(number), type: @type, api_client: @api_client)\n else\n @list.first\n end\n end",
"def set_listing\n @listing = Listing.find(params[\"id\"])\n end"
] | [
"0.65429056",
"0.6476397",
"0.6350077",
"0.63299024",
"0.61577284",
"0.6090166",
"0.6090166",
"0.6090166",
"0.6090166",
"0.6080957",
"0.6035764",
"0.5994395",
"0.5980632",
"0.59770596",
"0.59299946",
"0.59226084",
"0.5914771",
"0.59146106",
"0.59105045",
"0.589528",
"0.5895064",
"0.58904433",
"0.587491",
"0.5873984",
"0.5872512",
"0.5864998",
"0.58374494",
"0.583359",
"0.5811609",
"0.5804579",
"0.5795787",
"0.5748067",
"0.57437325",
"0.5742519",
"0.5714129",
"0.57113755",
"0.5703105",
"0.5703105",
"0.5702869",
"0.56888574",
"0.568437",
"0.5678888",
"0.5669143",
"0.5669143",
"0.5661654",
"0.5655243",
"0.56462187",
"0.563227",
"0.56287867",
"0.5628424",
"0.56237257",
"0.5613874",
"0.5613563",
"0.5610791",
"0.5605328",
"0.5604808",
"0.56015295",
"0.55997133",
"0.5594868",
"0.5592177",
"0.55839795",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.5579599",
"0.55785835",
"0.5578582",
"0.5578026",
"0.5578026",
"0.557562",
"0.55753666",
"0.5574164",
"0.55741525",
"0.557086",
"0.5567814",
"0.5566635"
] | 0.0 | -1 |
get the page that lets you create a new post | def new
@listing = Listing.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @page_title = \"New Blog\"\n @blogpost = Blogpost.new\n end",
"def new\n # responsbile for creating a new instance of a post\n @post = Post.new\n end",
"def create\n @post = Post.new(post_params)\n if @post.save\n redirect_to find_redirect(@post.page)\n else\n render :new\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def new_post\n @i = 0\n @post_title = params[:title]\n @post\n render \"post\"\n end",
"def newPost(_, _, _, metaweblog_struct, _)\n post = Post.create(@db.content_path, metaweblog_struct)\n @db.refresh_post_paths\n\n run_user_cmd\n post['postid']\n end",
"def new_page\n page = Page.new\n page.url = params[:id] if Page.url?(params[:id]) && params[:id] != 'new-page'\n page\n end",
"def new\n # Display a form to create a new post\n # The actual post creation is handled by method: create\n @post = Post.new\n end",
"def new \n @post = Post.new\n end",
"def new #http://localhost:3000/posts/new\n\t@post = Post.new #creates a new empty post,if a form is created for it, it will be empty as well \n end",
"def new # Showing the new form\n # Responsible for creating a new instance of a post - not saved in DB yet.\n @post = Post.new\n end",
"def new\n\t@post = Post.new\nend",
"def new\t\n\t\t@post = Post.new\n\tend",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\r\n @post = Post.new\r\n end",
"def fetch_create_post\n end",
"def new_post_uri\n @new_post_uri ||= \"#{base_uri}/newpost\"\n end",
"def new\n \t@post = Post.new\n end",
"def new \n @post = Post.new\n end",
"def new \n\t\t@post = Post.new\n\tend",
"def new\n @post = Post.new\n\n end",
"def new\n @post = Post.new\n\n end",
"def create\n @post = Post.new(page_params)\n if @post.save\n redirect_to '/posts'\n else\n render 'new'\n end\n end",
"def new\n @post = Post.new()\n end",
"def new\n @post = Post.new()\n end",
"def new\n @post = Post.new()\n end",
"def new\n\t\t@post = Post.new \n\tend",
"def click_new_post\n click NEW_POST_BUTTON\n end",
"def new\n\t @post = Post.new\n\tend",
"def new\n\t\t@post = Post.new\n\tend",
"def new\n\t\t@post = Post.new\n\tend",
"def new\n\t\t@post = Post.new\n\tend",
"def new\n\t\t@post = Post.new\n\tend",
"def new\n\t\t@post = Post.new\n\tend",
"def new\n\t\t@post = Post.new\n\tend",
"def new\n @post = Post.new #creates new instance of the/a post\n #since it's only creating an instance in memory have to create/post method create blw\n end",
"def new\n @post = Post.new\nend",
"def new\n\t\t@post = @document.build_post\n\tend",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new #returns an empty post\n end",
"def new\n @post = Post.new\n @pages = current_user.pages.select('id, title')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n render :new\n end",
"def new\n @page = Page.find_by_title('Huren bij Xposers')\n end",
"def new\n\t\t@post = Post.new\n\t\trender :new\n\tend",
"def page_post\n Post.find_by_permalink(params[:id])\n end",
"def new\n redirect_to posts_path and return unless Mist.authorized?(:create_post, self)\n @post = Mist::Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n $classpage = Classpage.find(params[:classpage])\n @post = Post.new\n end",
"def new\n @page = Page.new\n end",
"def new\n @page = Page.new\n end",
"def new\n @page = Page.new\n end",
"def new\n @page = Page.new\n end",
"def new\n @revision = Revision.create(params[:revision])\n redirect_to page_base_url(:page_title => @revision.page.title)\n end",
"def new\n @post = Post.new()\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html\n end\n end",
"def new\n @root_pages = [fetch_root_page].flatten\n if request.post?\n @page = ComatosePage.new params[:page]\n @page.author = fetch_author_name\n if @page.save\n flash[:notice] = \"Created page '#{@page.title}'\"\n redirect_to :controller=>self.controller_name, :action=>'index'\n end\n else\n @page = ComatosePage.new :title=>'New Page', :parent_id=>(params[:parent] || nil)\n end\n end",
"def new\n @post = Post.new\n @title = \"New Post\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n format.json { render :json => @post }\n end\n end",
"def new\n @post = model.new\n\n respond_to do |format|\n format.html { render :action => resource_template(\"new\") }\n end\n end",
"def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def new\n @post = Post.new\n\n assert(@post.kind_of?(Post))\n\n return @post\n end",
"def new\n @post = Post.new\n @title = \"New post\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post253 = Post253.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post253 }\n end\n end",
"def new\n @post = Post.new(content: params[:content])\n end"
] | [
"0.7164712",
"0.7093431",
"0.7008371",
"0.6987437",
"0.69851446",
"0.69717884",
"0.6901042",
"0.68375283",
"0.683118",
"0.6823701",
"0.68218505",
"0.6798911",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795959",
"0.6795431",
"0.67923975",
"0.6788173",
"0.67735696",
"0.6773422",
"0.6768606",
"0.6768475",
"0.67602915",
"0.67602915",
"0.6739544",
"0.67306143",
"0.67306143",
"0.67306143",
"0.6706936",
"0.6695271",
"0.66910076",
"0.66907924",
"0.66907924",
"0.66907924",
"0.66907924",
"0.66907924",
"0.66907924",
"0.66782504",
"0.6670773",
"0.66671866",
"0.6655644",
"0.66518027",
"0.6616033",
"0.66152525",
"0.660722",
"0.6587548",
"0.65825605",
"0.6580542",
"0.65713346",
"0.6565515",
"0.6565515",
"0.6565515",
"0.65652037",
"0.6559166",
"0.6558482",
"0.6533033",
"0.6518278",
"0.6512019",
"0.6503969",
"0.649792",
"0.64922845",
"0.64920664",
"0.64894927",
"0.64861083",
"0.6484109"
] | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.